b95b5bf4 by renchao@pashanhoo.com

style:cas完成

1 parent 5770ee1d
1 { 1 {
2 "TITLE": "不动产登记系统", 2 "TITLE": "不动产登记系统",
3 "SERVERAPI": "/bdcdj" 3 "SERVERAPI": "/dj"
4 } 4 }
...\ No newline at end of file ...\ No newline at end of file
......
1 /* 1 /*
2 * @Description: 2 * @Description:
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-05-06 09:14:47 4 * @LastEditTime: 2023-05-30 15:28:52
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import App from './App' 7 import App from './App'
...@@ -60,7 +60,7 @@ Object.keys(filters).forEach(key => { ...@@ -60,7 +60,7 @@ Object.keys(filters).forEach(key => {
60 }) 60 })
61 Vue.config.productionTip = false 61 Vue.config.productionTip = false
62 62
63 axios.get("/bdcdj/config.json") 63 axios.get("/config.json")
64 .then((res) => { 64 .then((res) => {
65 Vue.prototype.BASE_API = res.data 65 Vue.prototype.BASE_API = res.data
66 localStorage.setItem('ApiUrl', JSON.stringify(res.data)); 66 localStorage.setItem('ApiUrl', JSON.stringify(res.data));
......
1 /* 1 /*
2 * @Description: 项目权限 2 * @Description: 项目权限
3 * @Autor: renchao 3 * @Autor: renchao
4 * @LastEditTime: 2023-05-26 17:17:34 4 * @LastEditTime: 2023-05-30 16:27:26
5 */ 5 */
6 import Vue from 'vue' 6 import Vue from 'vue'
7 import router from './router' 7 import router from './router'
...@@ -16,8 +16,13 @@ import Cookies from 'js-cookie' ...@@ -16,8 +16,13 @@ import Cookies from 'js-cookie'
16 NProgress.configure({ showSpinner: false }) // NProgress Configuration 16 NProgress.configure({ showSpinner: false }) // NProgress Configuration
17 17
18 router.beforeEach(async (to, from, next) => { 18 router.beforeEach(async (to, from, next) => {
19 Vue.prototype.$currentRoute = to
20 NProgress.start()
21 document.title = getPageTitle(to.meta.title)
22 let hasAddDict = store.state.dict.addDict
23 let hasAddRoute = store.state.permission.addRoutes
24 // cas操作
19 const token = localStorage.getItem("token") 25 const token = localStorage.getItem("token")
20 debugger
21 if (to.path === '/login') { 26 if (to.path === '/login') {
22 if (token) { 27 if (token) {
23 next('/') 28 next('/')
...@@ -36,9 +41,30 @@ router.beforeEach(async (to, from, next) => { ...@@ -36,9 +41,30 @@ router.beforeEach(async (to, from, next) => {
36 'ticket': ticket, 41 'ticket': ticket,
37 'service': locationUrl 42 'service': locationUrl
38 } 43 }
39 }).then((res) => { 44 }).then(async (res) => {
40 localStorage.setItem('token', res.data.content.id) 45 localStorage.setItem('token', res.data.content.accessToken)
41 window.location.href = localStorage.getItem('location') 46 window.location.href = localStorage.getItem('location')
47 // cas
48 if (!hasAddDict) {
49 store.dispatch('dict/generateDic')
50 }
51 if (hasAddRoute) {
52 next()
53 // next({ ...to, replace: true })
54 } else {
55 const { result: getMenuData } = await getMenuInfo()
56 const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
57 // 获取用户信息
58 await store.dispatch('user/getUserInfo')
59 router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
60 const routeTo = Cookies.get('routerTo')
61 if (routeTo && routeTo !== '/') {
62 next({ ...to, replace: true })
63 } else {
64 next('/home')
65 }
66 }
67
42 }).catch(e => { 68 }).catch(e => {
43 console.log(e) 69 console.log(e)
44 }) 70 })
...@@ -66,32 +92,7 @@ router.beforeEach(async (to, from, next) => { ...@@ -66,32 +92,7 @@ router.beforeEach(async (to, from, next) => {
66 } 92 }
67 next() 93 next()
68 } 94 }
69 95 NProgress.done()
70 // Vue.prototype.$currentRoute = to
71 // NProgress.start()
72 // document.title = getPageTitle(to.meta.title)
73 // let hasAddDict = store.state.dict.addDict
74 // let hasAddRoute = store.state.permission.addRoutes
75 // if (!hasAddDict) {
76 // store.dispatch('dict/generateDic')
77 // }
78 // if (hasAddRoute) {
79 // next()
80 // // next({ ...to, replace: true })
81 // } else {
82 // const { result: getMenuData } = await getMenuInfo()
83 // const accessRoutes = await store.dispatch('permission/generateRoutes', getMenuData)
84 // // 获取用户信息
85 // await store.dispatch('user/getUserInfo')
86 // router.addRoutes([...accessRoutes, { path: '*', redirect: '/404', hidden: true }])
87 // const routeTo = Cookies.get('routerTo')
88 // if (routeTo && routeTo !== '/') {
89 // next({ ...to, replace: true })
90 // } else {
91 // next('/home')
92 // }
93 // }
94 // NProgress.done()
95 }) 96 })
96 router.afterEach(to => { 97 router.afterEach(to => {
97 // 解决刷新页面报404问题 98 // 解决刷新页面报404问题
......
...@@ -124,7 +124,8 @@ export function getUrlParam (paraName) { ...@@ -124,7 +124,8 @@ export function getUrlParam (paraName) {
124 arr = arrPara[i].split('='); 124 arr = arrPara[i].split('=');
125 125
126 if (arr != null && arr[0] === paraName) { 126 if (arr != null && arr[0] === paraName) {
127 return arr[1]; 127 const index = arr[1].indexOf("#");
128 return arr[1].substring(0, index);
128 } 129 }
129 } 130 }
130 return ''; 131 return '';
......