From ec0b4880049d9d898f0cad21497cb8e3d4e2883d Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Tue, 5 Mar 2024 10:33:29 +0800 Subject: [PATCH] fix --- src/router/index.ts | 53 +++- src/tool/flexible.js | 4 + src/views/TestClickData.vue | 563 ++++++++++++++++++++++++++++++++++++ 3 files changed, 604 insertions(+), 16 deletions(-) create mode 100644 src/views/TestClickData.vue diff --git a/src/router/index.ts b/src/router/index.ts index 1a8b1b1f..f88c546c 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -36,6 +36,11 @@ const routes: Array = [ name: 'history', component: _import('HistoryPage') }, + { + path: '/testClickData', + name: 'testClickData', + component: _import('TestClickData') + }, // {//老版本history // path: '/oldHistory', // name: 'oldHistory', @@ -83,11 +88,16 @@ router.beforeEach((to, from, next) => { // } // 检查路由是否存在 // 机房用户 + let userInfo = JSON.parse(getCookie("userInfo") as any); + console.log(userInfo); + + let murmurStr: any = localStorage.getItem('murmurStr') let getIsMurmur: any = getCookie("isMurmur") let token = getCookie("token"); let isMurmur = JSON.parse(getIsMurmur) - + let routeList = ['/testClickData'] + let userIdList = [83] const routeExists = router.getRoutes().some(({ name }) =>{ if(name){ return name === to.name @@ -95,22 +105,33 @@ router.beforeEach((to, from, next) => { return false } }); - if (routeExists) { - if (isMurmur && murmurStr && token) { - const toName = to.name === 'login'; - if (toName) { - next({ name: 'home' }); - } else { next(); - } - } else { - // 如果页面存在,正常跳转 - next(); - } - } else { - // 如果页面不存在,可以跳转到404页面或者其他页面 - next('/404'); - } + + // if (routeExists) { + // if (isMurmur && murmurStr && token) { + // const toName = to.name === 'login'; + // if (toName) { + // next({ name: 'home' }); + // } else { + // next(); + // } + // } else { + // if (routeList.indexOf(to.path) > -1 ) { + + // if(userIdList.indexOf(userInfo.userId) > -1){ + // next(); + // }else{ + // next({ name: 'home' }); + // } + // }else{ + // next(); + // } + // // 如果页面存在,正常跳转 + // } + // } else { + // // 如果页面不存在,可以跳转到404页面或者其他页面 + // next('/404'); + // } }); diff --git a/src/tool/flexible.js b/src/tool/flexible.js index 39d359c1..53e32331 100644 --- a/src/tool/flexible.js +++ b/src/tool/flexible.js @@ -4,17 +4,21 @@ let flexible = (designWidth, maxWidth,minWidth) =>{ maxWidth = maxWidth || 2560; minWidth = minWidth || 1024; function refreshRem() { + console.log(1); var width = docEl.getBoundingClientRect().width; maxWidth = maxWidth || 1920; width > maxWidth && (width = maxWidth); width > maxWidth && (width = maxWidth); width < minWidth && (width = minWidth); var rem = width * 10 / designWidth; + console.log(2); remStyle.innerHTML = 'html{font-size:' + rem + 'px;}'; } if (docEl.firstElementChild) { + console.log(22); docEl.firstElementChild.appendChild(remStyle); } else { + console.log(33); var wrap = doc.createElement("div"); wrap.appendChild(remStyle); doc.write(wrap.innerHTML); diff --git a/src/views/TestClickData.vue b/src/views/TestClickData.vue new file mode 100644 index 00000000..31f6f88e --- /dev/null +++ b/src/views/TestClickData.vue @@ -0,0 +1,563 @@ + + + \ No newline at end of file