瀏覽代碼

路由入口修改,不在此处判断缓存信息,改为企业登录页create开始时判断。跳转页面接收参数处理。

zwq 6 年之前
父節點
當前提交
149b1d8bd2
共有 4 個文件被更改,包括 15 次插入5 次删除
  1. 1 2
      src/router.js
  2. 7 1
      src/view/login/index.vue
  3. 1 1
      src/view/stafflogin/index.vue
  4. 6 1
      src/view/user/index.vue

+ 1 - 2
src/router.js

@@ -1,13 +1,12 @@
 import Vue from 'vue';
 import Router from 'vue-router';
-import {getStore} from "@/utils/storage";
 
 Vue.use(Router);
 
 const routes = [
     {
         path: '*',
-        redirect: getStore('login') ? '/user' : '/login'
+        redirect: '/login'
     },
     {
         name: 'user',

+ 7 - 1
src/view/login/index.vue

@@ -26,7 +26,7 @@
 <script>
     import {postAction} from '@/api/manage'
     import {Button, Cell, CellGroup, Field, Toast} from 'vant';
-    import {setStore} from "@/utils/storage";
+    import {setStore,getStore} from "@/utils/storage";
 
     export default {
         name: "index",
@@ -51,6 +51,12 @@
                 }
             };
         },
+        created() {
+            //企业已登录,跳转企业首页
+            if( getStore('login') ){
+                this.$router.replace({name:'user',params: { enterprise_id: 123 }});
+            }
+        },
         methods: {
             login() {
                 this.loading = true;

+ 1 - 1
src/view/stafflogin/index.vue

@@ -54,7 +54,7 @@
         created() {
             //员工已登录,跳转员工首页
             if( getStore('login') ){
-                this.$router.replace('cart');
+                this.$router.replace({name:'cart',params: { enterprise_id: 123 }});
             }
         },
         methods: {

+ 6 - 1
src/view/user/index.vue

@@ -42,7 +42,12 @@ export default {
     [Icon.name]: Icon,
     [Cell.name]: Cell,
     [CellGroup.name]: CellGroup
-  }
+  },
+    created(){
+        //获取传入的参数
+        var param = this.$route.params;
+        console.log("ddf",param)
+    }
 };
 </script>