浏览代码

fix: 首页ai提示顺序放在广告弹窗之后

cuiyalong 5 月之前
父节点
当前提交
c5f0631aeb
共有 2 个文件被更改,包括 59 次插入31 次删除
  1. 12 2
      apps/mobile/src/views/identity/components/CheckUserDialog.vue
  2. 47 29
      apps/mobile/src/views/tabbar/Home.vue

+ 12 - 2
apps/mobile/src/views/identity/components/CheckUserDialog.vue

@@ -1,13 +1,14 @@
 <template>
-  <div class="check-user-dialog" v-if="isLogin">
+  <div v-if="isLogin" class="check-user-dialog">
     <CheckVipExpire @loaded="onVipCheckLoaded" @change="onVipCheckChange" />
     <CheckPowerAndSwitch v-if="checkPowerShow" />
   </div>
 </template>
+
 <script>
+import { mapGetters } from 'vuex'
 import CheckPowerAndSwitch from '@/views/identity/components/CheckPowerAndSwitch'
 import CheckVipExpire from '@/views/identity/components/CheckVipExpire'
-import { mapGetters } from 'vuex'
 
 export default {
   name: 'CheckUserDialog',
@@ -34,9 +35,18 @@ export default {
     onVipCheckLoaded({ show }) {
       this.vipCheck.loaded = true
       this.vipCheck.show = show
+      this.$nextTick(() => {
+        // vip检查初始化完成后,发现powerSwitch也不需要弹出
+        if (!show) {
+          this.onInitNext()
+        }
+      })
     },
     onVipCheckChange({ show }) {
       this.vipCheck.show = show
+    },
+    onInitNext() {
+      this.$emit('initNext')
     }
   }
 }

+ 47 - 29
apps/mobile/src/views/tabbar/Home.vue

@@ -13,7 +13,7 @@
         <img
           src="@/assets/image/public/logo-text-transparent-bg@2x.png"
           alt=""
-        />
+        >
       </div>
     </h5>
     <!-- 搜索框 -->
@@ -108,7 +108,7 @@
       @close="closeNewUserPop"
       @load="toggleMessagePopShow(false)"
     />
-    <CheckUserDialog v-if="dialog.checkUserShow" />
+    <CheckUserDialog v-if="dialog.checkUserShow" @initNext="onInitNextDialog3" />
     <!-- 新注册用户底部悬浮广告位 -->
     <!-- <div class="new-user--pop-bottom" :class="{ 'has-wx': $envs.inWX }" v-if="isLogin && newUserPopConfig.showBottomPop && AD.newUserPopOfBottom.pic">
       <ad-single class="subscribe-top-box" :config="AD.newUserPopOfBottom"  :before-open="beforeOpenNewUserAD"  :show-tag="false" @close="closeNewUserPopOfBottom" @load="toggleMessagePopShow(false)"></ad-single>
