Browse Source

fix(types): 修复模板中过滤和映射的类型声明问题

- 在多个 v-for 表达式中添加了 (i: any) 和 (it: any) 的类型断言
- 修正热搜词数据映射时的类型声明 (it: Api.xsbSearchTerm)
- 统一过滤和映射函数中的参数类型声明,避免类型错误
- 删除 manifest 配置中关于 router 的相关注释和字段
- 清理 iconfont CSS 中冗余的字体格式声明
- 调整 sys 模块中获取 accessId 的逻辑,添加调试日志,简化路径处理
zhangtao 1 ngày trước cách đây
mục cha
commit
139cf65327

+ 3 - 3
manifest.config.ts

@@ -88,9 +88,9 @@ export default defineManifestConfig({
   'h5': {
     // darkmode: true,
     // themeLocation: 'theme.json',
-    router: {
-      mode: 'history',
-    },
+    // router: {
+    //   mode: 'history',
+    // },
     sdkConfigs: {
       maps: {
         qqmap: {

+ 0 - 2
src/iconfont/index.css

@@ -2,8 +2,6 @@
   font-family: "iconfont"; /* Project id 5175205 */
   src: url('iconfont.woff2?t=1778556699734') format('woff2'),
        url('iconfont.woff?t=1778556699734') format('woff'),
-       url('iconfont.ttf?t=1778556699734') format('truetype'),
-       url('iconfont.svg?t=1778556699734#iconfont') format('svg');
 }
 
 .iconfont {

+ 0 - 3
src/manifest.json

@@ -84,9 +84,6 @@
   },
   "vueVersion": "3",
   "h5": {
-    "router": {
-      "mode": "history"
-    },
     "sdkConfigs": {
       "maps": {
         "qqmap": {

+ 4 - 4
src/pages/index/index.vue

@@ -218,11 +218,11 @@ function handleJyBanner() {
           <!-- h340rpx -->
           <swiper :duration="300" :style="swiperStyle" class="transition-height" @change="handleChangeSwiper">
             <swiper-item
-              v-for="pageIndex in Math.ceil(navList.filter(i => i.show).length / 8)" :key="pageIndex"
+              v-for="pageIndex in Math.ceil(navList.filter((i: any) => i.show).length / 8)" :key="pageIndex"
             >
               <view class="grid grid-cols-4 gap-12rpx">
                 <template
-                  v-for="item in navList.filter(i => i.show).slice((pageIndex - 1) * 8, pageIndex * 8)"
+                  v-for="item in navList.filter((i: any) => i.show).slice((pageIndex - 1) * 8, pageIndex * 8)"
                   :key="item.icon"
                 >
                   <view
@@ -247,7 +247,7 @@ function handleJyBanner() {
             </swiper-item>
           </swiper>
           <view class="w-full flex items-center justify-center">
-            <view v-for="_pageIndex, index in Math.ceil(navList.filter(i => i.show).length / 8)" :key="index" class="mr14rpx transition-all transition-duration-400 ease-in" :class="[currentIndex == index ? 'rounded-12rpx w-40rpx h12rpx bg-[var(--them-color)]' : 'w12rpx h12rpx rounded-50% bg-#F0F0F0']" />
+            <view v-for="_pageIndex, index in Math.ceil(navList.filter((i: any) => i.show).length / 8)" :key="index" class="mr14rpx transition-all transition-duration-400 ease-in" :class="[currentIndex == index ? 'rounded-12rpx w-40rpx h12rpx bg-[var(--them-color)]' : 'w12rpx h12rpx rounded-50% bg-#F0F0F0']" />
           </view>
         </wd-skeleton>
       </view>
@@ -338,7 +338,7 @@ function handleJyBanner() {
                   </view>
                 </view>
                 <view
-                  v-if="!item.skuList.some((it) => it.saleStatus)"
+                  v-if="!item.skuList.some((it: any) => it.saleStatus)"
                   class="absolute left-0 top-0 z-1 h-full w-full flex items-center justify-center bg-[rgba(255,255,255,0.6)]"
                 >
                   <view

+ 4 - 6
src/store/sys.ts

@@ -133,13 +133,11 @@ export const useSysStore = defineStore('system', {
     },
 
     getAccessIdFromPath() {
-      // 仅在 H5 下从地址路径中提取第一个路径段作为 accessId
-      // #ifdef H5
-      const path = window.location.pathname || ''
-      const cleanPath = path.split('?')[0].replace(/^\//, '')
-      const [accessId] = cleanPath.split('/').filter(Boolean)
+      const pathname = window.location.pathname || ''
+      console.log(pathname, '============pathname============')
+      const [accessId] = pathname.split('/').filter(Boolean)
+      console.log(accessId, '============accessId============')
       return accessId || ''
-      // #endif
     },
 
   },

+ 1 - 1
src/subPack-xsb/commonTab/components/index.vue

@@ -119,7 +119,7 @@ function handleChangeSwiper(e: UniHelper.SwiperOnChangeEvent) {
               <wd-icon name="search" size="14" color="#ccc" />
               <view class="search ml12rpx h-full w-full overflow-hidden">
                 <wd-notice-bar
-                  :text="hotText.map((it) => it.searchName)" custom-class="notice-bar" color="#ccc"
+                  :text="hotText.map((it: Api.xsbSearchTerm) => it.searchName)" custom-class="notice-bar" color="#ccc"
                   background-color="#fff" direction="vertical"
                 />
               </view>