Prechádzať zdrojové kódy

fix: app更新提示位置修改

liangan 3 týždňov pred
rodič
commit
09e4961f94
2 zmenil súbory, kde vykonal 38 pridanie a 14 odobranie
  1. 0 2
      src/App.vue
  2. 38 12
      src/pages/index/index.vue

+ 0 - 2
src/App.vue

@@ -2,7 +2,6 @@
 import { onHide, onLaunch, onShow } from '@dcloudio/uni-app'
 import { usePageAuth } from '@/hooks/usePageAuth'
 import { useUserStore } from '@/store'
-import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'
 import 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'
 
 const mtpushModule = uni.requireNativePlugin('EL-MTPush')
@@ -86,7 +85,6 @@ onLaunch(() => {
     })
   }
   // app更新
-  checkUpdate()
 })
 onShow(() => {
   console.log('App Show')

+ 38 - 12
src/pages/index/index.vue

@@ -4,8 +4,8 @@
   layout: 'tabbar',
   style: {
     // 'custom' 表示开启自定义导航栏,默认 'default'
-    navigationStyle: 'custom',
-  },
+    navigationStyle: 'custom'
+  }
 }
 </route>
 
@@ -14,9 +14,9 @@
 // eslint-disable-next-line unused-imports/no-unused-imports
 import { onPageScroll, onReachBottom } from '@dcloudio/uni-app'
 import useZPaging from 'z-paging/components/z-paging/js/hooks/useZPaging.js'
-
 import { bannerList, noticeUnread } from '@/api/common'
 import { getList } from '@/api/product'
+import checkUpdate from '@/uni_modules/uni-upgrade-center-app/utils/check-update'
 import { parseQs } from '@/utils'
 import { toPage } from '@/utils/page'
 
@@ -161,11 +161,11 @@ async function getUnread() {
       unread.value = Number(res.data) || 0
     }
   }
-  catch {
-
-  }
+  catch {}
 }
-
+onLoad(() => {
+  checkUpdate()
+})
 onShow(() => {
   getUnread()
   getNewList()
@@ -182,9 +182,17 @@ onShow(() => {
       >
         <image src="/static/header-logo.png" class="h-44rpx w-275rpx" />
         <view class="flex items-center">
-          <image src="/static/icons/search.png" class="mr-20rpx h-36rpx w-36rpx" @click="toPage('/pages/search/search')" />
+          <image
+            src="/static/icons/search.png"
+            class="mr-20rpx h-36rpx w-36rpx"
+            @click="toPage('/pages/search/search')"
+          />
           <wd-badge :model-value="unread" :max="99">
-            <image src="/static/icons/notifications.png" class="h-36rpx w-36rpx" @click="toPage('/pages/notifications/notifications')" />
+            <image
+              src="/static/icons/notifications.png"
+              class="h-36rpx w-36rpx"
+              @click="toPage('/pages/notifications/notifications')"
+            />
           </wd-badge>
         </view>
       </view>
@@ -200,7 +208,12 @@ onShow(() => {
     />
     <view class="px-24rpx pb-24rpx">
       <view class="flex items-end justify-between pb-22rpx pt-24rpx">
-        <view v-for="(item, index) in navIcons" :key="index" class="flex flex-col items-center" @click="toPage(item.url)">
+        <view
+          v-for="(item, index) in navIcons"
+          :key="index"
+          class="flex flex-col items-center"
+          @click="toPage(item.url)"
+        >
           <image :src="item.image" :style="`width: ${item.size}; height: ${item.size};`" />
           <view class="mt-14rpx whitespace-pre-line text-center text-22rpx text-#898989 font-bold">
             {{ $t(item.title) }}
@@ -213,7 +226,13 @@ onShow(() => {
         </view>
         <scroll-view scroll-x>
           <view class="flex items-center gap-16rpx pb-24rpx">
-            <Product v-for="(item, index) in newProducts" :key="index" :title-font-size="18" :item="item" @item-click="toPage('/pages/productDetail/productDetail', { productId: item.productId })" />
+            <Product
+              v-for="(item, index) in newProducts"
+              :key="index"
+              :title-font-size="18"
+              :item="item"
+              @item-click="toPage('/pages/productDetail/productDetail', { productId: item.productId })"
+            />
           </view>
         </scroll-view>
       </view>
@@ -224,7 +243,14 @@ onShow(() => {
           </template>
         </wd-tabs>
         <view class="grid grid-cols-2 gap-22rpx">
-          <Product v-for="(item, index) in dataList" :key="index" width="100%" :height="340" :item="item" @item-click="toPage('/pages/productDetail/productDetail', { productId: item.productId })" />
+          <Product
+            v-for="(item, index) in dataList"
+            :key="index"
+            width="100%"
+            :height="340"
+            :item="item"
+            @item-click="toPage('/pages/productDetail/productDetail', { productId: item.productId })"
+          />
         </view>
       </view>
     </view>