Forráskód Böngészése

feat: 添加侧边栏组件并更新配置

- 添加 WdSidebar 和 WdSidebarItem 组件到组件声明文件
- 更新开发环境和体验版 API 地址配置
- 修复商品列表滚动逻辑,将判断条件从3改为4
- 优化商品分类页面的滚动视图结构和样式
zhangtao 4 napja
szülő
commit
0e1dcea52c

+ 2 - 0
src/components.d.ts

@@ -35,6 +35,8 @@ declare module 'vue' {
     WdRadio: typeof import('wot-design-uni/components/wd-radio/wd-radio.vue')['default']
     WdRadioGroup: typeof import('wot-design-uni/components/wd-radio-group/wd-radio-group.vue')['default']
     WdRate: typeof import('wot-design-uni/components/wd-rate/wd-rate.vue')['default']
+    WdSidebar: typeof import('wot-design-uni/components/wd-sidebar/wd-sidebar.vue')['default']
+    WdSidebarItem: typeof import('wot-design-uni/components/wd-sidebar-item/wd-sidebar-item.vue')['default']
     WdSkeleton: typeof import('wot-design-uni/components/wd-skeleton/wd-skeleton.vue')['default']
     WdSortButton: typeof import('wot-design-uni/components/wd-sort-button/wd-sort-button.vue')['default']
     WdStatusTip: typeof import('wot-design-uni/components/wd-status-tip/wd-status-tip.vue')['default']

+ 4 - 4
src/config/index.ts

@@ -7,16 +7,16 @@ const mapEnvVersion = {
   // develop: 'http://192.168.0.157:8080',
   // develop: 'http://192.168.1.253:8080',
   // develop: 'http://192.168.1.89:8080', // 田
-  develop: 'http://47.109.84.152:8081',
-  // develop: 'https://smqjh.api.zswlgz.com',
+  // develop: 'http://47.109.84.152:8081',
+  develop: 'https://smqjh.api.zswlgz.com',
   /**
    * 体验版
    */
   // trial: "http://192.168.1.166:8080/jeecg-boot",
   // trial: 'http://192.168.0.157:8080',
-  // trial: 'http://47.109.84.152:8081',
+  trial: 'http://47.109.84.152:8081',
   // trial: 'http://192.168.1.166:8080',
-  trial: 'https://smqjh.api.zswlgz.com',
+  // trial: 'https://smqjh.api.zswlgz.com',
   /**
    * 正式版
    */

+ 70 - 71
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -107,7 +107,6 @@ async function getProductList() {
     },
   })
   productList.value = res.data
