管理员页面新增i查看调查问卷信息

This commit is contained in:
X1627315083
2024-07-29 17:30:24 +08:00
parent a9f9fd26ec
commit 509f91ed6c
9 changed files with 2492 additions and 1918 deletions

View File

@@ -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<RouteRecordRaw> = [
{
path: "/",
// redirect重定向
// redirect: "/login"
redirect: "/Square"
// redirect: "/upgrade"
name: "HomeRecommend",
component: _import('HomeRecommend'),
},
{
path: '/login',
@@ -39,18 +38,16 @@ const routes: Array<RouteRecordRaw> = [
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<RouteRecordRaw> = [
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<RouteRecordRaw> = [
name: 'administrator',
component: _import('Administrator'),
children:[
{
path: "",
name:'adminChil',
redirect: "/administrator/allUser"
},
{
path:'allUser',
name:'allUser',
@@ -100,6 +136,10 @@ const routes: Array<RouteRecordRaw> = [
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{