From 64dea73fa682305d7ef1fb0d39c62c992f75e855 Mon Sep 17 00:00:00 2001 From: lyt <1105290566@qq.com> Date: Fri, 2 Apr 2021 18:07:49 +0800 Subject: [PATCH] =?UTF-8?q?'admin-21.04.02:=E5=8E=BB=E6=8E=89=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E6=97=A0=E7=94=A8=E6=96=87=E4=BB=B6=E5=A4=B9=E3=80=81?= =?UTF-8?q?=E6=96=B0=E5=A2=9Eweb=E7=AB=AF=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E6=88=AA=E5=B1=8F=E6=BC=94=E7=A4=BA'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 1 + package.json | 1 + src/api/menu/index.ts | 2 +- src/components/notice/index.vue | 113 -------------------------- src/components/screenShort/index.vue | 48 +++++++++++ src/i18n/lang/en.ts | 1 + src/i18n/lang/zh-cn.ts | 1 + src/i18n/lang/zh-tw.ts | 1 + src/main.ts | 3 +- src/router/index.ts | 15 ++++ src/theme/other.scss | 12 +++ src/views/fun/screenShort/index.vue | 41 ++++++++++ src/views/layout/lockScreen/index.vue | 2 +- 13 files changed, 125 insertions(+), 116 deletions(-) delete mode 100644 src/components/notice/index.vue create mode 100644 src/components/screenShort/index.vue create mode 100644 src/views/fun/screenShort/index.vue diff --git a/README.md b/README.md index 7d1e290..a34a598 100644 --- a/README.md +++ b/README.md @@ -118,6 +118,7 @@ cnpm run build - @antv/g6 - qrcodejs - print-js +- vue-web-screen-shot #### 特别感谢 diff --git a/package.json b/package.json index c52a136..f11f3c3 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "vue": "^3.0.5", "vue-i18n": "^9.0.0", "vue-router": "^4.0.2", + "vue-web-screen-shot": "^1.1.8", "vuex": "^4.0.0-rc.2", "wangeditor": "^4.6.12" }, diff --git a/src/api/menu/index.ts b/src/api/menu/index.ts index 178ff8f..a10a070 100644 --- a/src/api/menu/index.ts +++ b/src/api/menu/index.ts @@ -1,7 +1,7 @@ import request from '/@/utils/request.ts'; /** - * 后端控制菜单模拟json,路径在 https://gitee.com/lyt-top/vue-next-admin-images/raw/master/menu/menu + * 后端控制菜单模拟json,路径在 https://gitee.com/lyt-top/vue-next-admin-images/tree/master/menu * 后端控制路由,isRequestRoutes 为 true,则开启后端控制路由 */ // 获取后端动态路由菜单(admin) diff --git a/src/components/notice/index.vue b/src/components/notice/index.vue deleted file mode 100644 index bfff859..0000000 --- a/src/components/notice/index.vue +++ /dev/null @@ -1,113 +0,0 @@ - - - - - diff --git a/src/components/screenShort/index.vue b/src/components/screenShort/index.vue new file mode 100644 index 0000000..18cff47 --- /dev/null +++ b/src/components/screenShort/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/src/i18n/lang/en.ts b/src/i18n/lang/en.ts index 428d5d8..8e2702a 100644 --- a/src/i18n/lang/en.ts +++ b/src/i18n/lang/en.ts @@ -31,6 +31,7 @@ export default { funEchartsMap: 'EchartsMap', funPrintJs: 'PrintJs', funClipboard: 'Copy cut', + funScreenShort: 'screenCapture', pagesIndex: 'pages', pagesFiltering: 'Filtering', pagesFilteringDetails: 'FilteringDetails', diff --git a/src/i18n/lang/zh-cn.ts b/src/i18n/lang/zh-cn.ts index e39c648..43f040e 100644 --- a/src/i18n/lang/zh-cn.ts +++ b/src/i18n/lang/zh-cn.ts @@ -31,6 +31,7 @@ export default { funEchartsMap: '地理坐标/地图', funPrintJs: '页面打印', funClipboard: '复制剪切', + funScreenShort: 'web端自定义截屏', pagesIndex: '页面', pagesFiltering: '过滤筛选组件', pagesFilteringDetails: '过滤筛选组件详情', diff --git a/src/i18n/lang/zh-tw.ts b/src/i18n/lang/zh-tw.ts index 0f1f7a6..e0f142b 100644 --- a/src/i18n/lang/zh-tw.ts +++ b/src/i18n/lang/zh-tw.ts @@ -31,6 +31,7 @@ export default { funEchartsMap: '地理座標/地圖', funPrintJs: '頁面列印', funClipboard: '複製剪切', + funScreenShort: '自定義截圖', pagesIndex: '頁面', pagesFiltering: '過濾篩選組件', pagesFilteringDetails: '過濾篩選組件詳情', diff --git a/src/main.ts b/src/main.ts index 5b0dee8..f01e1da 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,9 +9,10 @@ import ElementPlus from 'element-plus'; import 'element-plus/lib/theme-chalk/index.css'; import '/@/theme/index.scss'; import mitt from 'mitt'; +import screenShort from 'vue-web-screen-shot'; const app = createApp(App); -app.use(router).use(store, key).use(ElementPlus, { i18n: i18n.global.t }).use(i18n).mount('#app'); +app.use(router).use(store, key).use(ElementPlus, { i18n: i18n.global.t }).use(i18n).use(screenShort, { enableWebRtc: false }).mount('#app'); app.config.globalProperties.mittBus = mitt(); authDirective(app); diff --git a/src/router/index.ts b/src/router/index.ts index b2c435e..d4bd539 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -484,6 +484,21 @@ export const dynamicRoutes = [ icon: 'el-icon-document-copy', }, }, + { + path: '/fun/screenShort', + name: 'funScreenShort', + component: () => import('/@/views/fun/screenShort/index.vue'), + meta: { + title: 'message.router.funScreenShort', + isLink: '', + isHide: false, + isKeepAlive: true, + isAffix: false, + isIframe: false, + auth: ['admin', 'test'], + icon: 'el-icon-crop', + }, + }, ], }, { diff --git a/src/theme/other.scss b/src/theme/other.scss index 3077819..9e8e950 100644 --- a/src/theme/other.scss +++ b/src/theme/other.scss @@ -14,3 +14,15 @@ border-bottom-right-radius: 3px; z-index: 1 !important; } + +/* web端自定义截屏 +------------------------------- */ +#screenShotContainer { + z-index: 9998 !important; +} +#toolPanel { + height: 42px !important; +} +#optionPanel { + height: 37px !important; +} diff --git a/src/views/fun/screenShort/index.vue b/src/views/fun/screenShort/index.vue new file mode 100644 index 0000000..2306dc0 --- /dev/null +++ b/src/views/fun/screenShort/index.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/views/layout/lockScreen/index.vue b/src/views/layout/lockScreen/index.vue index 3e42878..5009a6f 100644 --- a/src/views/layout/lockScreen/index.vue +++ b/src/views/layout/lockScreen/index.vue @@ -100,7 +100,7 @@ export default { el.setAttribute('style', `top:${-el.clientHeight}px;cursor:pointer;transition:all 0.3s ease;`); state.moveDifference = -el.clientHeight; setTimeout(() => { - el.remove(); + el && el.parentNode?.removeChild(el); }, 300); } if (state.moveDifference === -el.clientHeight) {