Browse Source

bug:2112,2114,2115,2116,2118,2119,2120

luolei 5 years ago
parent
commit
9d371c346e

+ 9 - 5
src/components/Department.vue

@@ -2,7 +2,7 @@
     <div class="department">
         <div class="departmentView">
             <div class="content">
-                <div class="list" v-for="(item,index) in departmentLis" @click="goStart(index)" :key="item.recordTime">
+                <div class="list" v-for="(item,index) in departmentLis" @click="goStart(index,item.recordTime)" :key="item.recordTime">
                     <div class="top">
                         <p>挂号科室:{{item.hospitalDeptName}} <img src="../images/right.png" alt=""></p>
                     </div>
@@ -17,7 +17,7 @@
     </div>
 </template>
 <script>
-  import {setScroll} from '@utils/tools.js';
+  import {setScroll,compare} from '@utils/tools.js';
   import BScroll from 'better-scroll';
     export default {
         name: "Department",
@@ -28,7 +28,9 @@
             }
         },
         created(){
-            this.departmentLis = JSON.parse(localStorage.getItem('loginData'))
+            let tmpList = JSON.parse(localStorage.getItem('loginData'))
+            let sortArr = tmpList.sort(compare("recordTime"));
+            this.departmentLis = sortArr
         },
         mounted(){
             this.$nextTick(()=>{
@@ -37,15 +39,17 @@
             })
         },
         methods:{
-            goStart(num){
+            goStart(num,time){
                 let msg = this.departmentLis[num]
                 let params = {
                     hospitalCode:msg.hospitalCode,
                     hospitalDeptCode:msg.hospitalDeptCode,
                     doctorCode:msg.doctorCode,
                     patientCode:msg.patientCode,
-                    recordId:msg.recordId
+                    recordId:msg.recordId,
+                    time:(new Date(time)).getTime()
                 }
+                
                 localStorage.setItem('loginParam',JSON.stringify(params))//保存登陆信息,扫码进入徐删除该参数
 
                 this.$router.push({

+ 10 - 3
src/components/Login.vue

@@ -153,7 +153,7 @@ export default {
           .then(res => {
             let result = res.data;
             if (result.code == 0) {
-              // result.data.splice(0,1);//测试只有一条数据
+              result.data.splice(0,1);//测试只有一条数据
               localStorage.setItem('loginData',JSON.stringify(result.data))//保存登陆信息,扫码进入徐删除该参数
               if (result.data.length > 1) {
                 this.$router.push({
@@ -167,7 +167,8 @@ export default {
                   hospitalDeptCode: msg.hospitalDeptCode,
                   doctorCode: msg.doctorCode,
                   patientCode: msg.patientCode,
-                  recordId: msg.recordId
+                  recordId: msg.recordId,
+                  time:(new Date(msg.recordTime)).getTime()
                 };
                 localStorage.setItem('loginParam',JSON.stringify(params))//保存登陆信息,扫码进入徐删除该参数
                 this.$router.push({
@@ -180,7 +181,13 @@ export default {
                 this.showTip = true
               }
             } else {
-              this.defaultWaring(res.msg);
+              if(res.msg.indexOf('暂无今日挂号信息') != -1){
+                this.message.title = '温馨提示'
+                this.message.text = '暂无今日挂号信息,可更换登录方式再次尝试。'
+                this.showTip = true
+              }else{
+                this.defaultWaring(res.msg);
+              }
             }
           })
           .catch(() => {

+ 9 - 6
src/components/PathInfo.vue

@@ -14,7 +14,7 @@
         </p>
         <p>
           <span>预约时间:</span>
-          <span>{{pathInfo.systemTime}}</span>
+          <span>{{time}}</span>
         </p>
         <p class="already" v-if="type !== 1">{{text[type]}}</p>
       </div>
@@ -52,7 +52,7 @@
 <script type="text/javascript">
   import api from '@utils/api.js'
   import Submit from '../common/Submit';
-  import {getUrlArgObject,setScroll} from '@utils/tools.js'
+  import {getUrlArgObject,setScroll,dateParser} from '@utils/tools.js'
   import BScroll from 'better-scroll';
   export default {
     name:'PathInfo',
@@ -71,7 +71,9 @@
         hideChild:true,  //隐藏儿童
         submit:false,
         scroll:null,
-        message:''
+        message:'',
+        time:'',
+        params:{}
       }
     },
     created(){
@@ -89,14 +91,16 @@
       getPathInfo(){
         let query = this.$route.query
         let hasQuery = JSON.stringify(query) == '{}'
+        let tmpTime = dateParser(!hasQuery&&query.recordTime) || (JSON.parse(localStorage.getItem('loginParam'))&&JSON.parse(localStorage.getItem('loginParam')).time)
+        this.time = tmpTime
         const params = {
           'hospitalCode':!hasQuery&&query.hospitalCode||'',
           'hospitalDeptCode':!hasQuery&&query.hospitalDeptCode||'',
           'doctorCode':!hasQuery&&query.doctorCode||'',
           'patientCode':!hasQuery&&query.patientCode||'',
-          'recordId':!hasQuery&&query.recordId||''
+          'recordId':!hasQuery&&query.recordId||'',
+          'recordTime':!hasQuery&&query.recordTime
         }
-        
         if(!hasQuery&&query.scan){//扫码进入的
           localStorage.removeItem('loginParam')
           localStorage.removeItem('loginData')
@@ -105,7 +109,6 @@
         }else{//登陆进入的
           localStorage.removeItem('infoParam')
           localStorage.removeItem('scan')
-          
         }
         api.getPathInfo(params).then((res)=>{
           const result = res.data;

+ 2 - 2
src/components/Preview.vue

@@ -27,7 +27,7 @@
               <h4><i :style="{'background': '#FF9A9A'}"></i> 主诉:</h4>
               <p>
                 <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">
-                {{item.specialP?(item.description||item.name)+item.specialP+(idx == symptom.choose.length-1?'':'、'):(item.description||item.name)+(idx == symptom.choose.length-1?'':'、')}}
+                {{item.specialP?(item.description||item.name)+item.specialP+(idx == symptom.choose.length-1?'':','):(item.description||item.name)+(idx == symptom.choose.length-1?'':',')}}
                 </span>
               </p>
             </li>
@@ -85,7 +85,7 @@
               <li>
                 <h4><i :style="{'background': '#FF9A9A'}"></i> 主诉:</h4>
                 <p>
-                  <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{item.special?item.name+item.special+(idx == symptom.choose.length-1?'':'、'):item.name+(idx == symptom.choose.length-1?'':'、')}}</span>
+                  <span v-for="(item,idx) in symptom.choose" :key="item.name+idx">{{item.special?item.name+item.special+(idx == symptom.choose.length-1?'':','):item.name+(idx == symptom.choose.length-1?'':',')}}</span>
                 </p>
               </li>
               <li>

+ 26 - 1
src/utils/tools.js

@@ -310,6 +310,29 @@ function setScroll(scroll,flg,wrapper){
   })
 }
 
+function compare(property){
+  return function(obj1,obj2){
+      var value1 = (new Date(obj1[property])).getTime();
+      var value2 = (new Date(obj2[property])).getTime();
+      return value1 - value2;
+  }
+}
+
+// 时间戳转换日期
+function dateParser(timestamp,link = '-'){
+  if(timestamp.length == 10){
+    timestamp = timestamp*1000
+  }
+  let time = new Date(timestamp-0);
+  let year = time.getFullYear();
+  let month = time.getMonth()+1;
+  let date = time.getDate();
+  let hour = time.getHours().toString().padStart(2,'0');
+  let minute = time.getMinutes().toString().padStart(2,'0');
+  let second = time.getSeconds().toString().padStart(2,'0');
+  let result = year+link+(month<10?"0"+month:month)+link+(date<10?"0"+date:date)+' '+hour+':'+minute+':'+second;
+  return result;
+}
 
 module.exports =  {
   imageUrlPrefix,
@@ -330,7 +353,9 @@ module.exports =  {
   isWX,
   phoneTest,
   identify,
-  jgpattern
+  jgpattern,
+  compare,
+  dateParser
 }