-  console.log(isTopLoading.value, '=====================')
   if (!res.data.length) {
     scrollTop.value = undefined
     nextTick(() => {
@@ -115,17 +114,15 @@ async function getProductList() {
     })
   }
   if (!isTopLoading.value) {
-    goodsInTo.value = null
+    scrollTop.value = undefined
     nextTick(() => {
-      goodsInTo.value = res.data.length > 3 ? res.data[0].prodId : null
+      scrollTop.value = 0
     })
   }
   else {
     goodsInTo.value = null
-
     nextTick(() => {
       goodsInTo.value = res.data.length > 4 ? res.data[res.data.length - 4].prodId : null
-      console.log(goodsInTo.value, 'goodsInTo.value=============')
     })
   }
   goodsLoading.value = 'finished'
@@ -464,92 +461,94 @@ function handlePay() {
             <wd-sort-button v-model="sortClassBtn" :line="false" title="价格" />
           </view>
         </view>
-        <scroll-view
-          :lower-threshold="100"
-          :refresher-triggered="isTopLoading" :scroll-top="scrollTop"
-          :style="{ height: `calc(100vh - ${navHeight} - 700rpx)` }" enable-passive scroll-y scroll-anchoring refresher-enabled :throttle="false"
-          :scroll-into-view="`class${goodsInTo}`"
-          class="relative"
-          @refresherrefresh="handleSrollTop"
-          @scrolltolower="handlScrollBottom"
-        >
-          <view v-if="productList.length" class="p20rpx">
-            <view v-for="item in productList" :id="`class${item.prodId}`" :key="item.id" class="relative">
-              <view class="flex" @click="handleGo(item)">
-                <view class="mr20rpx h172rpx w172rpx flex-shrink-0 overflow-hidden rounded-16rpx bg-#F6F6F6">
-                  <image :src="item.pic" lazy-load class="h-full w-full" />
-                </view>
-                <view class="flex-1">
-                  <view class="text-left text-28rpx font-semibold">
-                    <!-- <view v-for="i in 2" :key="i" class="mr5px inline-block">
+        <view class="relative">
+          <scroll-view
+            :lower-threshold="100"
+            :refresher-triggered="isTopLoading" :scroll-top="scrollTop"
+            :style="{ height: `calc(100vh - ${navHeight} - 700rpx)` }" enable-passive scroll-y scroll-anchoring refresher-enabled :throttle="false"
+            :scroll-into-view="`class${goodsInTo}`"
+
+            @refresherrefresh="handleSrollTop"
+            @scrolltolower="handlScrollBottom"
+          >
+            <view v-if="productList.length" class="p20rpx">
+              <view v-for="item in productList" :id="`class${item.prodId}`" :key="item.id" class="relative">
+                <view class="flex" @click="handleGo(item)">
+                  <view class="mr20rpx h172rpx w172rpx flex-shrink-0 overflow-hidden rounded-16rpx bg-#F6F6F6">
+                    <image :src="item.pic" lazy-load class="h-full w-full" />
+                  </view>
+                  <view class="flex-1">
+                    <view class="text-left text-28rpx font-semibold">
+                      <!-- <view v-for="i in 2" :key="i" class="mr5px inline-block">
                       <wd-tag type="primary">
                         新品{{ i }}
                       </wd-tag>
                     </view> -->
-                    {{ item.prodName }}
-                  </view>
-                  <view class="text-22rpx text-#AAAAAA">
-                    <view class="mt10rpx flex items-center">
-                      <view>{{ item.spec }}</view>
-                    </view>
-                    <view class="mt6rpx">
-                      已售 {{ item.soldNum }}+
-                    </view>
-                  </view>
-                  <view class="flex items-center justify-between">
-                    <view class="text-#FF4D3A font-semibold">
-                      <text class="text-24rpx">
-                        ¥
-                      </text> <text class="text-36rpx">
-                        {{ item.channelProdPrice }}
-                      </text>
+                      {{ item.prodName }}
                     </view>
-                    <view v-if="!item.num">
-                      <view v-if="item.spuStock" @click.stop="handleAddCart($event, item)">
-                        <image :src="`${StaticUrl}/cart-yes.png`" class="h52rpx w52rpx" />
+                    <view class="text-22rpx text-#AAAAAA">
+                      <view class="mt10rpx flex items-center">
+                        <view>{{ item.spec }}</view>
                       </view>
-                      <view v-else>
-                        <image :src="`${StaticUrl}/cart-no.png`" class="h52rpx w52rpx" />
+                      <view class="mt6rpx">
+                        已售 {{ item.soldNum }}+
                       </view>
                     </view>
-                    <view v-else>
-                      <view class="flex items-center">
-                        <image
-                          :src="` ${StaticUrl}/sub-cart.png`"
-                          class="h44rpx w44rpx"
-                          @click.stop="handleSubCart($event, item)"
-                        />
-                        <view class="box-border h44rpx w84rpx flex items-center justify-center border border-#F0F0F0 border-solid text-24rpx text-#AAAAAA">
-                          {{ item.num }}
+                    <view class="flex items-center justify-between">
+                      <view class="text-#FF4D3A font-semibold">
+                        <text class="text-24rpx">
+                          ¥
+                        </text> <text class="text-36rpx">
+                          {{ item.channelProdPrice }}
+                        </text>
+                      </view>
+                      <view v-if="!item.num">
+                        <view v-if="item.spuStock" @click.stop="handleAddCart($event, item)">
+                          <image :src="`${StaticUrl}/cart-yes.png`" class="h52rpx w52rpx" />
+                        </view>
+                        <view v-else>
+                          <image :src="`${StaticUrl}/cart-no.png`" class="h52rpx w52rpx" />
+                        </view>
+                      </view>
+                      <view v-else>
+                        <view class="flex items-center">
+                          <image
+                            :src="` ${StaticUrl}/sub-cart.png`"
+                            class="h44rpx w44rpx"
+                            @click.stop="handleSubCart($event, item)"
+                          />
+                          <view class="box-border h44rpx w84rpx flex items-center justify-center border border-#F0F0F0 border-solid text-24rpx text-#AAAAAA">
+                            {{ item.num }}
+                          </view>
+                          <image
+                            :src="` ${StaticUrl}/add-cart.png`"
+                            class="h44rpx w44rpx"
+                            @click.stop="handleAddCart($event, item)"
+                          />
                         </view>
-                        <image
-                          :src="` ${StaticUrl}/add-cart.png`"
-                          class="h44rpx w44rpx"
-                          @click.stop="handleAddCart($event, item)"
-                        />
                       </view>
                     </view>
                   </view>
                 </view>
-              </view>
-              <view class="line">
-                <wd-divider color="#F0F0F0" />
-              </view>
-              <view v-if="!item.spuStock" class="absolute left-0 top-0 z-1 h-full w-full flex items-center bg-[rgba(255,255,255,.6)]">
-                <view class="h172rpx w172rpx flex items-center justify-center">
-                  <view class="h36rpx w112rpx flex items-center justify-center rounded-16rpx bg-[rgba(0,0,0,.6)] text-28rpx text-white">
-                    已售罄
+                <view class="line">
+                  <wd-divider color="#F0F0F0" />
+                </view>
+                <view v-if="!item.spuStock" class="absolute left-0 top-0 z-1 h-full w-full flex items-center bg-[rgba(255,255,255,.6)]">
+                  <view class="h172rpx w172rpx flex items-center justify-center">
+                    <view class="h36rpx w112rpx flex items-center justify-center rounded-16rpx bg-[rgba(0,0,0,.6)] text-28rpx text-white">
+                      已售罄
+                    </view>
                   </view>
                 </view>
               </view>
             </view>
-          </view>
-          <wd-status-tip v-else image="content" tip="暂无内容" />
-          <view v-if="goodsLoading == 'finished' || isTopLoading" class="h-30vh" />
+            <wd-status-tip v-else image="content" tip="暂无内容" />
+            <view v-if="goodsLoading == 'finished' || isTopLoading" class="h-30vh" />
+          </scroll-view>
           <view v-if="goodsLoading == 'loading' || isTopLoading" class="absolute left-0 top-0 z-10 h-full w-full flex items-center justify-center bg-white">
             <wd-loading color="#9ED605" :size="20" />
           </view>
-        </scroll-view>
+        </view>
       </view>
     </view>
     <view