From 1cc515f4908c56e8af7a0d0b6833d49a6c935212 Mon Sep 17 00:00:00 2001 From: wangqing Date: Thu, 4 Mar 2021 17:46:07 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E9=A1=B5=E6=A0=B7=E5=BC=8F=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- src/utils/index.js | 29 +++++++++++++++++++++++++++++ src/views/home/index.vue | 28 ++++++++++++++++------------ src/views/official/index.vue | 18 ++++++++++++++---- src/views/official/introduction.vue | 14 +++++++++----- 5 files changed, 69 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index 77bb67b..df2bf4b 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ https://www.ydyno.com/archives/1219.html - 感谢 (https://gitee.com/eoner/vue-automation) 前端脚手架 -- 感谢 (https://gitee.com/TDuckApp/form-generator) 表单生成器 +- 感谢 (https://gitee.com/mrhj/form-generator) 表单生成器 diff --git a/src/utils/index.js b/src/utils/index.js index 0182b49..d41acef 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -241,3 +241,32 @@ export function timeFormat(ms) function addZero(n) { return n < 10 ? '0' + n : n } + +/** + * 判断是否是Url + * @param str + * @returns {boolean} + */ +export function checkIsUrl(str) { + let oRegUrl = new RegExp() + //aa.bb.com + oRegUrl.compile('^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$') + if (!oRegUrl.test(str)) { + return false + } + return true +} + +/** + * 打开 + * @param url + */ +export function openUrl(url) { + var a = document.createElement('a') + a.setAttribute('href', url) + a.setAttribute('target', '_blank') + a.setAttribute('id', 'd2admin-link-temp') + document.body.appendChild(a) + a.click() + document.body.removeChild(document.getElementById('d2admin-link-temp')) +} diff --git a/src/views/home/index.vue b/src/views/home/index.vue index de7671a..3f1bcab 100644 --- a/src/views/home/index.vue +++ b/src/views/home/index.vue @@ -9,11 +9,15 @@ > - - {{ item.title }} @@ -81,6 +85,7 @@ import store from '@/store/index.js' import FontIcon from '@/components/FontIcon' import router from '@/router' +import {openUrl, checkIsUrl} from '@/utils/index' export default { name: 'Home', @@ -90,15 +95,15 @@ export default { menuIndex: null, menuRouters: [ { - routerPath: '/proposal', + routerPath: 'https://gitee.com/TDuckApp/tduck-platform?time=1', title: '免费模板' }, { - routerPath: '/sources', + routerPath: 'https://gitee.com/TDuckApp/tduck-platform', title: '开源项目' }, { - routerPath: '/enterprise', + routerPath: 'https://gitee.com/TDuckApp/tduck-platform/issues', title: '提出建议' } ] @@ -113,17 +118,16 @@ export default { return user } }, - watch: { - $route(to) { - this.menuIndex = to.path - } - }, mounted() { this.menuIndex = this.$route.path }, methods: { activeMenuHandle(routerPath) { - this.menuIndex = routerPath + if (checkIsUrl(routerPath)) { + openUrl(routerPath) + } else { + this.menuIndex = routerPath + } }, logoutHandle() { this.$confirm('您确定要退出登录吗?', '退出确认', { diff --git a/src/views/official/index.vue b/src/views/official/index.vue index 12b3d07..8aac1a2 100644 --- a/src/views/official/index.vue +++ b/src/views/official/index.vue @@ -12,8 +12,9 @@ diff --git a/src/views/official/introduction.vue b/src/views/official/introduction.vue index 1b88515..f282042 100644 --- a/src/views/official/introduction.vue +++ b/src/views/official/introduction.vue @@ -80,7 +80,6 @@ - > @@ -237,7 +238,7 @@ export default { border: 1px solid rgba(255, 255, 255, 100); } .introduction-footer { - height: 350px; + height: 370px; line-height: 20px; background-color: rgba(32, 91, 181, 100); text-align: center; @@ -254,4 +255,7 @@ export default { font-size: 14px; text-align: left; } +.copyright { + height: 35px; +}