| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517 |
- * {
- margin: 0;
- padding: 0;
- box-sizing: border-box;
- }
- body {
- font-family: 'Microsoft YaHei', Arial, sans-serif;
- background-color: #f5f5f5;
- color: #333;
- line-height: 1.6;
- }
- .container {
- max-width: 1200px;
- margin: 0 auto;
- padding: 20px;
- }
- h1 {
- text-align: center;
- color: #2c3e50;
- margin-bottom: 30px;
- font-size: 2.5em;
- }
- h3 {
- color: #34495e;
- margin-bottom: 15px;
- font-size: 1.3em;
- }
- /* 控制区域样式 */
- .control-section,
- .data-section {
- background: white;
- border-radius: 8px;
- padding: 20px;
- margin-bottom: 20px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
- }
- .port-controls {
- display: flex;
- align-items: center;
- gap: 15px;
- flex-wrap: nowrap;
- }
- .port-controls label {
- font-weight: bold;
- color: #2c3e50;
- }
- /* 自定义端口选择框样式 */
- .port-select-wrapper {
- position: relative;
- display: inline-block;
- flex: 1;
- min-width: 100px;
- }
- #portSelect {
- padding: 8px 12px;
- border: 2px solid #ddd;
- border-radius: 4px;
- font-size: 14px;
- min-width: 100px;
- background-color: white;
- width: 100%;
- }
- #portSelect:focus {
- outline: none;
- border-color: #3498db;
- }
- .port-options {
- position: absolute;
- top: 100%;
- left: 0;
- right: 0;
- background-color: white;
- border: 1px solid #ddd;
- border-radius: 4px;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
- z-index: 1000;
- max-height: 200px;
- overflow-y: auto;
- display: none;
- }
- .port-options.show {
- display: block;
- }
- .port-option {
- padding: 8px 12px;
- cursor: pointer;
- border-bottom: 1px solid #eee;
- }
- .port-option:hover {
- background-color: #f5f5f5;
- }
- .port-option:last-child {
- border-bottom: none;
- }
- .btn-group {
- display: flex;
- flex-wrap: wrap;
- gap: 12px;
- margin-left: auto;
- }
- .btn-group .btn {
- padding: 12px 12px ;
- flex: 0 0 auto;
- min-width: 100px;
- }
- /* 当按钮组单独占一行时,让按钮平均分布并拉伸 */
- @media (max-width: 768px) {
- .btn-group {
- width: 100%;
- margin-left: 0;
- margin-top: 10px;
- }
-
- .btn-group .btn {
- flex: 1;
- min-width: 0;
- }
- }
- /* 当容器空间不足时,按钮组换行并拉伸 */
- @container (max-width: 600px) {
- .port-controls {
- flex-direction: column;
- align-items: stretch;
- }
-
- .btn-group {
- width: 100%;
- margin-left: 0;
- margin-top: 10px;
- }
-
- .btn-group .btn {
- flex: 1;
- min-width: 0;
- }
- }
- /* 为了支持容器查询,需要给父容器添加容器上下文 */
- .port-controls {
- container-type: inline-size;
- display: flex;
- align-items: center;
- gap: 15px;
- flex-wrap: wrap;
- }
- /* 按钮样式 */
- .btn {
- padding: 10px 20px;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-size: 14px;
- font-weight: bold;
- transition: all 0.3s ease;
- text-transform: none;
- }
- .btn:hover {
- transform: translateY(-2px);
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
- }
- .btn:disabled {
- opacity: 0.6;
- cursor: not-allowed;
- transform: none;
- box-shadow: none;
- }
- .btn-primary {
- background-color: #3498db;
- color: white;
- }
- .btn-primary:hover:not(:disabled) {
- background-color: #2980b9;
- }
- .btn-secondary {
- background-color: #95a5a6;
- color: white;
- }
- .btn-secondary:hover:not(:disabled) {
- background-color: #7f8c8d;
- }
- .btn-warning {
- background-color: #f39c12;
- color: white;
- }
- .btn-warning:hover:not(:disabled) {
- background-color: #e67e22;
- }
- .btn-info {
- background-color: #17a2b8;
- color: white;
- }
- .btn-info:hover:not(:disabled) {
- background-color: #138496;
- }
- .btn-success {
- background-color: #27ae60;
- color: white;
- }
- .btn-success:hover:not(:disabled) {
- background-color: #229954;
- }
- /* 数据控制区域 */
- .data-controls {
- display: flex;
- flex-direction: column;
- gap: 15px;
- }
- .input-group {
- display: flex;
- align-items: center;
- gap: 10px;
- flex-wrap: wrap;
- }
- .input-group label {
- font-weight: bold;
- color: #2c3e50;
- min-width: 80px;
- }
- .input-group input {
- flex: 1;
- padding: 8px 12px;
- border: 2px solid #ddd;
- border-radius: 4px;
- font-size: 14px;
- min-width: 200px;
- }
- .input-group input:focus {
- outline: none;
- border-color: #3498db;
- }
- /* 复选框控制区域 */
- .checkbox-section {
- background: white;
- border-radius: 8px;
- padding: 20px;
- margin-bottom: 20px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
- }
- /* 日志区域样式 */
- .log-section {
- background: white;
- border-radius: 8px;
- padding: 20px;
- margin-bottom: 20px;
- box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
- }
- /* 复选框组样式 */
- .checkbox-group {
- display: flex;
- flex-wrap: wrap;
- gap: 20px;
- margin-bottom: 20px;
- padding: 15px;
- background-color: #f8f9fa;
- border-radius: 5px;
- border: 1px solid #e9ecef;
- }
- .checkbox-group label {
- display: flex;
- align-items: center;
- font-weight: 500;
- color: #495057;
- cursor: pointer;
- user-select: none;
- }
- .checkbox-group input[type="checkbox"] {
- margin-right: 8px;
- transform: scale(1.2);
- }
- /* 数据表格样式 */
- .data-table {
- width: 100%;
- border-collapse: collapse;
- margin-bottom: 20px;
- background-color: white;
- border-radius: 5px;
- overflow: hidden;
- box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
- }
- .data-table th,
- .data-table td {
- padding: 12px 15px;
- text-align: left;
- border-bottom: 1px solid #dee2e6;
- }
- .data-table th {
- background-color: #3498db;
- color: white;
- font-weight: bold;
- text-transform: uppercase;
- letter-spacing: 0.5px;
- }
- .data-table tr:nth-child(even) {
- background-color: #f8f9fa;
- }
- .data-table tr:hover {
- background-color: #e9f7fe;
- }
- .data-table td {
- color: #495057;
- }
- .log-output {
- background-color: #2c3e50;
- color: #ecf0f1;
- padding: 15px;
- border-radius: 4px;
- height: 400px;
- overflow-y: auto;
- font-family: 'Consolas', 'Monaco', monospace;
- font-size: 13px;
- line-height: 1.4;
- white-space: pre-wrap;
- word-wrap: break-word;
- }
- .log-output::-webkit-scrollbar {
- width: 8px;
- }
- .log-output::-webkit-scrollbar-track {
- background: #34495e;
- }
- .log-output::-webkit-scrollbar-thumb {
- background: #7f8c8d;
- border-radius: 4px;
- }
- .log-output::-webkit-scrollbar-thumb:hover {
- background: #95a5a6;
- }
- /* 日志消息样式 */
- .log-message {
- margin-bottom: 5px;
- padding: 2px 0;
- }
- .log-message.info {
- color: #3498db;
- }
- .log-message.success {
- color: #27ae60;
- }
- .log-message.warning {
- color: #f39c12;
- }
- .log-message.error {
- color: #e74c3c;
- }
- .log-message.read {
- color: #17a2b8;
- }
- .log-message.write {
- color: #27ae60;
- }
- .log-message.open {
- color: #f39c12;
- }
- .log-message.close {
- color: #e74c3c;
- }
- /* 状态区域 */
- .status-section {
- text-align: center;
- padding: 10px;
- }
- .status {
- padding: 8px 16px;
- border-radius: 20px;
- font-weight: bold;
- font-size: 14px;
- }
- .status.connected {
- background-color: #d4edda;
- color: #155724;
- border: 1px solid #c3e6cb;
- }
- .status.disconnected {
- background-color: #f8d7da;
- color: #721c24;
- border: 1px solid #f5c6cb;
- }
- /* 响应式设计 */
- @media (max-width: 768px) {
- .container {
- padding: 10px;
- }
- .port-controls {
- flex-direction: row;
- align-items: center;
- flex-wrap: wrap;
- gap: 10px;
- }
- .port-controls>* {
- margin-bottom: 0;
- }
- .input-group {
- flex-direction: column;
- align-items: stretch;
- }
- .input-group label {
- min-width: auto;
- }
- .input-group input {
- min-width: auto;
- }
- .log-output {
- height: 300px;
- font-size: 12px;
- }
- }
- /* 动画效果 */
- @keyframes fadeIn {
- from {
- opacity: 0;
- transform: translateY(10px);
- }
- to {
- opacity: 1;
- transform: translateY(0);
- }
- }
- .log-message {
- animation: fadeIn 0.3s ease-out;
- }
- /* 加载动画 */
- .loading {
- display: inline-block;
- width: 20px;
- height: 20px;
- border: 3px solid #f3f3f3;
- border-top: 3px solid #3498db;
- border-radius: 50%;
- animation: spin 1s linear infinite;
- }
- @keyframes spin {
- 0% {
- transform: rotate(0deg);
- }
- 100% {
- transform: rotate(360deg);
- }
- }
|