diff --git a/src/main/index.js b/src/main/index.js index 937ed05..b5468cc 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -23,8 +23,8 @@ app.commandLine.appendSwitch('disable-web-security'); function createWindow() { // Create the browser window. const mainWindow = new BrowserWindow({ - width: 1100, - height: 700, + width: 1280, + height: 1024, show: false, autoHideMenuBar: true, icon, diff --git a/src/renderer/src/views/calibration/index.vue b/src/renderer/src/views/calibration/index.vue index abf0652..a0c67b9 100644 --- a/src/renderer/src/views/calibration/index.vue +++ b/src/renderer/src/views/calibration/index.vue @@ -19,10 +19,11 @@
- + @@ -56,6 +73,7 @@ import { ElMessage } from 'element-plus'; const selectedScheme = ref('scheme1'); const playState = ref(false); const devices = ref([]); +const isScroll = ref(true); const schemes = ref([ { value: 'scheme1', @@ -84,19 +102,66 @@ const generateMockDevices = () => { devices.value = mockDevices; }; +const generateRandomLog = () => { + // 获取当前时间 HH:MM:SS.ms + const now = new Date(); + const hours = now.getHours().toString().padStart(2, '0'); + const minutes = now.getMinutes().toString().padStart(2, '0'); + const seconds = now.getSeconds().toString().padStart(2, '0'); + const milliseconds = now.getMilliseconds().toString().padStart(3, '0'); + const time = `${hours}:${minutes}:${seconds}.${milliseconds}`; + + // 生成10到50个随机字符 + const length = Math.floor(Math.random() * 41) + 10; // 10-50 + const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 条码添加删除更新扫描验证'; + let randomText = ''; + + for (let i = 0; i < length; i++) { + randomText += chars.charAt(Math.floor(Math.random() * chars.length)); + } + + // 组合成日志 + return `${time} ${randomText}`; +} + +const generateLogs = () => { + // const logCount = Math.floor(Math.random() * 10) + 1; // 1-10 logs + // for (let i = 0; i < logCount; i++) { + // + // } + if (logs.value.length > 1000) { + logs.value.shift(); + } + logs.value.push(generateRandomLog()); + if (isScroll.value) { + setTimeout(() => { + let div = document.querySelector('#log-box-main'); + div.scrollTop = div.scrollHeight; + }, 200); + } +}; + + onMounted(() => { generateMockDevices(); + setInterval(()=>{ + generateLogs() + },1500) }); +const toggleIsScroll = () => { + isScroll.value = !isScroll.value; +}; + const startExecution = () => { ElMessage.info('开始执行'); - playState.value = true; + playState.value = true; // Add actual start logic here }; const stopExecution = () => { ElMessage.info('停止执行'); - playState.value = false; + playState.value = false; // Add actual stop logic here }; @@ -173,7 +238,6 @@ const openSettings = () => { color: #999; } - .color-green { color: #67c23a; /* Green for connected */ } @@ -207,12 +271,46 @@ const openSettings = () => { margin: 2px 0; color: #dcdcdc; } - +.log-box-main { + font-family: 'Courier New', Courier, monospace; + padding: 5px; + font-size: 10px; + white-space: pre-wrap; + flex-grow: 1; + overflow-y: auto; + border: 1px solid #555; + background-color: #202020; + color: #dcdcdc; + scroll-behavior: smooth; + .log-item { + word-wrap: break-word; + word-break: break-all; + font-size: 12px; + user-select: text; + line-height: 18px; + font-weight: 500; + margin-left: 8px; + .iconfont { + &.icon-icon_fuzhi { + line-height: 26px; + margin-left: 8px; + font-size: 16px; + color: #0066cc; + cursor: pointer; + } + } + } +} +.calibration-footer-btn{ + font-size: 12px; + padding-top: 5px; + display: flex; + align-items: center; + justify-content: space-between; +} .version-info { text-align: right; - font-size: 12px; - padding-top: 5px; - color: #888; + color: #888; } /* Element Plus component overrides if needed */ @@ -247,11 +345,11 @@ const openSettings = () => { //} :deep(.device-grid .el-card__header) { - padding: 10px; + padding: 10px 5px; } :deep(.device-grid .el-card__body) { - padding: 10px; + padding: 10px 5px; } /* Ensure select dropdowns are also styled if needed */