diff --git a/dist.zip b/dist.zip index ea153e5..4079f66 100644 Binary files a/dist.zip and b/dist.zip differ diff --git a/src/router/index.js b/src/router/index.js index 225ee03..d61ca47 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -7,6 +7,8 @@ import {getStore, setStore} from "../assets/js/storage"; import {createRoute, isTokenExpired} from "../assets/js/utils"; import config from "../config/config"; import {refreshAccessToken} from "../api/common/common"; +import dataV from "@/views/datav/dataV"; +import copyV from "@/views/datav/copyV"; let HOME_PAGE = config.HOME_PAGE; const currentOrganization = getStore('currentOrganization', true); @@ -21,9 +23,32 @@ const routes = [].concat( // const router = new Router({ // routes: routers // }); +function checkPropertyValue(obj, targetValue) { + // 检查当前对象是否是目标值 + if (obj === targetValue) { + return true; + } + + // 检查当前对象是否为对象类型 + if (typeof obj === 'object') { + // 遍历对象的所有属性 + for (let key in obj) { + // 递归调用检查属性值 + if (checkPropertyValue(obj[key], targetValue)) { + return true; + } + } + } + + // 如果没有找到目标值,则返回 false + return false; + } + const menu = getStore('menu', true); if (menu) { menu.forEach(function (v) { + if(checkPropertyValue(v, 'datasv'))return; + if(checkPropertyValue(v, 'copysv'))return; routes.push(createRoute(v)); if (v.children) { v.children.forEach(function (v2) { @@ -48,14 +73,12 @@ const router = new Router({ { name: 'datasv', path: '/datasv', - component: resolve => require(['@/views/datav/dataV'], resolve), - meta: {model: 'error'}, + component: dataV }, { name: 'copysv', path: '/copysv', - component: resolve => require(['@/views/datav/copyV'], resolve), - meta: {model: 'error'}, + component: copyV }, // { // name: 'login', @@ -148,6 +171,7 @@ router.beforeEach((to, from, next) => { } if (to.name === 'datasv' || to.path === '/datasv' || to.name === 'copysv' || to.path === '/copysv') { + console.log('跳转', to); next(); return false; } diff --git a/src/views/datav/dataV.vue b/src/views/datav/dataV.vue index 88fc137..43f561d 100644 --- a/src/views/datav/dataV.vue +++ b/src/views/datav/dataV.vue @@ -175,7 +175,7 @@ export default { }; - diff --git a/src/views/index.vue b/src/views/index.vue index a508e2d..c19b44c 100644 --- a/src/views/index.vue +++ b/src/views/index.vue @@ -327,33 +327,35 @@ menuModelClick(event) { //点击顶部导航跳转页面 console.log('event', event); - if(event.key==179){ // 跳转大屏 - return this.$router.push('/datasv'); - } - if(event.key==181){ // 跳转大屏 - return this.$router.push('/copysv'); - } + // if(event.key==175){ // 跳转大屏 + // return this.$router.push('/datasv'); + // } + // if(event.key==180){ // 跳转大屏 + // return this.$router.push('/copysv'); + // } let that = this; - that.menu.forEach(function (v, k) { - if (v.id == event.key) { - that.menus = v.children; - let turnPath = '/'; - if (!v.children) { - turnPath += v.fullUrl; - } else if (!v.children[0].children) { - turnPath += v.children[0].fullUrl; - } else { - turnPath += v.children[0].children[0].fullUrl; - } - if (turnPath == '/home') { - that.toHome(); - return false; - } - if (turnPath != '/#') { - that.$router.push(turnPath); - } - } - }); + that.menus = that.menu.find(v=>v.id == event.key).children; + let turnPath = '/'; + if (!that.menus) { + turnPath += v.fullUrl; + } else if (!that.menus[0].children) { + turnPath += that.menus[0].fullUrl; + } else { + turnPath += that.menus[0].children[0].fullUrl; + } + if(turnPath.includes('datasv')){ + return that.$router.push('/datasv'); + } + if(turnPath.includes('copysv')){ + return that.$router.push('/copysv'); + } + if (turnPath == '/home') { + that.toHome(); + return false; + } + if (turnPath != '/#') { + that.$router.push(turnPath); + } }, onModelOpenChange(openKeys) { },