From a9f9fd26ec4cc3c6fd7593e2f8efe1222caec658 Mon Sep 17 00:00:00 2001 From: X1627315083 <1627315083@qq.com> Date: Fri, 26 Jul 2024 16:22:41 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/component/Detail/habit.vue | 4 ++++ src/component/Login/registerModel.vue | 2 +- src/views/feedbackSurveyCN.vue | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/component/Detail/habit.vue b/src/component/Detail/habit.vue index 2840c04c..1782b138 100644 --- a/src/component/Detail/habit.vue +++ b/src/component/Detail/habit.vue @@ -1159,6 +1159,10 @@ export default defineComponent({ align-items: center; justify-content: space-between; font-size: calc(1.4rem*1.2); + > .anticon + span{ + max-width: 80%; + overflow: hidden; + } } diff --git a/src/router/index.ts b/src/router/index.ts index b4e238d5..ad08b5f6 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -2,18 +2,17 @@ import { createRouter, createWebHistory, RouteRecordRaw, createWebHashHistory } import { defineAsyncComponent } from 'vue' import store from "@/store" import { getCookie, setCookie } from "@/tool/cookie"; -const _import = (path: string) => defineAsyncComponent(() => import(`../views/${path}.vue`)); -const _import_component = (path : string) => defineAsyncComponent(() => import(`../component/${path}`)); -const _import_custom = (path : string) => defineAsyncComponent(() => import(`../views/${path}`)); - +const _import = (path: string) => () => import(`../views/${path}.vue`); +const _import_component = (path : string) => () => import(`../component/${path}`); +const _import_custom = (path : string) => () => import(`../views/${path}`); +// defineAsyncComponent(import(`../views/${path}.vue`)) const routes: Array = [ { path: "/", // redirect重定向 - // redirect: "/login" + redirect: "/Square" // redirect: "/upgrade" - name: "HomeRecommend", - component: _import('HomeRecommend'), + }, { path: '/login', @@ -39,18 +38,16 @@ const routes: Array = [ path: '/home', name: 'home', component: _import('HomeMain'), - meta:{keepAlive:true}, children:[ { path: "", - name:'""', - redirect: "home/homePage" + name:'HomeChil', + redirect: "/home/homePage" }, { path:'homePage', name:'homePage', component: _import_custom('HomeView/HomeView.vue'), - meta:{keepAlive:true}, },{ path:'library', name:'library', @@ -63,7 +60,41 @@ const routes: Array = [ path:'works', name:'works', component: _import_custom('HomeView/Works.vue'), + },{ + path:'events', + name:'events', + component: _import_custom('HomeView/Events.vue'), + },{ + path:'eventsDetail', + name:'eventsDetail', + component: _import_component('Events/eventsDetail.vue'), + } + ] + }, + { + path: '/Square', + name: "HomeRecommend", + component: _import('HomeRecommend'), + children:[ + { + path: "", + name:'SquareChil', + redirect: "/Square/works" }, + { + path:'works', + name:'SquareWorks', + component: _import_custom('HomeView/Works.vue'), + },{ + path:'events', + name:'SquareEvents', + component: _import_custom('HomeView/Events.vue'), + + },{ + path:'eventsDetail', + name:'SquareEventsDetail', + component: _import_component('Events/eventsDetail.vue'), + } ] }, { @@ -86,6 +117,11 @@ const routes: Array = [ name: 'administrator', component: _import('Administrator'), children:[ + { + path: "", + name:'adminChil', + redirect: "/administrator/allUser" + }, { path:'allUser', name:'allUser', @@ -100,6 +136,10 @@ const routes: Array = [ path:'trialApproval', name:'trialApproval', component: _import_component('Administrator/trialApproval.vue'), + },{ + path:'questionnaire', + name:'questionnaire', + component: _import_component('Administrator/questionnaire.vue'), }, ] }, @@ -183,7 +223,9 @@ router.beforeEach((to, from, next) => { let isMurmur = JSON.parse(getIsMurmur) let routeList = ['/testClickData','/trialApproval']//指定页面需要指定id才能进入 let userIdList = [88,6,46,31,73,83,87,4] - let isSystemUserRouteList = ['/login','/']//指定页面 + let isSystemUserRouteList = ['/login','/Square']//游客用户只能进入这两个页面 + let upgradeList = ['/feedbackSurvey','/feedbackSurveyCN']//指定页面系统维护也可以访问 + let systemUser = state.UserHabit.systemUser const routeExists = router.getRoutes().some(({ name }) =>{ @@ -193,25 +235,35 @@ router.beforeEach((to, from, next) => { return false } }); - if(systemUser.value == 0){ - if(isSystemUserRouteList.indexOf(to.path) > -1){ + if(upgradeList.indexOf(to.path) > -1){//指定页面任何用户都可以进入 + next(); + return + } + if(systemUser.value == 0){//游客用户只能进入这两个页面 + let sSystemUser = false + for (let index = 0; index < isSystemUserRouteList.length; index++) { + if(to.path.indexOf(isSystemUserRouteList[index]) > -1){ + sSystemUser = true + break + } + } + if(sSystemUser){ next(); }else{ - next('/'); + next('/Square'); } return } - if (routeExists) { + if (routeExists) {//检测档期那页面是否存在 if (isMurmur && murmurStr && token) { const toName = to.name === 'login'; if (toName) { - next({ name: '/homePage' }); + next({ name: '/home' });//机房用户 } else { next(); } } else { - if (routeList.indexOf(to.path) > -1 ) { - + if (routeList.indexOf(to.path) > -1 ) {//指定也买你必须指定用户可以进入 if(userIdList.indexOf(userInfo.userId) > -1){ next(); }else{ diff --git a/src/tool/https.js b/src/tool/https.js index d3f44d3e..574e6c99 100644 --- a/src/tool/https.js +++ b/src/tool/https.js @@ -90,7 +90,17 @@ axios.interceptors.response.use((res) =>{ if(error?.response?.status === 401 && router.currentRoute._value.name != 'setIdentification'){//如果是记录浏览器页面就不跳转login if(!isLoginTime){ isLoginTime = true - router.replace('/') + let isSystemUserRouteList = ['/Square']//如果是这两个页面就无需跳转未登录页 + let sSystemUser = false + for (let index = 0; index < isSystemUserRouteList.length; index++) { + if(router.currentRoute.value.path.indexOf(isSystemUserRouteList[index]) > -1){ + sSystemUser = true + break + } + } + if(!sSystemUser){ + router.replace('/') + } message.warning('Please login and try again~') clonAllCookie() store.commit('clearSystemUser') @@ -223,10 +233,13 @@ export const Https = { trialOrderApproval:`/api/account/trialOrderApproval`,//通过审批 trialOrderRefuse:`/api/account/trialOrderRefuse`,//拒绝审批 + //管理员接口 //查询所有试用用户 inquiryGetTrial:`/api/inquiry/getTrial`,//拒绝审批 //查询某个时间内design点击次数 getDesignStatistic:`/api/inquiry/getDesignStatistic`,//拒绝审批 + getAllQuestionnaire:`/api/inquiry/getAllQuestionnaire`,//拒绝审批 + getTasksList:`/api/tasks/getList`,//获取w为执行完的所有任务 getTasksHistory:`/api/tasks/getAllTask`,//获取所有任务列表 @@ -262,6 +275,8 @@ export const Https = { exportSave:`/api/history/exportSave`,//保存画布 exportSearch:`/api/history/exportSearch`,//保存画布 + //活动 + activity:`/api/account/activity`, //调查问卷 diff --git a/src/views/Administrator.vue b/src/views/Administrator.vue index b4064d6b..6b17a177 100644 --- a/src/views/Administrator.vue +++ b/src/views/Administrator.vue @@ -1,6 +1,12 @@