From c2f95b0b9090a2394b5b068582b932a5e57b86aa Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期二, 05 九月 2023 18:19:37 +0800 Subject: [PATCH] 雷达图 新增综合风险排名 数据接入配置 --- src/main.ts | 34 ++++++++++++++++++++++++++++------ 1 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index 3cdc444..b6f4335 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,8 +1,6 @@ -// import './assets/main.css' - import { createApp } from 'vue' -import { createPinia } from 'pinia' - +// import { createPinia } from 'pinia' +import Cookie from 'js-cookie' import App from './App.vue' import router from './router' @@ -14,10 +12,34 @@ const app = createApp(App) -axios.defaults.baseURL = 'http://192.168.1.4:8081' + +// function SecretPiniaPlugin() { +// return { secret: 'the cake is a lie',vue:'333.0' } +// } + +// const pinia = createPinia() +// // 灏嗘彃浠舵彁渚涚粰 pinia +// pinia.use(SecretPiniaPlugin) + // pinia.use(() => ({'澶�':'闆ㄥぉ'})) + +router.beforeEach((to,from,next)=>{ + const token = Cookie.get('token') + if(!token && to.name!='login'){ + next({name:'login'}) + } + // token瀛樺湪锛屼絾鐢ㄦ埛鍒囨崲鐨勬槸鐧诲綍椤甸潰鏃讹紝杩斿洖榛樿涓荤晫闈� + else if(token && to.name =='login'){ + next({name:'edata'}) + }else{ + next() + } +}) + +// axios.defaults.baseURL = 'http://192.168.1.4:8081' +axios.defaults.baseURL = 'http://localhost:8081' app.config.globalProperties.$http = axios -app.use(createPinia()) +// app.use(pinia) app.use(router) -- Gitblit v1.9.3