api-dialog.scss 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. // 全局变量定义
  2. $primary-color: #165DFF;
  3. $secondary-color: #6B7280;
  4. $success-color: #00B42A;
  5. $warning-color: #FFAA00;
  6. $error-color: #F53F3F;
  7. $text-primary: #333333;
  8. $text-secondary: #666666;
  9. $text-tertiary: #999999;
  10. $border-color: #E5E7EB;
  11. $bg-light: #F9FAFB;
  12. $bg-white: #FFFFFF;
  13. $shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  14. $shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  15. $shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  16. // 对话框容器
  17. .api-dialog {
  18. min-width: 700px;
  19. max-width: 900px;
  20. max-height: 90vh;
  21. border-radius: 12px;
  22. overflow: hidden;
  23. background-color: $bg-white;
  24. display: flex;
  25. flex-direction: column;
  26. }
  27. // 对话框头部
  28. .dialog-header {
  29. display: flex;
  30. justify-content: space-between;
  31. align-items: center;
  32. padding: 20px 24px;
  33. border-bottom: 1px solid $border-color;
  34. background-color: $bg-light;
  35. flex-shrink: 0;
  36. .dialog-title {
  37. font-size: 18px;
  38. font-weight: 600;
  39. color: $text-primary;
  40. margin: 0;
  41. }
  42. .close-btn {
  43. color: $text-tertiary;
  44. padding: 4px;
  45. border-radius: 6px;
  46. transition: all 0.2s ease;
  47. &:hover {
  48. background-color: #E5E7EB;
  49. color: $text-secondary;
  50. }
  51. }
  52. }
  53. // 对话框内容
  54. .dialog-content {
  55. padding: 24px;
  56. overflow-y: auto;
  57. flex: 1;
  58. }
  59. // 表单区域
  60. .form-section {
  61. margin-bottom: 24px;
  62. padding-bottom: 24px;
  63. border-bottom: 1px solid $border-color;
  64. &:last-child {
  65. border-bottom: none;
  66. margin-bottom: 0;
  67. padding-bottom: 0;
  68. }
  69. .section-title {
  70. font-size: 16px;
  71. font-weight: 600;
  72. color: $text-primary;
  73. margin-bottom: 16px;
  74. }
  75. .config-description,
  76. .empty-config {
  77. background-color: #F0F9FF;
  78. border: 1px solid #D1E9FF;
  79. border-radius: 6px;
  80. padding: 12px 16px;
  81. margin-bottom: 16px;
  82. p {
  83. font-size: 13px;
  84. color: $text-secondary;
  85. margin: 0;
  86. line-height: 1.4;
  87. }
  88. }
  89. .empty-config {
  90. text-align: center;
  91. color: $text-tertiary;
  92. background-color: $bg-light;
  93. border-color: $border-color;
  94. }
  95. }
  96. // 表单组
  97. .form-group {
  98. margin-bottom: 16px;
  99. .form-field {
  100. width: 100%;
  101. .mat-form-field-wrapper {
  102. .mat-form-field-flex {
  103. border-radius: 8px;
  104. }
  105. .mat-form-field-outline {
  106. border-radius: 8px;
  107. }
  108. .mat-form-field-infix {
  109. padding: 10px 0;
  110. input,
  111. textarea {
  112. font-size: 14px;
  113. color: $text-primary;
  114. }
  115. .mat-input-element {
  116. &::placeholder {
  117. color: $text-tertiary;
  118. }
  119. }
  120. textarea {
  121. resize: vertical;
  122. min-height: 80px;
  123. }
  124. }
  125. .mat-form-field-label {
  126. font-size: 14px;
  127. color: $text-secondary;
  128. }
  129. .mat-form-field-suffix {
  130. .mat-icon {
  131. color: $text-tertiary;
  132. }
  133. }
  134. .mat-form-field-error {
  135. font-size: 12px;
  136. color: $error-color;
  137. }
  138. }
  139. }
  140. // 激活状态切换
  141. .toggle-wrapper {
  142. .active-toggle {
  143. display: flex;
  144. justify-content: flex-start;
  145. .mat-slide-toggle-content {
  146. font-size: 14px;
  147. color: $text-secondary;
  148. }
  149. }
  150. }
  151. }
  152. // 配置字段区域
  153. .config-fields {
  154. margin-bottom: 24px;
  155. }
  156. .config-field-item {
  157. background-color: $bg-light;
  158. border-radius: 8px;
  159. padding: 16px;
  160. margin-bottom: 16px;
  161. border: 1px solid $border-color;
  162. .config-field-header {
  163. display: flex;
  164. justify-content: space-between;
  165. align-items: center;
  166. margin-bottom: 12px;
  167. .field-index {
  168. font-size: 12px;
  169. font-weight: 500;
  170. color: $text-secondary;
  171. background-color: $bg-white;
  172. padding: 4px 12px;
  173. border-radius: 12px;
  174. }
  175. .remove-btn {
  176. color: $error-color;
  177. padding: 4px;
  178. }
  179. }
  180. .config-field-content {
  181. display: grid;
  182. grid-template-columns: 1fr 1fr;
  183. gap: 12px;
  184. .key-field,
  185. .value-field {
  186. .mat-form-field-wrapper {
  187. .mat-form-field-flex {
  188. border-radius: 6px;
  189. }
  190. .mat-form-field-outline {
  191. border-radius: 6px;
  192. }
  193. .mat-form-field-infix {
  194. .mat-input-element {
  195. font-size: 13px;
  196. }
  197. }
  198. .mat-form-field-label {
  199. font-size: 13px;
  200. }
  201. .mat-form-field-error {
  202. font-size: 11px;
  203. color: $error-color;
  204. }
  205. }
  206. }
  207. .value-field {
  208. .mat-form-field-wrapper {
  209. .mat-form-field-infix {
  210. textarea {
  211. resize: vertical;
  212. min-height: 60px;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. }
  219. // 添加配置字段
  220. .add-config-field {
  221. background-color: #F0F9FF;
  222. border: 2px dashed $primary-color;
  223. border-radius: 8px;
  224. padding: 16px;
  225. .add-field-content {
  226. display: grid;
  227. grid-template-columns: 1fr 1fr auto;
  228. gap: 12px;
  229. align-items: end;
  230. .key-field,
  231. .value-field {
  232. .mat-form-field-wrapper {
  233. .mat-form-field-flex {
  234. border-radius: 6px;
  235. }
  236. .mat-form-field-outline {
  237. border-radius: 6px;
  238. }
  239. .mat-form-field-infix {
  240. .mat-input-element {
  241. font-size: 13px;
  242. }
  243. }
  244. .mat-form-field-label {
  245. font-size: 13px;
  246. }
  247. }
  248. }
  249. .add-btn {
  250. height: 40px;
  251. min-width: auto;
  252. width: 40px;
  253. padding: 0;
  254. border-radius: 6px;
  255. display: flex;
  256. align-items: center;
  257. justify-content: center;
  258. &:disabled {
  259. opacity: 0.5;
  260. cursor: not-allowed;
  261. }
  262. }
  263. }
  264. }
  265. // 配置提示
  266. .config-tips {
  267. background-color: $bg-light;
  268. border-radius: 8px;
  269. padding: 16px;
  270. border: 1px solid $border-color;
  271. .tips-title {
  272. font-size: 13px;
  273. font-weight: 600;
  274. color: $text-secondary;
  275. margin-bottom: 8px;
  276. }
  277. .tips-list {
  278. list-style-type: none;
  279. padding: 0;
  280. margin: 0;
  281. li {
  282. font-size: 12px;
  283. color: $text-tertiary;
  284. margin-bottom: 4px;
  285. padding-left: 16px;
  286. position: relative;
  287. &:last-child {
  288. margin-bottom: 0;
  289. }
  290. &::before {
  291. content: "•";
  292. position: absolute;
  293. left: 0;
  294. color: $primary-color;
  295. font-weight: bold;
  296. }
  297. }
  298. }
  299. }
  300. // 元信息区域
  301. .meta-info {
  302. display: grid;
  303. grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  304. gap: 12px;
  305. .meta-item {
  306. display: flex;
  307. flex-direction: column;
  308. gap: 4px;
  309. padding: 12px;
  310. background-color: $bg-light;
  311. border-radius: 6px;
  312. border: 1px solid $border-color;
  313. label {
  314. font-size: 12px;
  315. color: $text-secondary;
  316. font-weight: 500;
  317. }
  318. .meta-value {
  319. font-size: 13px;
  320. color: $text-primary;
  321. font-family: 'Courier New', monospace;
  322. }
  323. }
  324. }
  325. // 对话框底部
  326. .dialog-footer {
  327. display: flex;
  328. justify-content: flex-end;
  329. gap: 12px;
  330. padding: 20px 24px;
  331. border-top: 1px solid $border-color;
  332. background-color: $bg-light;
  333. flex-shrink: 0;
  334. .cancel-btn {
  335. padding: 8px 24px;
  336. border-radius: 8px;
  337. font-size: 14px;
  338. font-weight: 500;
  339. color: $text-secondary;
  340. background-color: $bg-white;
  341. border: 1px solid $border-color;
  342. transition: all 0.2s ease;
  343. &:hover {
  344. background-color: #F3F4F6;
  345. border-color: $text-tertiary;
  346. }
  347. }
  348. .save-btn {
  349. padding: 8px 24px;
  350. border-radius: 8px;
  351. font-size: 14px;
  352. font-weight: 500;
  353. background-color: $primary-color;
  354. color: $bg-white;
  355. transition: all 0.2s ease;
  356. box-shadow: $shadow-sm;
  357. &:hover {
  358. background-color: #0E4BD8;
  359. box-shadow: $shadow-md;
  360. transform: translateY(-1px);
  361. }
  362. }
  363. }
  364. // 响应式设计
  365. @media (max-width: 992px) {
  366. .api-dialog {
  367. min-width: auto;
  368. width: 95vw;
  369. max-width: 800px;
  370. max-height: 95vh;
  371. }
  372. .config-field-content,
  373. .add-field-content {
  374. grid-template-columns: 1fr !important;
  375. }
  376. .add-field-content {
  377. gap: 8px !important;
  378. }
  379. .add-btn {
  380. width: 100% !important;
  381. justify-content: center;
  382. }
  383. }
  384. @media (max-width: 768px) {
  385. .dialog-header,
  386. .dialog-content,
  387. .dialog-footer {
  388. padding: 16px;
  389. }
  390. .dialog-title {
  391. font-size: 16px !important;
  392. }
  393. .meta-info {
  394. grid-template-columns: 1fr !important;
  395. }
  396. }
  397. @media (max-width: 480px) {
  398. .api-dialog {
  399. width: 100vw;
  400. max-width: none;
  401. border-radius: 0;
  402. max-height: 100vh;
  403. }
  404. .cancel-btn,
  405. .save-btn {
  406. padding: 6px 16px !important;
  407. font-size: 13px !important;
  408. }
  409. }
  410. // 滚动条样式
  411. .dialog-content {
  412. &::-webkit-scrollbar {
  413. width: 6px;
  414. }
  415. &::-webkit-scrollbar-track {
  416. background: $bg-light;
  417. border-radius: 3px;
  418. }
  419. &::-webkit-scrollbar-thumb {
  420. background: $border-color;
  421. border-radius: 3px;
  422. }
  423. &::-webkit-scrollbar-thumb:hover {
  424. background: $text-tertiary;
  425. }
  426. }