فهرست منبع

页面跳转逻辑处理

luolei 5 سال پیش
والد
کامیت
c3cce48747

+ 4 - 4
src/common/Label.vue

@@ -11,10 +11,10 @@
           @cancel="cancelDel"/>
   </div>
 </template>
-<script type="text/javascript">
-import Toast from '../common/Toast.vue';
-import {moduleCP} from '@utils/tools';
-  export default{
+<script>
+  import Toast from '../common/Toast.vue';
+  import {moduleCP} from '@utils/tools';
+  export default {
     name:'Label',
     data(){
       return{

+ 7 - 2
src/common/Submit.vue

@@ -42,8 +42,13 @@ export default {
   methods: {
     goStart() {
       // this.$store.commit('initAllData') //已在患者页进行初始化
-      // this.$router.push("/")
-      this.$router.replace({path:'/'}) //阻止ios底部的前进后退按钮
+      let scan = localStorage.getItem('scan');
+      let params = JSON.parse(localStorage.getItem('infoParam'));
+      if(!scan){
+        this.$router.replace({path:'/department'});
+      }else{
+        this.$router.replace({path:'/home',query:Object.assign({}, params,{scan:true})});
+      }
     }
   }
 }

+ 3 - 6
src/components/Department.vue

@@ -28,13 +28,9 @@
             }
         },
         created(){
-            this.departmentLis = this.$route.params.result
+            this.departmentLis = JSON.parse(localStorage.getItem('loginData'))
         },
         mounted(){
-            if(JSON.stringify(this.$route.params) == '{}'){
-                this.$router.replace({path:'/login'})
-                return
-            }
             this.$nextTick(()=>{
                 let scroll = setScroll(BScroll,true,'.departmentView')
                 this.scroll = scroll
@@ -50,9 +46,10 @@
                     patientCode:msg.patientCode,
                     recordId:msg.recordId
                 }
+                localStorage.setItem('loginParam',JSON.stringify(params))//保存登陆信息,扫码进入徐删除该参数
 
                 this.$router.push({
-                    path:'/',
+                    path:'/home',
                     query:params
                 })
             }

+ 296 - 256
src/components/Login.vue

@@ -1,270 +1,310 @@
 <template>
-    <div class="login">
-        <div class="top">
-            <div class="img"><img src="../images/check.png" alt=""></div>
-            <h4>欢迎使用智能预问诊</h4>
-        </div>
-        <div class="main">
-            <div class="iptWrap choose">
-                <p @click="handleShow">{{name}} <img src="../images/down.png" /></p>
-                <div class="slideType" v-if="show">
-                    <ul>
-                        <li @click="handleType('手机号',103)">手机号</li>
-                        <li @click="handleType('身份证号',101)">身份证号</li>
-                        <li @click="handleType('病历号',102)">病历号</li>
-                        <li @click="handleType('市民卡号',104)" style="border:0 none">市民卡号</li>
-                    </ul>
-                </div>
-            </div>
-            <div class="iptWrap number">
-                <input @blur="blur" :maxlength="type==103?11:type==101?18:type==102?7:type==104?9:30" v-model="value" @input="changeVal" :type="type==101||type==104?'text':'tel'" class="input" type="text" :placeholder="'请输入'+name" >
-            </div>
-            <div :class="['btn',value?'btnClick':'btnDis']" @click="handleDepart">进入预问诊</div>
-        </div>
-        <div class="tip">
-            注:建议您可先输入病情情况,方便医生提前了解情况
+  <div class="login">
+    <div class="top">
+      <div class="img">
+        <img src="../images/check.png" alt />
+      </div>
+      <h4>欢迎使用智能预问诊</h4>
+    </div>
+    <div class="main">
+      <div class="iptWrap choose">
+        <p @click="handleShow">
+          {{name}}
+          <img src="../images/down.png" />
+        </p>
+        <div class="slideType" v-if="show">
+          <ul>
+            <li @click="handleType('手机号',103)">手机号</li>
+            <li @click="handleType('身份证号',101)">身份证号</li>
+            <li @click="handleType('病历号',102)">病历号</li>
+            <li @click="handleType('市民卡号',104)" style="border:0 none">市民卡号</li>
+          </ul>
         </div>
-      <Submit
-        v-if="submit"
-        :showType="showType"
-        :fail="failMsg"
-        @showSubmit="showSubmit"
-      ></Submit>
+      </div>
+      <div class="iptWrap number">
+        <input
+          @blur="blur"
+          :maxlength="type==103?11:type==101?18:type==102?7:type==104?9:30"
+          v-model="value"
+          @input="changeVal"
+          :type="type==101||type==104?'text':'tel'"
+          class="input"
+          type="text"
+          :placeholder="'请输入'+name"
+        />
+      </div>
+      <div :class="['btn',value?'btnClick':'btnDis']" @click="handleDepart">进入预问诊</div>
     </div>
+    <div class="tip">注:建议您可先输入病情情况,方便医生提前了解情况</div>
+    <Submit v-if="submit" :showType="showType" :fail="failMsg" @showSubmit="showSubmit"></Submit>
+    <Tiptoast
+        :show="showTip"
+				@close="close"
+				:data="message"/>
+  </div>
 </template>
 <script>
-    import {phoneTest,identify,jgpattern} from '@utils/tools.js';
-    import Submit from '../common/Submit';
-    import api from '@utils/api.js';
-    export default {
-        name: "Login",
-        data(){
-            return {
-                showType: 'fail',
-                failMsg:'',
-                submit:false,
-                show:false,
-                type:'103',
-                name:'手机号',
-                value:''
-            }
-        },
-        methods:{
-            handleType(name,type){
-                let tmpType=this.type
-                if(tmpType != type){
-                    this.name = name
-                    this.type = type
-                    this.value = ''
-                }
-                this.show = false
-            },
-            handleShow(){
-                const {show} = this
-                this.show = !show
-            },
-            blur(){        
-                document.activeElement.scrollIntoViewIfNeeded(true);
-                setTimeout(()=>{
-                    document.activeElement.scrollIntoViewIfNeeded(true);
-                },300)
-            },
-            changeVal(){
-                document.activeElement.scrollIntoViewIfNeeded(true);
-                const {type,value} = this
-                if(type == 102||type == 103){
-                    this.value=value.replace(/[^\d]/g,'')
-                }else if(type == 101 || type == 104){
-                    this.value=value.replace(/[\u4e00-\u9fa5]/g,'')
-                }
-            },
-            defaultWaring(msg){
-                this.$store.commit('handleToggleShow', false);
-                this.showType = 'fail'
-                this.failMsg = msg
-                this.submit = true
-                let timer = setTimeout(() => {
-                    this.submit = false
-                    clearTimeout(timer)
-                }, 2000);
-            },
-            showSubmit(flg) {
-                this.submit = flg
-            },
-            handleDepart(){
-                const {type,value} = this
-
-                if(value){
-                  if(type == 103){
-                      console.log(phoneTest.test(value))
-                      if(!phoneTest.test(value)){//验证不通过
-                          this.defaultWaring('请输入正确的11位手机号码')
-                          return
-                      }
-                  }else if(type == 101){//身份证
-                      if(!identify.test(value)){//验证不通过
-                          this.defaultWaring('请输入正确的身份证号')
-                          return
-                      }
-                  }else if(type == 104){//病历号只能输入数字字母
-                      if(!jgpattern.test(value)){//验证不通过
-                          this.defaultWaring('请输入正确的市民卡号')
-                          return
-                      }
-                  }
-                  const param = {
-                      "patientInfo": this.value,
-                      "patientInfoType": this.type
-                  }
-                  api.signIn(param).then((res) => {
-                      const result = res.data;
-                      if (result.code == 0) {
-                          if(result.data.length>1){
-                              this.$router.push({
-                                  name:'Department',
-                                  params:{"result":result.data}
-                              })
-                          }else if(result.data.length==1){
-                            let msg = result.data[0]
-                            let params = {
-                                hospitalCode:msg.hospitalCode,
-                                hospitalDeptCode:msg.hospitalDeptCode,
-                                doctorCode:msg.doctorCode,
-                                patientCode:msg.patientCode,
-                                recordId:msg.recordId
-                            }
-                            this.$router.push({
-                                path:'/',
-                                query:params
-                            })
-                          }else{
-
-                          }
-                      }else{
-                        this.defaultWaring(res)
-                      }
-                  }).catch(()=>{
-                        this.defaultWaring('网络异常请稍后重试')
-                  })
-                }
-            }
-        },
-        components:{
-          Submit
+import { phoneTest, identify, jgpattern } from "@utils/tools.js";
+import Submit from "../common/Submit";
+import Tiptoast from "../common/Tiptoast";
+import api from "@utils/api.js";
+export default {
+  name: "Login",
+  data() {
+    return {
+      showTip: false,
+      showType: "fail",
+      failMsg: "",
+      submit: false,
+      show: false,
+      type: "103",
+      name: "手机号",
+      value: "",
+      message:{
+        title: "",
+        text: ""
+      }
+    };
+  },
+  methods: {
+    close() {
+      this.showTip = false;
+    },
+    handleType(name, type) {
+      let tmpType = this.type;
+      if (tmpType != type) {
+        this.name = name;
+        this.type = type;
+        this.value = "";
+      }
+      this.show = false;
+    },
+    handleShow() {
+      const { show } = this;
+      this.show = !show;
+    },
+    blur() {
+      document.activeElement.scrollIntoViewIfNeeded(true);
+      setTimeout(() => {
+        document.activeElement.scrollIntoViewIfNeeded(true);
+      }, 300);
+    },
+    changeVal() {
+      document.activeElement.scrollIntoViewIfNeeded(true);
+      const { type, value } = this;
+      if (type == 102 || type == 103) {
+        this.value = value.replace(/[^\d]/g, "");
+      } else if (type == 101 || type == 104) {
+        this.value = value.replace(/[\u4e00-\u9fa5]/g, "");
+      }
+    },
+    defaultWaring(msg) {
+      this.$store.commit("handleToggleShow", false);
+      this.showType = "fail";
+      this.failMsg = msg;
+      this.submit = true;
+      let timer = setTimeout(() => {
+        this.submit = false;
+        clearTimeout(timer);
+      }, 2000);
+    },
+    showSubmit(flg) {
+      this.submit = flg;
+    },
+    handleDepart() {
+      const { type, value } = this;
+      if (value) {
+        if (type == 103) {
+          if (!phoneTest.test(value)) {
+            //验证不通过
+            this.defaultWaring("请输入正确的11位手机号码");
+            return;
+          }
+        } else if (type == 101) {
+          //身份证
+          if (!identify.test(value)) {
+            //验证不通过
+            this.defaultWaring("请输入正确的身份证号");
+            return;
+          }
+        } else if (type == 104) {
+          //病历号只能输入数字字母
+          if (!jgpattern.test(value)) {
+            //验证不通过
+            this.defaultWaring("请输入正确的市民卡号");
+            return;
+          }
         }
+        const param = {
+          patientInfo: this.value,
+          patientInfoType: this.type
+        };
+        api
+          .signIn(param)
+          .then(res => {
+            const result = res.data;
+            if (result.code == 0) {
+              localStorage.setItem('loginData',JSON.stringify(result.data))//保存登陆信息,扫码进入徐删除该参数
+              // localStorage.setItem('noScan',true)//登陆进入打标
+              if (result.data.length > 1) {
+                this.$router.push({
+                  name: "Department",
+                  params: { result: result.data }
+                });
+              } else if (result.data.length == 1) {
+                let msg = result.data[0];
+                let params = {
+                  hospitalCode: msg.hospitalCode,
+                  hospitalDeptCode: msg.hospitalDeptCode,
+                  doctorCode: msg.doctorCode,
+                  patientCode: msg.patientCode,
+                  recordId: msg.recordId
+                };
+                localStorage.setItem('loginParam',JSON.stringify(params))//保存登陆信息,扫码进入徐删除该参数
+                this.$router.push({
+                  path: "/home",
+                  query: params
+                });
+              } else {
+                this.message.title = '温馨提示'
+                this.message.text = '暂无今日挂号信息,可更换登录方式再次尝试。'
+                this.showTip = true
+              }
+            } else {
+              this.defaultWaring(res);
+            }
+          })
+          .catch(() => {
+            this.defaultWaring("网络异常请稍后重试");
+          });
+      }
     }
+  },
+  components: {
+    Submit,
+    Tiptoast
+  }
+};
 </script>
 <style lang="less" scoped>
-    .login {
-        height: 100%;
+.login {
+  height: 100%;
+  width: 100%;
+  position: fixed;
+  background: linear-gradient(
+    180deg,
+    rgba(79, 79, 255, 1) 0%,
+    rgba(79, 137, 255, 1) 100%
+  );
+  padding: 0.3rem 0.6rem;
+  box-sizing: border-box;
+  .top {
+    .img {
+      width: 1.6rem;
+      height: 1.6rem;
+      background-color: red;
+      margin: 1rem auto 0 auto;
+      img {
         width: 100%;
-        position: fixed;
-        background:linear-gradient(180deg,rgba(79,79,255,1) 0%,rgba(79,137,255,1) 100%);
-        padding: .3rem .6rem;
-        box-sizing: border-box;
-        .top {
-            .img {
-                width: 1.6rem;
-                height: 1.6rem;
-                background-color: red;
-                margin: 1rem auto 0 auto;
-                img {
-                    width: 100%;
-                }
-            }
-            h4 {
-                font-size: .42rem;
-                text-align: center;
-                color: #fff;
-                margin-top: 0.5rem;
-                margin-bottom: .8rem;
-                font-weight: normal;
-            }
-        }
-        .main {
-            width:100%;
-            height:5.34rem;
-            background:#fff;
-            border-radius:.2rem;
-            padding: .8rem .6rem;
-            box-sizing: border-box;
-            font-size: .3rem;
-            .iptWrap {
-                width:100%;
-                height:.88rem;
-                background:rgba(242,242,245,1);
-                border-radius:.1rem;
-                padding: .23rem .3rem;
-                box-sizing: border-box;
-            }
-            .choose {
-                position: relative;
-                p {
-                    width: 100%;
-                    position: relative;
-                    img {
-                        position: absolute;
-                        right: 0;
-                        top: 0;
-                        width: .4rem;
-                        height: .4rem;
-                    }
-                }
-                .slideType {
-                    box-sizing: border-box;
-                    position: absolute;
-                    z-index: 10;
-                    width: 100%;
-                    top: 0.88rem;
-                    left: 0;
-                    box-shadow:0px 4px 20px 0px rgba(102,102,102,0.18);
-                    border-radius:.1rem;
-                    background-color: #fff;
-                    padding: .1rem .3rem 0 .3rem;
-                    box-sizing: border-box;
-                    font-size: .28rem;
-                    li {
-                        border-bottom: 1px solid #F5F5F5;
-                        height: .6rem;
-                        line-height: .6rem;
-                        box-sizing: border-box;
-                    }
-                }
-            }
-            
-            .number {
-                margin: .3rem 0 .8rem 0;
-                .input{
-                    float: left;
-                    color:rgba(51,51,51,1);
-                    height:.42rem;
-                    line-height:.42rem;
-                    width: 100%;
-                    background-color: transparent;
-                }
-            }
-            .btn {
-                width:100%;
-                height:.88rem;
-                line-height:.88rem;
-                text-align: center;
-                background:linear-gradient(270deg,rgba(79,139,255,1) 0%,rgba(79,79,255,1) 100%);
-                border-radius:.44rem;
-                color: #fff;
-                font-size: .32rem;
-                font-weight: 500;
-            }
-            .btnDis {
-                opacity: 0.3;
-            }
-            .btnClick {
-                opacity:1;
-            }
+      }
+    }
+    h4 {
+      font-size: 0.42rem;
+      text-align: center;
+      color: #fff;
+      margin-top: 0.5rem;
+      margin-bottom: 0.8rem;
+      font-weight: normal;
+    }
+  }
+  .main {
+    width: 100%;
+    height: 5.34rem;
+    background: #fff;
+    border-radius: 0.2rem;
+    padding: 0.8rem 0.6rem;
+    box-sizing: border-box;
+    font-size: 0.3rem;
+    .iptWrap {
+      width: 100%;
+      height: 0.88rem;
+      background: rgba(242, 242, 245, 1);
+      border-radius: 0.1rem;
+      padding: 0.23rem 0.3rem;
+      box-sizing: border-box;
+    }
+    .choose {
+      position: relative;
+      p {
+        width: 100%;
+        position: relative;
+        img {
+          position: absolute;
+          right: 0;
+          top: 0;
+          width: 0.4rem;
+          height: 0.4rem;
         }
-        .tip {
-            color: #fff;
-            font-size: .24rem;
-            margin-top: .6rem;
+      }
+      .slideType {
+        box-sizing: border-box;
+        position: absolute;
+        z-index: 10;
+        width: 100%;
+        top: 0.88rem;
+        left: 0;
+        box-shadow: 0px 4px 20px 0px rgba(102, 102, 102, 0.18);
+        border-radius: 0.1rem;
+        background-color: #fff;
+        padding: 0.1rem 0.3rem 0 0.3rem;
+        box-sizing: border-box;
+        font-size: 0.28rem;
+        li {
+          border-bottom: 1px solid #f5f5f5;
+          height: 0.6rem;
+          line-height: 0.6rem;
+          box-sizing: border-box;
         }
+      }
+    }
+
+    .number {
+      margin: 0.3rem 0 0.8rem 0;
+      .input {
+        float: left;
+        color: rgba(51, 51, 51, 1);
+        height: 0.42rem;
+        line-height: 0.42rem;
+        width: 100%;
+        background-color: transparent;
+      }
+    }
+    .btn {
+      width: 100%;
+      height: 0.88rem;
+      line-height: 0.88rem;
+      text-align: center;
+      background: linear-gradient(
+        270deg,
+        rgba(79, 139, 255, 1) 0%,
+        rgba(79, 79, 255, 1) 100%
+      );
+      border-radius: 0.44rem;
+      color: #fff;
+      font-size: 0.32rem;
+      font-weight: 500;
+    }
+    .btnDis {
+      opacity: 0.3;
+    }
+    .btnClick {
+      opacity: 1;
     }
+  }
+  .tip {
+    color: #fff;
+    font-size: 0.24rem;
+    margin-top: 0.6rem;
+  }
+}
 </style>

+ 17 - 1
src/components/PathInfo.vue

@@ -101,6 +101,11 @@
       }
     },
     created(){
+      // this.getPathInfo();
+      // this.getSysConfig();
+      // this.$store.commit('initAllData');//初始化store数据
+    },
+    mounted(){
       this.getPathInfo();
       this.getSysConfig();
       this.$store.commit('initAllData');//初始化store数据
@@ -109,6 +114,7 @@
       getPathInfo(){
         let query = this.$route.query
         let hasQuery = JSON.stringify(query) == '{}'
+        // let noScan = localStorage.getItem('noScan')
         const params = {
           // 'hospitalCode':getUrlArgObject('hospitalCode'),
           // 'hospitalDeptCode':getUrlArgObject('hospitalDeptCode'),
@@ -121,7 +127,17 @@
           'patientCode':!hasQuery&&query.patientCode||'',
           'recordId':!hasQuery&&query.recordId||''
         }
-        localStorage.setItem('infoParam',JSON.stringify(params))
+        
+        if(!hasQuery&&query.scan){//扫码进入的
+          localStorage.removeItem('loginParam')
+          localStorage.removeItem('loginData')
+          localStorage.setItem('scan',true)//保存扫码标记
+          localStorage.setItem('infoParam',JSON.stringify(params))//保存扫码信息,登录进入需删除该参数
+        }else{//登陆进入的
+          localStorage.removeItem('infoParam')
+          localStorage.removeItem('scan')
+          
+        }
         api.getPathInfo(params).then((res)=>{
           const result = res.data;
           if(result.code==0){

+ 1 - 1
src/components/Symptom.vue

@@ -156,7 +156,7 @@ export default {
       document.activeElement.scrollIntoViewIfNeeded(true);        
     },
     searchVal(val) {
-      console.log(val)
+      // console.log(val)
     },
     search(flg) {
       this.$store.commit('setSearchShow', flg);

+ 8 - 3
src/components/TabPage.vue

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

+ 5 - 0
src/router/index.js

@@ -9,6 +9,11 @@ const router = new Router({
   routes:[
     {
       path:'/',
+      name:'Login',
+      component:Login
+    },
+    {
+      path:'/home',
       name:'PathInfo',
       component:PathInfo
     },