b95b5bf4 by renchao@pashanhoo.com

style:cas完成

1 parent 5770ee1d
{
"TITLE": "不动产登记系统",
"SERVERAPI": "/bdcdj"
"SERVERAPI": "/dj"
}
\ No newline at end of file
......
/*
* @Description:
* @Autor: renchao
* @LastEditTime: 2023-05-06 09:14:47
* @LastEditTime: 2023-05-30 15:28:52
*/
import Vue from 'vue'
import App from './App'
......@@ -60,7 +60,7 @@ Object.keys(filters).forEach(key => {
})
Vue.config.productionTip = false
axios.get("/bdcdj/config.json")
axios.get("/config.json")
.then((res) => {
Vue.prototype.BASE_API = res.data
localStorage.setItem('ApiUrl', JSON.stringify(res.data));
......
/*
* @Description: 项目权限
* @Autor: renchao
* @LastEditTime: 2023-05-26 17:17:34
* @LastEditTime: 2023-05-30 16:27:26
*/
import Vue from 'vue'
import router from './router'
......@@ -16,8 +16,13 @@ import Cookies from 'js-cookie'
NProgress.configure({ showSpinner: false }) // NProgress Configuration
router.beforeEach(async (to, from, next) => {
Vue.prototype.$currentRoute = to
NProgress.start()
document.title = getPageTitle(to.meta.title)
let hasAddDict = store.state.dict.addDict
let hasAddRoute = store.state.permission.addRoutes
// cas操作
const token = localStorage.getItem("token")
debugger
if (to.path === '/login') {
if (token) {
next('/')
......@@ -36,9 +41,30 @@ router.beforeEach(async (to, from, next) => {
'ticket': ticket,
'service': locationUrl
}
}).then((res) => {
localStorage.setItem('token', res.data.content.id)
}).then(async (res) => {
localStorage.setItem('token', res.data.content.accessToken)
window.location.href = localStorage.getItem('location')
// cas
if (!hasAddDict) {
store.dispatch('dict/generateDic')
}
if (hasAddRoute) {
next()
// next({ ...to, replace: true })
} else {
const { result: getMenuData } = await getMenuInfo()
const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
// 获取用户信息
await store.dispatch('user/getUserInfo')
router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
const routeTo = Cookies.get('routerTo')
if (routeTo && routeTo !== '/') {
next({ ...to, replace: true })
} else {
next('/home')
}
}
}).catch(e => {
console.log(e)
})
......@@ -66,32 +92,7 @@ router.beforeEach(async (to, from, next) => {
}
next()
}
// Vue.prototype.$currentRoute = to
// NProgress.start()
// document.title = getPageTitle(to.meta.title)
// let hasAddDict = store.state.dict.addDict
// let hasAddRoute = store.state.permission.addRoutes
// if (!hasAddDict) {
// store.dispatch('dict/generateDic')
// }
// if (hasAddRoute) {
// next()
// // next({ ...to, replace: true })
// } else {
// const { result: getMenuData } = await getMenuInfo()
// const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
// // 获取用户信息
// await store.dispatch('user/getUserInfo')
// router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
// const routeTo = Cookies.get('routerTo')
// if (routeTo && routeTo !== '/') {
// next({ ...to, replace: true })
// } else {
// next('/home')
// }
// }
// NProgress.done()
NProgress.done()
})
router.afterEach(to => {
// 解决刷新页面报404问题
......
......@@ -124,7 +124,8 @@ export function getUrlParam (paraName) {
arr = arrPara[i].split('=');
if (arr != null && arr[0] === paraName) {
return arr[1];
const index = arr[1].indexOf("#");
return arr[1].substring(0, index);
}
}
return '';
......