style.css 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517
  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. body {
  7. font-family: 'Microsoft YaHei', Arial, sans-serif;
  8. background-color: #f5f5f5;
  9. color: #333;
  10. line-height: 1.6;
  11. }
  12. .container {
  13. max-width: 1200px;
  14. margin: 0 auto;
  15. padding: 20px;
  16. }
  17. h1 {
  18. text-align: center;
  19. color: #2c3e50;
  20. margin-bottom: 30px;
  21. font-size: 2.5em;
  22. }
  23. h3 {
  24. color: #34495e;
  25. margin-bottom: 15px;
  26. font-size: 1.3em;
  27. }
  28. /* 控制区域样式 */
  29. .control-section,
  30. .data-section {
  31. background: white;
  32. border-radius: 8px;
  33. padding: 20px;
  34. margin-bottom: 20px;
  35. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  36. }
  37. .port-controls {
  38. display: flex;
  39. align-items: center;
  40. gap: 15px;
  41. flex-wrap: nowrap;
  42. }
  43. .port-controls label {
  44. font-weight: bold;
  45. color: #2c3e50;
  46. }
  47. /* 自定义端口选择框样式 */
  48. .port-select-wrapper {
  49. position: relative;
  50. display: inline-block;
  51. flex: 1;
  52. min-width: 100px;
  53. }
  54. #portSelect {
  55. padding: 8px 12px;
  56. border: 2px solid #ddd;
  57. border-radius: 4px;
  58. font-size: 14px;
  59. min-width: 100px;
  60. background-color: white;
  61. width: 100%;
  62. }
  63. #portSelect:focus {
  64. outline: none;
  65. border-color: #3498db;
  66. }
  67. .port-options {
  68. position: absolute;
  69. top: 100%;
  70. left: 0;
  71. right: 0;
  72. background-color: white;
  73. border: 1px solid #ddd;
  74. border-radius: 4px;
  75. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  76. z-index: 1000;
  77. max-height: 200px;
  78. overflow-y: auto;
  79. display: none;
  80. }
  81. .port-options.show {
  82. display: block;
  83. }
  84. .port-option {
  85. padding: 8px 12px;
  86. cursor: pointer;
  87. border-bottom: 1px solid #eee;
  88. }
  89. .port-option:hover {
  90. background-color: #f5f5f5;
  91. }
  92. .port-option:last-child {
  93. border-bottom: none;
  94. }
  95. .btn-group {
  96. display: flex;
  97. flex-wrap: wrap;
  98. gap: 12px;
  99. margin-left: auto;
  100. }
  101. .btn-group .btn {
  102. padding: 12px 12px ;
  103. flex: 0 0 auto;
  104. min-width: 100px;
  105. }
  106. /* 当按钮组单独占一行时,让按钮平均分布并拉伸 */
  107. @media (max-width: 768px) {
  108. .btn-group {
  109. width: 100%;
  110. margin-left: 0;
  111. margin-top: 10px;
  112. }
  113. .btn-group .btn {
  114. flex: 1;
  115. min-width: 0;
  116. }
  117. }
  118. /* 当容器空间不足时,按钮组换行并拉伸 */
  119. @container (max-width: 600px) {
  120. .port-controls {
  121. flex-direction: column;
  122. align-items: stretch;
  123. }
  124. .btn-group {
  125. width: 100%;
  126. margin-left: 0;
  127. margin-top: 10px;
  128. }
  129. .btn-group .btn {
  130. flex: 1;
  131. min-width: 0;
  132. }
  133. }
  134. /* 为了支持容器查询,需要给父容器添加容器上下文 */
  135. .port-controls {
  136. container-type: inline-size;
  137. display: flex;
  138. align-items: center;
  139. gap: 15px;
  140. flex-wrap: wrap;
  141. }
  142. /* 按钮样式 */
  143. .btn {
  144. padding: 10px 20px;
  145. border: none;
  146. border-radius: 4px;
  147. cursor: pointer;
  148. font-size: 14px;
  149. font-weight: bold;
  150. transition: all 0.3s ease;
  151. text-transform: none;
  152. }
  153. .btn:hover {
  154. transform: translateY(-2px);
  155. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  156. }
  157. .btn:disabled {
  158. opacity: 0.6;
  159. cursor: not-allowed;
  160. transform: none;
  161. box-shadow: none;
  162. }
  163. .btn-primary {
  164. background-color: #3498db;
  165. color: white;
  166. }
  167. .btn-primary:hover:not(:disabled) {
  168. background-color: #2980b9;
  169. }
  170. .btn-secondary {
  171. background-color: #95a5a6;
  172. color: white;
  173. }
  174. .btn-secondary:hover:not(:disabled) {
  175. background-color: #7f8c8d;
  176. }
  177. .btn-warning {
  178. background-color: #f39c12;
  179. color: white;
  180. }
  181. .btn-warning:hover:not(:disabled) {
  182. background-color: #e67e22;
  183. }
  184. .btn-info {
  185. background-color: #17a2b8;
  186. color: white;
  187. }
  188. .btn-info:hover:not(:disabled) {
  189. background-color: #138496;
  190. }
  191. .btn-success {
  192. background-color: #27ae60;
  193. color: white;
  194. }
  195. .btn-success:hover:not(:disabled) {
  196. background-color: #229954;
  197. }
  198. /* 数据控制区域 */
  199. .data-controls {
  200. display: flex;
  201. flex-direction: column;
  202. gap: 15px;
  203. }
  204. .input-group {
  205. display: flex;
  206. align-items: center;
  207. gap: 10px;
  208. flex-wrap: wrap;
  209. }
  210. .input-group label {
  211. font-weight: bold;
  212. color: #2c3e50;
  213. min-width: 80px;
  214. }
  215. .input-group input {
  216. flex: 1;
  217. padding: 8px 12px;
  218. border: 2px solid #ddd;
  219. border-radius: 4px;
  220. font-size: 14px;
  221. min-width: 200px;
  222. }
  223. .input-group input:focus {
  224. outline: none;
  225. border-color: #3498db;
  226. }
  227. /* 复选框控制区域 */
  228. .checkbox-section {
  229. background: white;
  230. border-radius: 8px;
  231. padding: 20px;
  232. margin-bottom: 20px;
  233. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  234. }
  235. /* 日志区域样式 */
  236. .log-section {
  237. background: white;
  238. border-radius: 8px;
  239. padding: 20px;
  240. margin-bottom: 20px;
  241. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  242. }
  243. /* 复选框组样式 */
  244. .checkbox-group {
  245. display: flex;
  246. flex-wrap: wrap;
  247. gap: 20px;
  248. margin-bottom: 20px;
  249. padding: 15px;
  250. background-color: #f8f9fa;
  251. border-radius: 5px;
  252. border: 1px solid #e9ecef;
  253. }
  254. .checkbox-group label {
  255. display: flex;
  256. align-items: center;
  257. font-weight: 500;
  258. color: #495057;
  259. cursor: pointer;
  260. user-select: none;
  261. }
  262. .checkbox-group input[type="checkbox"] {
  263. margin-right: 8px;
  264. transform: scale(1.2);
  265. }
  266. /* 数据表格样式 */
  267. .data-table {
  268. width: 100%;
  269. border-collapse: collapse;
  270. margin-bottom: 20px;
  271. background-color: white;
  272. border-radius: 5px;
  273. overflow: hidden;
  274. box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  275. }
  276. .data-table th,
  277. .data-table td {
  278. padding: 12px 15px;
  279. text-align: left;
  280. border-bottom: 1px solid #dee2e6;
  281. }
  282. .data-table th {
  283. background-color: #3498db;
  284. color: white;
  285. font-weight: bold;
  286. text-transform: uppercase;
  287. letter-spacing: 0.5px;
  288. }
  289. .data-table tr:nth-child(even) {
  290. background-color: #f8f9fa;
  291. }
  292. .data-table tr:hover {
  293. background-color: #e9f7fe;
  294. }
  295. .data-table td {
  296. color: #495057;
  297. }
  298. .log-output {
  299. background-color: #2c3e50;
  300. color: #ecf0f1;
  301. padding: 15px;
  302. border-radius: 4px;
  303. height: 400px;
  304. overflow-y: auto;
  305. font-family: 'Consolas', 'Monaco', monospace;
  306. font-size: 13px;
  307. line-height: 1.4;
  308. white-space: pre-wrap;
  309. word-wrap: break-word;
  310. }
  311. .log-output::-webkit-scrollbar {
  312. width: 8px;
  313. }
  314. .log-output::-webkit-scrollbar-track {
  315. background: #34495e;
  316. }
  317. .log-output::-webkit-scrollbar-thumb {
  318. background: #7f8c8d;
  319. border-radius: 4px;
  320. }
  321. .log-output::-webkit-scrollbar-thumb:hover {
  322. background: #95a5a6;
  323. }
  324. /* 日志消息样式 */
  325. .log-message {
  326. margin-bottom: 5px;
  327. padding: 2px 0;
  328. }
  329. .log-message.info {
  330. color: #3498db;
  331. }
  332. .log-message.success {
  333. color: #27ae60;
  334. }
  335. .log-message.warning {
  336. color: #f39c12;
  337. }
  338. .log-message.error {
  339. color: #e74c3c;
  340. }
  341. .log-message.read {
  342. color: #17a2b8;
  343. }
  344. .log-message.write {
  345. color: #27ae60;
  346. }
  347. .log-message.open {
  348. color: #f39c12;
  349. }
  350. .log-message.close {
  351. color: #e74c3c;
  352. }
  353. /* 状态区域 */
  354. .status-section {
  355. text-align: center;
  356. padding: 10px;
  357. }
  358. .status {
  359. padding: 8px 16px;
  360. border-radius: 20px;
  361. font-weight: bold;
  362. font-size: 14px;
  363. }
  364. .status.connected {
  365. background-color: #d4edda;
  366. color: #155724;
  367. border: 1px solid #c3e6cb;
  368. }
  369. .status.disconnected {
  370. background-color: #f8d7da;
  371. color: #721c24;
  372. border: 1px solid #f5c6cb;
  373. }
  374. /* 响应式设计 */
  375. @media (max-width: 768px) {
  376. .container {
  377. padding: 10px;
  378. }
  379. .port-controls {
  380. flex-direction: row;
  381. align-items: center;
  382. flex-wrap: wrap;
  383. gap: 10px;
  384. }
  385. .port-controls>* {
  386. margin-bottom: 0;
  387. }
  388. .input-group {
  389. flex-direction: column;
  390. align-items: stretch;
  391. }
  392. .input-group label {
  393. min-width: auto;
  394. }
  395. .input-group input {
  396. min-width: auto;
  397. }
  398. .log-output {
  399. height: 300px;
  400. font-size: 12px;
  401. }
  402. }
  403. /* 动画效果 */
  404. @keyframes fadeIn {
  405. from {
  406. opacity: 0;
  407. transform: translateY(10px);
  408. }
  409. to {
  410. opacity: 1;
  411. transform: translateY(0);
  412. }
  413. }
  414. .log-message {
  415. animation: fadeIn 0.3s ease-out;
  416. }
  417. /* 加载动画 */
  418. .loading {
  419. display: inline-block;
  420. width: 20px;
  421. height: 20px;
  422. border: 3px solid #f3f3f3;
  423. border-top: 3px solid #3498db;
  424. border-radius: 50%;
  425. animation: spin 1s linear infinite;
  426. }
  427. @keyframes spin {
  428. 0% {
  429. transform: rotate(0deg);
  430. }
  431. 100% {
  432. transform: rotate(360deg);
  433. }
  434. }