浏览代码

只有一条数据跳转逻辑

luolei 5 年之前
父节点
当前提交
f560f803cd
共有 4 个文件被更改,包括 16 次插入5 次删除
  1. 7 1
      src/common/Submit.vue
  2. 2 2
      src/components/Login.vue
  3. 0 1
      src/components/PathInfo.vue
  4. 7 1
      src/components/TabPage.vue

+ 7 - 1
src/common/Submit.vue

@@ -44,8 +44,14 @@ export default {
       // this.$store.commit('initAllData') //已在患者页进行初始化
       let scan = localStorage.getItem('scan');
       let params = JSON.parse(localStorage.getItem('infoParam'));
+      let param = JSON.parse(localStorage.getItem('loginParam'));
+      let data = JSON.parse(localStorage.getItem('loginData'));
       if(!scan){
-        this.$router.replace({path:'/department'});
+        if(data.length>1){
+          this.$router.replace({path:'/department'});
+        }else{
+          this.$router.replace({path:'/home',query:param});
+        }
       }else{
         this.$router.replace({path:'/home',query:Object.assign({}, params,{scan:true})});
       }

+ 2 - 2
src/components/Login.vue

@@ -142,10 +142,10 @@ export default {
         api
           .signIn(param)
           .then(res => {
-            const result = res.data;
+            let result = res.data;
             if (result.code == 0) {
+              // result.data.splice(0,1);//测试只有一条数据
               localStorage.setItem('loginData',JSON.stringify(result.data))//保存登陆信息,扫码进入徐删除该参数
-              // localStorage.setItem('noScan',true)//登陆进入打标
               if (result.data.length > 1) {
                 this.$router.push({
                   name: "Department",

+ 0 - 1
src/components/PathInfo.vue

@@ -114,7 +114,6 @@
       getPathInfo(){
         let query = this.$route.query
         let hasQuery = JSON.stringify(query) == '{}'
-        // let noScan = localStorage.getItem('noScan')
         const params = {
           // 'hospitalCode':getUrlArgObject('hospitalCode'),
           // 'hospitalDeptCode':getUrlArgObject('hospitalDeptCode'),

+ 7 - 1
src/components/TabPage.vue

@@ -108,8 +108,14 @@ export default {
     if (this.config.length == 0) {//登录进去返回到列表页,扫码返回到开始页
       let scan = localStorage.getItem('scan');
       let params = JSON.parse(localStorage.getItem('infoParam'));
+      let param = JSON.parse(localStorage.getItem('loginParam'));
+      let data = JSON.parse(localStorage.getItem('loginData'));
       if(!scan){
-        this.$router.replace({path:'/department'});
+        if(data.length>1){
+          this.$router.replace({path:'/department'});
+        }else{
+          this.$router.replace({path:'/home',query:param});
+        }
       }else{
         this.$router.replace({path:'/home',query:Object.assign({}, params,{scan:true})});
       }