@@ -261,16 +261,17 @@ export default {
       const { inAppOrH5 } = this.$envs
       if (this.isLogin) {
         return inAppOrH5
-      } else {
+      }
+      else {
         return false
       }
     },
     showMiniProgramAppBottomAd() {
       const envPass = this.$envs.inWxMini
       return (
-        envPass &&
-        this.AD.checkSubscribeConfig.pic &&
-        this.dialog.followFollowGuide
+        envPass
+        && this.AD.checkSubscribeConfig.pic
+        && this.dialog.followFollowGuide
       )
     },
     getHeaderAD() {
@@ -299,7 +300,6 @@ export default {
     this.showNoLoginHeader()
     this.setPageTdk()
     this.getConfigurationApi()
-    this.checkAIGuidePopover()
   },
   beforeRouteLeave(to, from, next) {
     this.toggleMessagePopShow(false)
@@ -348,7 +348,8 @@ export default {
       const cache = this.$storage.get(key, false)
       if (cache) {
         // do something
-      } else {
+      }
+      else {
         this.showAIGuidePopover = true
         this.$storage.set(key, '1')
       }
@@ -358,17 +359,19 @@ export default {
       if (code === 0) {
         const thisTime = Math.round(new Date() / 1000)
         if (
-          thisTime >= data?.bulletFrameStart &&
-          thisTime <= data?.bulletFrameEnd
+          thisTime >= data?.bulletFrameStart
+          && thisTime <= data?.bulletFrameEnd
         ) {
           this.showTutorial = true
-        } else {
+        }
+        else {
           this.showTutorial = false
         }
       }
     },
     async checkSubscribe() {
-      if (!this.$envs.inWxMini) return
+      if (!this.$envs.inWxMini)
+        return
       const { error_code: code, data } = await getSubscribeStatus()
       if (code === 0 && data) {
         const r = {
@@ -421,9 +424,11 @@ export default {
       }
     },
     onInitNextDialog() {
-      console.log('==========')
       this.dialog.checkUserShow = true
     },
+    onInitNextDialog3() {
+      this.checkAIGuidePopover()
+    },
     showNoLoginHeader() {
       if (!this.isLogin && this.$envs.inAppOrH5) {
         this.$route.meta.header = true
@@ -457,9 +462,11 @@ export default {
       }
     },
     checkCacheToSearch() {
-      if (!this.isLogin) return false
+      if (!this.isLogin)
+        return false
       const { toSearch } = this.cacheState
-      if (!toSearch) return false
+      if (!toSearch)
+        return false
       this.cacheState.toSearch = false
       this.toSearchFocus()
     },
@@ -521,7 +528,8 @@ export default {
           storage.data.newUserPopConfig.showBottomPop = false
           storage.data.AD.newUserPop = {}
           storage.data.AD.newUserPopOfBottom = {}
-        } catch (e) {}
+        }
+        catch (e) {}
         Object.assign(this._data, storage.data)
         this.$storage.rm(this._CACHE_KEY, {
           login: true
@@ -530,7 +538,8 @@ export default {
           this.$forceUpdate()
           this.$refs['home-page'].scrollTop = storage.top
         })
-      } else {
+      }
+      else {
         // 限制刷新频率
         const nowTime = new Date().getTime()
         const maxUpdateTime = 5 * 1000
@@ -608,7 +617,8 @@ export default {
      * @param codes
      */
     getAD() {
-      if (!this.isLogin) return
+      if (!this.isLogin)
+        return
       // 获取消息悬浮信息
       this.toggleMessagePopShow(true)
       // 获取新用户弹窗广告信息
@@ -619,7 +629,7 @@ export default {
         // this.getPlatformAD.header,
         this.getPlatformAD.swipe,
         this.getPlatformAD.floor
-      ].filter((v) => v)
+      ].filter(v => v)
       ajaxGetAD({
         codes
       })
@@ -638,18 +648,21 @@ export default {
 
             if (header.length) {
               this.AD.header = header.map(adConfigFormatter)[0]
-            } else {
+            }
+            else {
               this.AD.header = {}
             }
             if (full?.length) {
               this.AD.full = full.map(adConfigFormatter)[0]
-            } else {
+            }
+            else {
               this.onInitNextDialog()
               this.AD.full = {}
             }
             if (side.length) {
               this.AD.side = side.map(adConfigFormatter)[0]
-            } else {
+            }
+            else {
               this.AD.side = {}
             }
           }
@@ -671,7 +684,8 @@ export default {
             this.toggleMessagePopShow(false)
             this.AD.newUserPop = res.data.map(adConfigFormatter)[0]
             this.AD.newUserPopOfBottom = res.data.map(adConfigFormatter)[1]
-          } else {
+          }
+          else {
             this.clearNewUserPopCache()
           }
         })
@@ -704,10 +718,12 @@ export default {
           wx.miniProgram.navigateTo({
             url: '/pages/guide/index' // 指定要跳转到的页面路径及参数
           })
-        } catch (error) {
+        }
+        catch (error) {
           console.log(error)
         }
-      } else {
+      }
+      else {
         this.$router.push({
           path: '/static/follow_guide'
         })
@@ -724,7 +740,8 @@ export default {
       if (isClose) {
         this.newUserPopConfig.showNextFullPop = true
         this.newUserPopConfig.showBottomPop = true
-      } else {
+      }
+      else {
         this.clearNewUserPopCache()
       }
     },
@@ -752,8 +769,8 @@ export default {
       if (type) {
         // 判断是否展示有其他广告位
         if (
-          this.newUserPopConfig.showNextFullPop ||
-          this.newUserPopConfig.showBottomPop
+          this.newUserPopConfig.showNextFullPop
+          || this.newUserPopConfig.showBottomPop
         ) {
           return
         }
@@ -776,7 +793,8 @@ export default {
     getNowMessagePopInfo() {
       try {
         window.getMsgBuoyActive.getBuoyMsgAjax()
-      } catch (e) {
+      }
+      catch (e) {
         console.warn(e)
       }
     },