|
@@ -22,14 +22,16 @@ Vue.prototype.postRequest = postRequest;
|
|
|
Vue.prototype.putRequest = putRequest;
|
|
|
Vue.prototype.deleteRequest = deleteRequest;
|
|
|
|
|
|
-router.beforeEach((to, from, next) => {
|
|
|
+router.beforeEach(async (to, from, next) => {
|
|
|
// document.title = "嘉讯茂移动办公平台"
|
|
|
if(window.sessionStorage.getItem("tokenStr")) {
|
|
|
- initMenu(router, store);
|
|
|
- initSite(store);
|
|
|
+ await initMenu(router, store);
|
|
|
+ await initSite(store);
|
|
|
+ console.log(store.state)
|
|
|
if(!window.sessionStorage.getItem('user')) {
|
|
|
//判断用户信息是否存在
|
|
|
- return getRequest('/user/info').then((resp) => {
|
|
|
+ getRequest('/user/info').then((resp) => {
|
|
|
+ console.log(resp)
|
|
|
if(resp) {
|
|
|
//存入用户信息
|
|
|
window.sessionStorage.setItem('user', JSON.stringify(resp.data));
|
|
@@ -38,6 +40,7 @@ router.beforeEach((to, from, next) => {
|
|
|
next();
|
|
|
})
|
|
|
}
|
|
|
+ console.log(to, from, next, router)
|
|
|
next();
|
|
|
} else {
|
|
|
if(to.path != '/') {
|