Переглянути джерело

【Fix】修复首页二维码不显示的问题

(cherry picked from commit a25552d44c62da0cf8de0ee8b2d56837efb4c718)
liuxiangxin 4 місяців тому
батько
коміт
fa8852c992
2 змінених файлів з 14 додано та 18 видалено
  1. 3 3
      components/FollowPopup/FollowPopup.vue
  2. 11 15
      pages/index/index.vue

+ 3 - 3
components/FollowPopup/FollowPopup.vue

@@ -2,11 +2,11 @@
   <view class="add_follow">
     <view class="close_area"><button class="close_btn" @click="closePopup">关闭</button></view>
     <view class="info_alter">
-      <text v-if="follow_linkurl">点击二维码添加客服</text>
-      <text v-if="!follow_linkurl">长按二维码添加客服</text>
+      <text v-show="follow_linkurl">点击二维码添加客服</text>
+      <text v-show="!follow_linkurl">长按二维码添加客服</text>
     </view>
     <view class="qr_code_area" @click="followLinkurl">
-      <image v-if="followQrcode" :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress> </image>
+      <image :src="followQrcode" class="qr_code" mode="" show-menu-by-longpress> </image>
     </view>
     <view class="rule_info">
       <view class="">报单规则:</view>

+ 11 - 15
pages/index/index.vue

@@ -138,21 +138,17 @@ export default {
 
     //如果已选城市且没有添加客服每天弹窗一次
     if (this.$checkAccess.getCity() && this.$checkAccess.getFollowQrcode()) {
-      uni.getStorage({
-        key: "followPopupTime",
-        success: (res) => {
-          if (!res.data || new Date().getTime() - res.data > 1000 * 60 * 60 * 24) {
-            uni.setStorage({
-              key: "followPopupTime",
-              data: new Date().getTime(),
-            });
-            this.$refs.addFollow.open("center");
-          }
-        },
-        fail: (err) => {
-          this.$refs.addFollow.open("center");
-        },
-      });
+		// 获取弹出时间
+		let followPopupTime		= uni.getStorageSync('followPopupTime');
+		// 现在的时候
+		let nowTime				= new Date().getTime();
+		// 时间戳
+		followPopupTime			= followPopupTime ? followPopupTime : 0;
+		// 弹出结果
+		if( followPopupTime <= 0 || followPopupTime - nowTime  > 86400000 ) {
+			this.$refs.addFollow.open("center");
+			uni.setStorageSync('followPopupTime',nowTime);
+		}
     }
     this.isManager = this.$checkAccess.isManager();
     // 没有数据的话,或者请求中,不允许刷新