diff --git a/package.json b/package.json index 89a8936..22d6ef6 100644 --- a/package.json +++ b/package.json @@ -39,20 +39,20 @@ "jsencrypt": "3.0.0-rc.1", "minimatch": "^10.0.3", "nprogress": "0.2.0", + "qrcode": "^1.5.4", + "qrcodejs2-fix": "^0.0.1", "quill": "2.0.2", "screenfull": "5.0.2", "sortablejs": "1.10.2", "splitpanes": "2.4.1", + "uuid": "^9.0.0", "vue": "2.6.12", "vue-count-to": "1.0.13", "vue-cropper": "0.5.5", "vue-router": "3.4.9", "vuedraggable": "2.24.3", "vuex": "3.6.0", - "uuid": "^9.0.0", - "yarn": "^1.22.22", - "qrcode": "^1.5.3", - "qrcodejs2-fix": "^0.0.1" + "yarn": "^1.22.22" }, "devDependencies": { "@vue/cli-plugin-babel": "4.4.6", diff --git a/src/main.ts b/src/main.ts new file mode 100644 index 0000000..e696cf5 --- /dev/null +++ b/src/main.ts @@ -0,0 +1,15 @@ +import { createApp } from 'vue' +import './style.css' +import App from './App.vue' +import router from './router/index' + +// 导入element-plus +import ElementPlus from 'element-plus' +import 'element-plus/dist/index.css' + +const app = createApp(App) +app.use(router); +app.use(ElementPlus); + + +app.mount('#app') diff --git a/src/router/index.ts b/src/router/index.ts new file mode 100644 index 0000000..56b8586 --- /dev/null +++ b/src/router/index.ts @@ -0,0 +1,29 @@ +import { createRouter, createWebHistory } from 'vue-router'; +const routerHistory = createWebHistory(); +const router = createRouter({ + history: routerHistory, //history写法不同 + routes: [{ + path: '/', + redirect: '/home', + },{ + path: '/home', + component: () => import(`@/views/Home.vue`), + },{ + path: '/hawkEyeO', + component: () => import(`@/views/MultiView/hawkEyeO.vue`), + },{ + path: '/hawkEyeL', + component: () => import(`@/views/MultiView/hawkEyeL.vue`), + },{ + path: '/hawkEyeC', + component: () => import(`@/views/MultiView/hawkEyeC.vue`), + }, { + path: '/swipe', + component: () => import(`@/views/MultiView/Swipe.vue`), + }, + { + path: '/doubleView', + component: () => import(`@/views/MultiView/DoubleView.vue`), + }] + }); +export default router; \ No newline at end of file diff --git a/src/style.css b/src/style.css new file mode 100644 index 0000000..f478ceb --- /dev/null +++ b/src/style.css @@ -0,0 +1,82 @@ +:root { + font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif; + line-height: 1.5; + font-weight: 400; + + color-scheme: light dark; + color: rgba(255, 255, 255, 0.87); + background-color: #242424; + + font-synthesis: none; + text-rendering: optimizeLegibility; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + -webkit-text-size-adjust: 100%; +} + +a { + font-weight: 500; + color: #646cff; + text-decoration: inherit; +} +a:hover { + color: #535bf2; +} + +body { + margin: 0; + display: flex; + place-items: center; + min-width: 320px; + min-height: 100vh; +} + +h1 { + font-size: 3.2em; + line-height: 1.1; +} + +button { + border-radius: 8px; + border: 1px solid transparent; + padding: 0.6em 1.2em; + font-size: 1em; + font-weight: 500; + font-family: inherit; + background-color: #1a1a1a; + cursor: pointer; + transition: border-color 0.25s; +} +button:hover { + border-color: #646cff; +} +button:focus, +button:focus-visible { + outline: 4px auto -webkit-focus-ring-color; +} + +.card { + padding: 2em; +} + +#app { + /* max-width: 1280px; */ + /* margin: 0 auto; */ + /* padding: 2rem; */ + margin: 0; + padding: 0; + text-align: center; +} + +@media (prefers-color-scheme: light) { + :root { + color: #213547; + background-color: #ffffff; + } + a:hover { + color: #747bff; + } + button { + background-color: #f9f9f9; + } +} diff --git a/src/views/system/equ/index.vue b/src/views/system/equ/index.vue index 12565bd..fbd7801 100644 --- a/src/views/system/equ/index.vue +++ b/src/views/system/equ/index.vue @@ -50,7 +50,13 @@ - + + + + @@ -378,6 +384,54 @@ export default { return true }) }, + + downloadText (text) { + + const canvas = document.createElement('canvas'); + canvas.width = 1400; // 设置画布宽度 + canvas.height = 600; // 设置画布高度,以确保60:35的高宽比 + + // 获取 2D 上下文 + const ctx = canvas.getContext('2d'); + if (ctx) { + // 设置字体样式 + ctx.font = 'bold 128px 楷体'; + + // 设置字体颜色 + ctx.fillStyle = 'rgb(20, 17, 110)'; // 字体颜色为蓝色 + + // 设置字体间隔 + const charSpacing = 35 / 4; // 字符间隔设置为字体宽度的1/4 + const fontSize = 128; // 字体大小 + + // 计算文本的总宽度,包括字符间隔 + let totalTextWidth = 0; + for (const char of text) { + totalTextWidth += ctx.measureText(char).width + charSpacing; + } + totalTextWidth -= charSpacing; // 最后一个字符后面没有间隔 + + // 初始绘制位置,水平居中 + let currentX = (canvas.width - totalTextWidth) / 2; + + // 绘制每个字符并设置间隔 + for (const char of text) { + ctx.fillText(char, currentX, (canvas.height - fontSize) / 2); // 垂直居中绘制 + currentX += ctx.measureText(char).width + charSpacing; + } + + // 将画布保存为图片 + const link = document.createElement('a'); + link.href = canvas.toDataURL(); // 将画布转换为 base64 编码的图片链接 + link.download = '设备编号.png'; // 设置下载图片的文件名 + link.click(); // 触发点击事件下载图片 + + // 清空画布 + ctx.clearRect(0, 0, canvas.width, canvas.height); + } else { + console.error('Failed to get 2D context from canvas.'); + } + }, // 筛选节点 filterNode(value, data) { if (!value) return true @@ -570,4 +624,26 @@ export default { } } } - \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/system/equAirport/index.vue b/src/views/system/equAirport/index.vue index 87a60db..131911c 100644 --- a/src/views/system/equAirport/index.vue +++ b/src/views/system/equAirport/index.vue @@ -50,7 +50,14 @@ - + + + + + @@ -70,7 +77,14 @@ - + - + + + + @@ -358,6 +364,55 @@ export default { } ) }, + + + downloadText (text) { + + const canvas = document.createElement('canvas'); + canvas.width = 1400; // 设置画布宽度 + canvas.height = 600; // 设置画布高度,以确保60:35的高宽比 + + // 获取 2D 上下文 + const ctx = canvas.getContext('2d'); + if (ctx) { + // 设置字体样式 + ctx.font = 'bold 128px 楷体'; + + // 设置字体颜色 + ctx.fillStyle = 'rgb(20, 17, 110)'; // 字体颜色为蓝色 + + // 设置字体间隔 + const charSpacing = 35 / 4; // 字符间隔设置为字体宽度的1/4 + const fontSize = 128; // 字体大小 + + // 计算文本的总宽度,包括字符间隔 + let totalTextWidth = 0; + for (const char of text) { + totalTextWidth += ctx.measureText(char).width + charSpacing; + } + totalTextWidth -= charSpacing; // 最后一个字符后面没有间隔 + + // 初始绘制位置,水平居中 + let currentX = (canvas.width - totalTextWidth) / 2; + + // 绘制每个字符并设置间隔 + for (const char of text) { + ctx.fillText(char, currentX, (canvas.height - fontSize) / 2); // 垂直居中绘制 + currentX += ctx.measureText(char).width + charSpacing; + } + + // 将画布保存为图片 + const link = document.createElement('a'); + link.href = canvas.toDataURL(); // 将画布转换为 base64 编码的图片链接 + link.download = '设备编号.png'; // 设置下载图片的文件名 + link.click(); // 触发点击事件下载图片 + + // 清空画布 + ctx.clearRect(0, 0, canvas.width, canvas.height); + } else { + console.error('Failed to get 2D context from canvas.'); + } + }, /** 查询部门下拉树结构 */ getDeptTree() { deptTreeSelect().then(response => { @@ -569,4 +624,26 @@ export default { } } } - \ No newline at end of file + + \ No newline at end of file diff --git a/src/views/system/equOther/index.vue b/src/views/system/equOther/index.vue index 5570f3e..c8be5cb 100644 --- a/src/views/system/equOther/index.vue +++ b/src/views/system/equOther/index.vue @@ -50,7 +50,13 @@ - + + + +