Ver código fonte

刷新页面

wangxin 6 anos atrás
pai
commit
ad314f135e
2 arquivos alterados com 53 adições e 19 exclusões
  1. 8 1
      src/view/business/return_journey.vue
  2. 45 18
      src/view/index/index.vue

+ 8 - 1
src/view/business/return_journey.vue

@@ -35,7 +35,7 @@
                                     <span>{{item.dkStaff.name}}</span>
                                     <!--                                    <span style="color: #999999">(18118379209)</span>-->
                                     <span style="margin-left: 15px;margin-right: 8px">预计 <span
-                                            style="font-weight: bold">02月07日</span> 返程</span>
+                                            style="font-weight: bold">{{item.estimateBackDate | formatDate}}</span> 返程</span>
 
                                 </van-col>
                                 <van-col
@@ -142,6 +142,8 @@
     import {backtrackingInfo} from '@/api/index'
     import {getAction} from '@/api/manage'
     import {getStore} from "@/utils/storage";
+    import {dk_formatDate} from '@/utils/util'
+
 
     export default {
         name: "return_journey",
@@ -161,6 +163,11 @@
                 notList: []
             }
         },
+        filters: {
+            formatDate(date) {
+                return dk_formatDate(new Date(date), '年')
+            }
+        },
         mounted() {
             getAction(backtrackingInfo, {enterprise_id: getStore(getStore('role')).id}).then(data => {
                 if (data.errcode === 0) {

+ 45 - 18
src/view/index/index.vue

@@ -131,6 +131,7 @@
     // import wx from 'weixin-jsapi'
     const wx = window.wx;
     let TIME = null;
+
     export default {
         name: "index",
         components: {
@@ -157,14 +158,23 @@
                 }
             };
         },
+        beforeCreate() {
+            if (location.href.indexOf("#") === -1) {
+                location.href = location.href + "#isreload";
+                location.reload();
+            }
+        },
         mounted() {
+            //
             //获取链接参数
-            var query = this.$route.query;
-            this.enterprise_id = query.enterprise_id;
-            this.enterprise_name = query.enterprise_name;
+            // var query = this.$route.query;
+            // this.enterprise_id = query.enterprise_id;
+            // this.enterprise_name = query.enterprise_name;
             this.role = getStore('role');
             this.getJsapiConfig();
             if (this.role === 'staff') {
+                this.enterprise_id = getStore('staff').enterpriseId;
+                this.enterprise_name = getStore('staff').enterpriseName;
                 getAction(queryStaffPunchClock, {staffId: getStore(getStore('role')).id}).then(data => {
                     if (data.data.dkPunchClockAPIList.length && isToday(data.data.dkPunchClockAPIList[0].punchTime)) {
                         this.temperature = data.data.dkPunchClockAPIList[0].temperature;
@@ -172,10 +182,13 @@
                     } else {
                         this.status = 1
                     }
-
                 })
+            } else {
+                this.enterprise_id = getStore('company').id;
+                this.enterprise_name = getStore('company').enterpriseName;
             }
-        },
+        }
+        ,
         methods: {
             loginout() {
                 const role = getStore('role');
@@ -189,19 +202,24 @@
                         this.$router.replace('login')
                     }
                 })
-            },
+            }
+            ,
             toJourney() {
                 this.$router.push({name: 'return_journey'})
-            },
+            }
+            ,
             toTemperature() {
                 this.$router.push({name: 'temperature'})
-            },
+            }
+            ,
             toStaffJourney() {
                 this.$router.push({name: 'journey_detail'})
-            },
+            }
+            ,
             toStaffTemperature() {
                 this.$router.push({name: 'clock'})
-            },
+            }
+            ,
             clock() {
                 if (this.ready) {
                     clearTimeout(TIME);
@@ -210,16 +228,20 @@
                     this.loading = true;
                     TIME = setTimeout(this.clock, 500)
                 }
-            },
+            }
+            ,
             toDonations() {
                 this.$router.push({name: 'donations'})
-            },
+            }
+            ,
             shareSure() {
                 this.cover = false
-            },
+            }
+            ,
             share() {
                 this.cover = true
-            },
+            }
+            ,
             getJsapiConfig() {
                 //获取微信js配置信息
                 getAction(this.url.getJsapiConfig, {fullUrl: encodeURIComponent(location.href.split('#')[0])})
@@ -250,7 +272,8 @@
                     })
                     .catch(() => {
                     });
-            },
+            }
+            ,
             location() {
                 var that = this;
                 // return new Promise(((resolve, reject) => {
@@ -275,11 +298,13 @@
                             console.log('fail');
                             Toast("获取位置失败,请检查定位");
                             that.loading = false;
+                            that.$router.push({name: 'staff_temperature', params: {province: ''}});
                         }
                     });
                 }
                 // }))
-            },
+            }
+            ,
             changeLocation(latitude, longitude) {
                 var that = this;
                 // return new Promise((resolve) => {
@@ -314,7 +339,8 @@
                         console.log(data);
                     });
                 // })
-            },
+            }
+            ,
 
             //分享给朋友
             updateAppMessageShareData() {
@@ -328,7 +354,8 @@
                         // 设置成功
                     }
                 })
-            },
+            }
+            ,
 
             //分享到朋友圈
             updateTimelineShareData() {