Przeglądaj źródła

修改路由及其他细节

306132416@qq.com 4 lat temu
rodzic
commit
ad150bb553
2 zmienionych plików z 9 dodań i 5 usunięć
  1. 8 5
      src/App.vue
  2. 1 0
      src/router/index.js

+ 8 - 5
src/App.vue

@@ -38,7 +38,7 @@ export default {
     return {
       navTitle1: ' > 数据管理',
       navTitle2: '',
-      isManufacturer: 'manufacturer', // distributor 经销商 manufacturer 厂商
+      isManufacturer: 'distributor', // distributor 经销商 manufacturer 厂商
       userAccount: ''
     }
   },
@@ -69,14 +69,14 @@ export default {
         data:token
       }).then((res) => {
         console.log(res);
-        if(res.data && res.data.code === 200) {
+        if(res.data.code === 200) {
           let userInfo = res.data.data;
           if (!userInfo.agentId) {
             this.isManufacturer = 'manufacturer';
             console.log(this.$route.path,222)
-            // if (this.$route.path !== '/uploadInfor') {
-            //   this.$router.replace({ path: "/uploadInfor" });
-            // }
+            if (this.$route.path !== '/uploadInfor') {
+              this.$router.replace({ path: "/uploadInfor" });
+            }
             return
           } else {
             if (userInfo.userRole == '1' || userInfo.userRole == '2') {
@@ -84,6 +84,9 @@ export default {
               localStorage.setItem("userId", userInfo.agentId);
             } else {
               this.isManufacturer = 'manufacturer';
+              if (this.$route.path !== '/uploadInfor') {
+                this.$router.replace({ path: "/uploadInfor" });
+              }
             }
           }
           this.userAccount = userInfo.userCode;

+ 1 - 0
src/router/index.js

@@ -117,6 +117,7 @@ const routes = [
 ]
 
 const router = new VueRouter({
+  mode: 'history',
   routes
 })