123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- import { createRouter, createWebHistory } from 'vue-router';
- import store from '@/stores/counter';
- import axios from 'axios';
- const system = [
- {
- path: '/system/menus',
- name: 'menus',
- meta: { title: '吉林省重点领域技术转移平台-菜单管理' },
- component: () => import('@/views/system/menus/index.vue')
- },
- {
- path: '/system/config',
- name: 'config',
- meta: { title: '吉林省重点领域技术转移平台-基础设置' },
- component: () => import('@/views/system/config/index.vue')
- },
- {
- path: '/system/role',
- name: 'role',
- meta: { title: '吉林省重点领域技术转移平台-角色管理' },
- component: () => import('@/views/system/role/index.vue')
- },
- {
- path: '/system/dict',
- meta: { title: '字典管理' },
- component: () => import('@/views/system/dict/index.vue')
- },
- {
- path: '/system/dictData',
- meta: { title: '字典数据管理' },
- component: () => import('@/views/system/dictData/index.vue')
- },
- {
- path: '/acccount/updatepd',
- meta: { title: '修改密码' },
- component: () => import('@/views/acccount/updatepd/index.vue')
- }
- ];
- const user = [
- {
- path: '/user/admin',
- meta: { title: '管理员管理' },
- component: () => import('@/views/user/admin/index.vue')
- },
- {
- path: '/user/research',
- meta: { title: '科研单位管理' },
- component: () => import('@/views/user/research/index.vue')
- },
- {
- path: '/user/unit',
- meta: { title: '企业管理' },
- component: () => import('@/views/user/unit/index.vue')
- },
- {
- path: '/user/selfUser',
- meta: { title: '个人用户管理' },
- component: () => import('@/views/user/selfUser/index.vue')
- }
- ];
- const core = [
- {
- path: '/core/achieve/admin',
- meta: { title: '管理员-成果管理' },
- component: () => import('@/views/core/achieve/admin.vue')
- },
- {
- path: '/core/achieve',
- meta: { title: '成果管理' },
- component: () => import('@/views/core/achieve/index.vue')
- },
- {
- path: '/core/demand/admin',
- meta: { title: '管理员-需求管理' },
- component: () => import('@/views/core/demand/admin.vue')
- },
- {
- path: '/core/demand',
- meta: { title: '需求管理' },
- component: () => import('@/views/core/demand/index.vue')
- },
- {
- path: '/core/service/admin',
- meta: { title: '管理员-服务管理' },
- component: () => import('@/views/core/service/admin.vue')
- },
- {
- path: '/core/service',
- meta: { title: '服务管理' },
- component: () => import('@/views/core/service/index.vue')
- }
- ];
- const trade = [
- {
- path: '/core/trade/negotiate/admin',
- meta: { title: '管理员-协商定价管理' },
- component: () => import('@/views/core/trade/negotiate/admin.vue')
- },
- {
- path: '/core/trade/negotiate',
- meta: { title: '协商定价管理' },
- component: () => import('@/views/core/trade/negotiate/index.vue')
- },
- {
- path: '/core/trade/listing/admin',
- meta: { title: '管理员-挂牌交易管理' },
- component: () => import('@/views/core/trade/listing/admin.vue')
- },
- {
- path: '/core/trade/listing',
- meta: { title: '挂牌交易管理' },
- component: () => import('@/views/core/trade/listing/index.vue')
- },
- {
- path: '/core/trade/auction/admin',
- meta: { title: '管理员-拍卖管理' },
- component: () => import('@/views/core/trade/auction/admin.vue')
- },
- {
- path: '/core/trade/auction/test',
- meta: { title: '管理员-拍卖管理' },
- component: () => import('@/views/core/trade/auction/makeListing.vue')
- }
- ];
- const service = [
- {
- path: '/service/linkItem',
- meta: { title: '管理员-办事事项管理' },
- component: () => import('@/views/service/linkItem/index.vue')
- },
- {
- path: '/service/notice',
- meta: { title: '管理员-通知公告管理' },
- component: () => import('@/views/service/notice/index.vue')
- },
- {
- path: '/service/policy',
- meta: { title: '管理员-政策法规管理' },
- component: () => import('@/views/service/policy/index.vue')
- },
- {
- path: '/service/trends',
- meta: { title: '管理员-行业动态管理' },
- component: () => import('@/views/service/trends/index.vue')
- },
- {
- path: '/service/video/admin',
- meta: { title: '管理员-点播视频管理' },
- component: () => import('@/views/service/video/admin.vue')
- }
- ];
- const router = createRouter({
- history: createWebHistory(import.meta.env.BASE_URL),
- routes: [
- {
- path: '/',
- redirect: '/login'
- },
- {
- path: '/login',
- name: 'login',
- meta: { title: '吉林省重点领域技术转移平台-账号登录' },
- component: () => import('@/views/login/index.vue')
- },
- {
- path: '/homeIndex',
- meta: { title: '吉林省重点领域技术转移平台-系统首页' },
- component: () => import('@/components/admin-frame/home.vue'),
- children: [
- ...system,
- ...user,
- ...core,
- ...trade,
- ...service,
- {
- path: '/homeIndex',
- meta: { title: '吉林省重点领域技术转移平台-系统首页' },
- component: () => import('@/views/home/index.vue')
- }
- ]
- }
- ]
- });
- router.beforeEach(async (to, from, next) => {
- document.title = `${to.meta.title} `;
- const token = localStorage.getItem('token');
- if (to.name != 'login') {
- if (token) {
- const res = await axios.request({
- method: 'get',
- url: `${import.meta.env.VITE_REQUEST_BASE}/token/tokenView`,
- responseType: 'json',
- headers: {
- token: token
- }
- });
- if (res.data.errcode == '0') {
- console.log(res.data.data);
- store.commit('setUser', res.data.data, { root: true });
- }
- next();
- } else next('/login');
- } else next();
- });
- export default router;
|