diff --git a/stock-forcast-web/router/index.js.bak b/stock-forcast-web/router/index.js.bak deleted file mode 100644 index 3fd8636..0000000 --- a/stock-forcast-web/router/index.js.bak +++ /dev/null @@ -1,135 +0,0 @@ - /* - 作者: moxianchengbao - 创建日期: 2023-9-03 - 版本: 1.0 -*/ - -import { createRouter, createWebHistory } from 'vue-router' -import request from '@/request/request' -const routes = [ - { - path: '/login', - name: '登陆', - component: ()=>import('@/views/login/index'), - }, - { - path: '/', - name: '仪表盘', - component: ()=>import('@/views/index'), - redirect: '/home', - children:[ - { - path: '/home', - name: '首页', - component: ()=>import('@/views/homeData/index'), - } - ] - }, - { - path: '/stockpredit', - name: '股价预测', - component: ()=>import('@/views/index'), - }, - { - path: '/factormining', - name: '因子挖掘', - component: ()=>import('@/views/index'), - }, - { - path: '/selectmodel', - name: '模型选择', - component: ()=>import('@/views/index'), - }, - { - path: '/mymodel', - name: '我的模型', - component: ()=>import('@/views/index'), - }, - { - path: '/sys', - name: '权限设置', - component: ()=>import('@/views/index'), - children:[ - { - path: '/auth', - name: '权限管理', - component: ()=>import('@/views/sys/auth/index'), - }, - { - path: '/role', - name: '角色管理', - component: ()=>import('@/views/sys/role/index'), - }, - { - path: '/mans', - name: '人员管理', - component: ()=>import('@/views/sys/mans/index'), - } - ], - }, - { - path: '/sett', - name: '系统设置', - component: ()=>import('@/views/index'), - children:[ - { - path: '/pwd', - name: '修改密码', - component: ()=>import('@/views/sys/updatePwd/index'), - }, - { - path: '/perPwd', - name: '个人密码', - component: ()=>import('@/views/sys/perPwd/index'), - } - ] - } -] - -const router = createRouter({ - history: createWebHistory(process.env.BASE_URL), - routes -}) - -router.beforeEach((to,from,next)=>{ - if(to.path!='/login'){ //需要登录 - let token = localStorage.getItem('token') - let logindto = {} - logindto.token=token - logindto.urlpath=to.path - if(token!=null){ //登录过 - //验证token - request.post("/user/checkToken",token).then(res=>{ - //成功 - if(res.statusCode == '200'){ - // next() - if(to.path=='/' || to.path=='/home'){ - next() - }else { - request.post("/user/checkURL",logindto).then(res=>{ - if(res.statusCode == '200'){ - next() - }else{ - next({path:'/login'}) - } - }) - } - - }else{ - next({path:'/login'}) - } - - }).catch(()=>{ - next({path:'/login'}) - }) - - }else{ //没有登录 - next({path:'/login'}) - } - - }else{ //不需要登录 - next() - } -}) - -export default router diff --git a/stock-forcast-web/src/main.js b/stock-forcast-web/src/main.js index db7b511..7adc328 100644 --- a/stock-forcast-web/src/main.js +++ b/stock-forcast-web/src/main.js @@ -6,7 +6,7 @@ import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import './assets/global.css' import * as ElIcons from '@element-plus/icons-vue' -import request from './request/request' +import request from './request/request' const app = createApp(App) for (const icname in ElIcons){ diff --git a/stock-forcast-web/src/main.js.bak b/stock-forcast-web/src/main.js.bak new file mode 100644 index 0000000..db7b511 --- /dev/null +++ b/stock-forcast-web/src/main.js.bak @@ -0,0 +1,19 @@ +import { createApp } from 'vue' +import App from './App.vue' +import router from './router' +import store from './store' +import ElementPlus from 'element-plus' +import 'element-plus/dist/index.css' +import './assets/global.css' +import * as ElIcons from '@element-plus/icons-vue' +import request from './request/request' + +const app = createApp(App) +for (const icname in ElIcons){ + app.component(icname,ElIcons[icname]) +} +app.config.globalProperties.$http = request +app.use(store) +app.use(router) +app.use(ElementPlus,{size: 'default'}) +app.mount('#app')