From 5618b6e13c3b162a2a2283c742aec81029e745b5 Mon Sep 17 00:00:00 2001 From: unknown <331404948@qq.com> Date: Thu, 23 Nov 2023 18:59:04 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9D=99=E6=80=81=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/js/waterMark.js | 84 +++++++++++ components/.DS_Store | Bin 0 -> 6148 bytes components/cc-waterMark/.DS_Store | Bin 0 -> 6148 bytes components/cc-waterMark/Detail.vue | 38 +++++ components/cc-waterMark/index.vue | 70 ++++++++++ components/cc-waterMark/waterMark.js | 85 ++++++++++++ components/myTab/myTab.vue | 23 +++ package.json | 20 +++ pages.json | 76 +++++++++- pages/index/index.vue | 12 +- pages/sub/batchExecution/batchExecution.vue | 77 ++++++++++ pages/sub/batchExecution/executionDetails.vue | 141 +++++++++++++++++++ pages/sub/batchExecution/selectMachine.vue | 78 +++++++++++ pages/sub/batchExecution/selectTemplate.vue | 71 ++++++++++ pages/sub/executionRecord/executionRecord.vue | 152 ++++++++++++++++++++ pages/sub/logPanel/addNewLog.vue | 87 ++++++++++++ pages/sub/logPanel/logPanel.vue | 162 ++++++++++++++++++++++ pages/sub/machineList/machineList.vue | 86 +++++++++++- pages/sub/mechanicalLog/mechanicalLog.vue | 123 ++++++++++++++++ pages/sub/mechanicalMonitor/mechanicalMonitor.vue | 146 +++++++++++++++++++ 20 files changed, 1513 insertions(+), 18 deletions(-) create mode 100644 common/js/waterMark.js create mode 100644 components/.DS_Store create mode 100644 components/cc-waterMark/.DS_Store create mode 100644 components/cc-waterMark/Detail.vue create mode 100644 components/cc-waterMark/index.vue create mode 100644 components/cc-waterMark/waterMark.js create mode 100644 components/myTab/myTab.vue create mode 100644 package.json create mode 100644 pages/sub/batchExecution/batchExecution.vue create mode 100644 pages/sub/batchExecution/executionDetails.vue create mode 100644 pages/sub/batchExecution/selectMachine.vue create mode 100644 pages/sub/batchExecution/selectTemplate.vue create mode 100644 pages/sub/executionRecord/executionRecord.vue create mode 100644 pages/sub/logPanel/addNewLog.vue create mode 100644 pages/sub/logPanel/logPanel.vue create mode 100644 pages/sub/mechanicalLog/mechanicalLog.vue create mode 100644 pages/sub/mechanicalMonitor/mechanicalMonitor.vue diff --git a/common/js/waterMark.js b/common/js/waterMark.js new file mode 100644 index 0000000..51c4c59 --- /dev/null +++ b/common/js/waterMark.js @@ -0,0 +1,84 @@ +'use strict' + +const watermark = {} + +/** + * + * @param {要设置的水印的内容} str + * @param {需要设置水印的容器} container + */ +const setWatermark = (str, container, fillColor) => { + + // 唯一id + const id = '1.23452384164.123412415' + + // + if ((container === '') || (container === undefined)) { + // 如何不传值 默认以body作为水印底板 + container = document.body; + + } + + // 查看页面上有没有,如果有则删除 + if (document.getElementById(id) !== null) { + const childelement = document.getElementById(id) + childelement.parentNode.removeChild(childelement) + } + + var containerWidth = container.offsetWidth // 获取父容器宽 + var containerHeight = container.offsetHeight + 360 // 获取父容器高再加上一个固定高度 + container.style.position = 'relative' // 设置布局为相对布局 + + // 创建canvas元素(先制作一块背景图) + const can = document.createElement('canvas') + // 获取屏幕宽度的一半 + can.width = document.body.clientWidth / 2 // 设置每一块的宽度 + can.height = 240 // 高度 + const cans = can.getContext('2d') // 获取canvas画布 + cans.rotate(-20 * Math.PI / 180) // 逆时针旋转π/9 + cans.font = '14px Vedana' // 设置字体 + // 'rgba(200, 200, 200, 0.20)' + if (fillColor == undefined) { + + cans.fillStyle = '#4473FF' // 设置字体的颜色 + } else { + + cans.fillStyle = fillColor // 设置字体的颜色 + + } + + cans.textAlign = 'left' // 文本对齐方式 + cans.textBaseline = 'Middle' // 文本基线 + cans.fillText(str, 0, 4 * can.height / 5) // 绘制文字 + + // 创建一个div元素 + const div = document.createElement('div') + div.id = id // 设置id + div.style.pointerEvents = 'none' // 取消所有事件 + div.style.top = '0px' + div.style.left = '0px' + div.style.position = 'absolute' + div.style.zIndex = '100000' + div.style.width = containerWidth + 'px' + div.style.height = containerHeight + 'px' + div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat' + container.appendChild(div) // 追加到页面 + + return id +} + +// 该方法只允许调用一次 +watermark.set = (str, container, fillColor) => { + let id = setWatermark(str, container, fillColor) + setInterval(() => { + if (document.getElementById(id) === null) { + id = setWatermark(str, container, fillColor) + } + }, 500) + // 监听页面大小的变化 + window.onresize = () => { + setWatermark(str, container) + } +} + +export default watermark \ No newline at end of file diff --git a/components/.DS_Store b/components/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b3546068000f6d9b043230c2bc8cde3e066665d9 GIT binary patch literal 6148 zcmeHKO;6iE5S?P~5vlgDyH3<3A`i}3YoK|?xSxH>YA!PaROT8H z71X1gjwza|mc;+40MFe5UE;S&C1&l<{N;3glGRXWL;gh^)TxW3^%kLUc+m2n#-fn`c7-b-`L(9ulS?g4a8qIx5nd!xAf`r z-bv>=y~*^Q838H0x5hp?oWMPT7j?M}^DNcbPt;8K6P}@ftIS=5kpxz^1iDJ z999-Bos>I#D0gS&PAJOU9oP3wIjO*+w4#70@V5ed_JcKf|Nr{(`QH>tBMOKD?^6L) zKMW7s7@ON$r$)(ptq;F|vvFNz@ri=KY{jVMt#}!340)deVBoN_hzv|V1dI&Qhyt&w Fz;C+)T;%`& literal 0 HcmV?d00001 diff --git a/components/cc-waterMark/.DS_Store b/components/cc-waterMark/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..c8f5d5d7c4921b123a9ac376353670901731df9d GIT binary patch literal 6148 zcmeHKyG{c!5FA5_NHi%ZDE$LO;txy|3M4xC0JtOtQj|!bP+!Mq!|VgZ=|G~QK(o<$ z?DdYFo8tBsKv^8t7r+d_lx~Pu8^&h)<|8}GNFmaB#tv(2@Pr#YjVxpH~F02%veaWjf=YC7<1D(#e(~0^JFkNI);4c(-2M6jN AfdBvi literal 0 HcmV?d00001 diff --git a/components/cc-waterMark/Detail.vue b/components/cc-waterMark/Detail.vue new file mode 100644 index 0000000..e85a13c --- /dev/null +++ b/components/cc-waterMark/Detail.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/components/cc-waterMark/index.vue b/components/cc-waterMark/index.vue new file mode 100644 index 0000000..f169a6f --- /dev/null +++ b/components/cc-waterMark/index.vue @@ -0,0 +1,70 @@ + + + + + \ No newline at end of file diff --git a/components/cc-waterMark/waterMark.js b/components/cc-waterMark/waterMark.js new file mode 100644 index 0000000..202d4a9 --- /dev/null +++ b/components/cc-waterMark/waterMark.js @@ -0,0 +1,85 @@ +'use strict' + +const watermark = {} + +/** + * + * @param {要设置的水印的内容} str + * @param {需要设置水印的容器} container + */ +const setWatermark = (str, container, fillColor) => { + + // 唯一id + const id = '1.23452384164.123412415' + + // + if ((container === '') || (container === undefined)) { + // 如何不传值 默认以body作为水印底板 + container = document.body; + + } + + // 查看页面上有没有,如果有则删除 + if (document.getElementById(id) !== null) { + const childelement = document.getElementById(id) + childelement.parentNode.removeChild(childelement) + } + + var containerWidth = container.offsetWidth // 获取父容器宽 + var containerHeight = container.offsetHeight + 360 // 获取父容器高再加上一个固定高度 + container.style.position = 'relative' // 设置布局为相对布局 + + // 创建canvas元素(先制作一块背景图) + const can = document.createElement('canvas') + // 获取屏幕宽度的一半 + can.width = document.body.clientWidth / 2 // 设置每一块的宽度 + can.height = 240 // 高度 + const cans = can.getContext('2d') // 获取canvas画布 + cans.rotate(-20 * Math.PI / 180) // 逆时针旋转π/9 + cans.font = '14px Vedana' // 设置字体 + // 'rgba(200, 200, 200, 0.20)' + if (fillColor == undefined) { + + cans.fillStyle = '#4473FF' // 设置字体的颜色 + } else { + + cans.fillStyle = fillColor // 设置字体的颜色 + + } + + cans.textAlign = 'left' // 文本对齐方式 + cans.textBaseline = 'Middle' // 文本基线 + cans.fillText(str, 0, 4 * can.height / 5) // 绘制文字 + + // 创建一个div元素 + const div = document.createElement('div') + div.id = id // 设置id + div.style.pointerEvents = 'none' // 取消所有事件 + div.style.top = '0px' + div.style.left = '0px' + div.style.position = 'absolute' + div.style.zIndex = '100000' + div.style.width = containerWidth + 'px' + div.style.fontSize = '24px' + div.style.height = containerHeight + 'px' + div.style.background = 'url(' + can.toDataURL('image/png') + ') left top repeat' + container.appendChild(div) // 追加到页面 + + return id +} + +// 该方法只允许调用一次 +watermark.set = (str, container, fillColor) => { + let id = setWatermark(str, container, fillColor) + setInterval(() => { + if (document.getElementById(id) === null) { + id = setWatermark(str, container, fillColor) + } + }, 500) + // 监听页面大小的变化 + window.onresize = () => { + setWatermark(str, container) + } +} + +export default watermark \ No newline at end of file diff --git a/components/myTab/myTab.vue b/components/myTab/myTab.vue new file mode 100644 index 0000000..1eab540 --- /dev/null +++ b/components/myTab/myTab.vue @@ -0,0 +1,23 @@ + + + + + \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..b27f2e6 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "id": "cc-waterMark", + "name": "实现页面加水印文字 单个页面所有页面加水印 水印颜色", + "displayName": "实现页面加水印文字 单个页面所有页面加水印 水印颜色", + "version": "1.0", + "description": "实现页面加水印文字, 可以实现系统所有页面加水印,也可以单个页面加水印, 可更改水印颜色", + "keywords": [ + "水印", + "加水印", + "图片水印", + "水印文字", + "watermark" + ], + "dcloudext": { + "category": [ + "前端组件", + "通用组件" + ] + } +} \ No newline at end of file diff --git a/pages.json b/pages.json index c9cc932..edb58ac 100644 --- a/pages.json +++ b/pages.json @@ -20,12 +20,78 @@ "root": "pages/sub", "pages": [ { - "path": "machineList/machineList", - "style": { - "navigationBarTitleText": "机器列表", - "enablePullDownRefresh": true + "path": "machineList/machineList", + "style": { + "navigationBarTitleText": "机器列表", + "enablePullDownRefresh": true + } + }, + { + "path": "mechanicalMonitor/mechanicalMonitor", + "style": { + "navigationBarTitleText": "机器列表", + "enablePullDownRefresh": true + } + }, + { + "path": "mechanicalLog/mechanicalLog", + "style": { + "navigationBarTitleText": "机器日志", + "enablePullDownRefresh": true + } + }, + { + "path": "executionRecord/executionRecord", + "style": { + "navigationBarTitleText": "执行记录", + "enablePullDownRefresh": true + } + }, + { + "path": "logPanel/logPanel", + "style": { + "navigationBarTitleText": "日志面板", + "enablePullDownRefresh": true + } + }, + { + "path": "logPanel/addNewLog", + "style": { + "navigationBarTitleText": "新增日志", + "enablePullDownRefresh": true + } + }, + { + "path": "batchExecution/batchExecution", + "style": { + "navigationBarTitleText": "批量执行", + "enablePullDownRefresh": true + } + }, + { + "path": "batchExecution/selectMachine", + "style": { + "navigationBarTitleText": "选择机器", + "enablePullDownRefresh": true + } + }, + { + "path": "batchExecution/selectTemplate", + "style": { + "navigationBarTitleText": "选择模版", + "enablePullDownRefresh": true + } + }, + { + "path": "batchExecution/executionDetails", + "style": { + "navigationBarTitleText": "选择模版", + "enablePullDownRefresh": true + } } - } + + + ] }], "globalStyle": { diff --git a/pages/index/index.vue b/pages/index/index.vue index e9c3360..ef766e8 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -12,7 +12,7 @@ 执行管理 - + @@ -37,7 +37,7 @@ { text: '机器监控', icon: require('../../static/images/icon (7).png'), - url: '/pages/' + url: '/pages/sub/mechanicalMonitor/mechanicalMonitor' }, { text: '终端日志', @@ -52,24 +52,24 @@ { text: '机器日志', icon: require('../../static/images/icon (13).png'), - url: '/pages/' + url: '/pages/sub/mechanicalLog/mechanicalLog' }, ], list2: [ { text: '批量执行', icon: require('../../static/images/icon (15).png'), - url: '/pages/' + url: '/pages/sub/batchExecution/batchExecution' }, { text: '执行记录', icon: require('../../static/images/icon (24).png'), - url: '/pages/' + url: '/pages/sub/executionRecord/executionRecord' }, { text: '日志面板', icon: require('../../static/images/icon (16).png'), - url: '/pages/' + url: '/pages/sub/logPanel/logPanel' }, ] } diff --git a/pages/sub/batchExecution/batchExecution.vue b/pages/sub/batchExecution/batchExecution.vue new file mode 100644 index 0000000..826d930 --- /dev/null +++ b/pages/sub/batchExecution/batchExecution.vue @@ -0,0 +1,77 @@ + + + + + + + \ No newline at end of file diff --git a/pages/sub/batchExecution/executionDetails.vue b/pages/sub/batchExecution/executionDetails.vue new file mode 100644 index 0000000..ba9ebb1 --- /dev/null +++ b/pages/sub/batchExecution/executionDetails.vue @@ -0,0 +1,141 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/batchExecution/selectMachine.vue b/pages/sub/batchExecution/selectMachine.vue new file mode 100644 index 0000000..5534ef8 --- /dev/null +++ b/pages/sub/batchExecution/selectMachine.vue @@ -0,0 +1,78 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/batchExecution/selectTemplate.vue b/pages/sub/batchExecution/selectTemplate.vue new file mode 100644 index 0000000..bdb368d --- /dev/null +++ b/pages/sub/batchExecution/selectTemplate.vue @@ -0,0 +1,71 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/executionRecord/executionRecord.vue b/pages/sub/executionRecord/executionRecord.vue new file mode 100644 index 0000000..3c6cdd2 --- /dev/null +++ b/pages/sub/executionRecord/executionRecord.vue @@ -0,0 +1,152 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/logPanel/addNewLog.vue b/pages/sub/logPanel/addNewLog.vue new file mode 100644 index 0000000..e2b78ff --- /dev/null +++ b/pages/sub/logPanel/addNewLog.vue @@ -0,0 +1,87 @@ + + + + + + + \ No newline at end of file diff --git a/pages/sub/logPanel/logPanel.vue b/pages/sub/logPanel/logPanel.vue new file mode 100644 index 0000000..0c75dcb --- /dev/null +++ b/pages/sub/logPanel/logPanel.vue @@ -0,0 +1,162 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/machineList/machineList.vue b/pages/sub/machineList/machineList.vue index 4240703..42d27cf 100644 --- a/pages/sub/machineList/machineList.vue +++ b/pages/sub/machineList/machineList.vue @@ -4,11 +4,37 @@ - + + + + 共3条 + + + 名称 + 192.68.1.44主机 + + + 标识 + host + + + 机器主机 + host + + + 描述 + host + + + 状态 + + + + + host + + + @@ -17,8 +43,9 @@ export default { data() { return { - list1: [{ + tabList: [{ name: '全部', + id: 0 }, { name: '启用', }, { @@ -27,7 +54,7 @@ } }, methods: { - click(item) { + tabClick(item) { console.log('item', item); } } @@ -45,4 +72,49 @@ margin-top: 8rpx; padding: 16rpx 0; } + + .ul { + width: 100%; + padding: 0 30rpx 40rpx 30rpx; + .total { + height: 66rpx; + line-height: 66rpx; + font-size: 24rpx; + color: #999; + text-align: right; + } + + .card { + padding: 10rpx 28rpx; + .row { + align-items: center; + display: flex; + justify-content: space-between; + padding: 16rpx 0; + font-size: 26rpx; + color: #333; + .lab { + } + + .val { + &.blue { + color: $themC; + } + &.hui { + color: #999; + } + + } + .flex { + display: flex; + justify-content: flex-end; + .icon { + width: 28rpx; + height: 30rpx; + margin-right: 20rpx; + } + } + } + } + } \ No newline at end of file diff --git a/pages/sub/mechanicalLog/mechanicalLog.vue b/pages/sub/mechanicalLog/mechanicalLog.vue new file mode 100644 index 0000000..d996ec5 --- /dev/null +++ b/pages/sub/mechanicalLog/mechanicalLog.vue @@ -0,0 +1,123 @@ + + + + + \ No newline at end of file diff --git a/pages/sub/mechanicalMonitor/mechanicalMonitor.vue b/pages/sub/mechanicalMonitor/mechanicalMonitor.vue new file mode 100644 index 0000000..d367f88 --- /dev/null +++ b/pages/sub/mechanicalMonitor/mechanicalMonitor.vue @@ -0,0 +1,146 @@ + + + + + \ No newline at end of file