Преглед изворни кода

feat: 添加StatusTip组件并替换现有状态提示

添加了新的StatusTip组件作为全局组件,并在多个页面中将原有的
wd-status-tip替换为新的StatusTip组件以统一状态提示功能。

- 新增StatusTip.vue组件,封装wd-status-tip基础组件
- 在components.d.ts中注册StatusTip为全局组件
- 替换addressList、afterSalesList、integral、order等页面中的
  wd-status-tip为StatusTip组件
- 统一状态提示组件的使用方式,移除硬编码的图片配置
zhangtao пре 2 дана
родитељ
комит
a3c57636d3

+ 1 - 0
src/components.d.ts

@@ -12,6 +12,7 @@ declare module 'vue' {
     GlobalMessage: typeof import('./components/GlobalMessage.vue')['default']
     GlobalToast: typeof import('./components/GlobalToast.vue')['default']
     PrivacyPopup: typeof import('./components/PrivacyPopup.vue')['default']
+    StatusTip: typeof import('./components/StatusTip.vue')['default']
     WdBadge: typeof import('wot-design-uni/components/wd-badge/wd-badge.vue')['default']
     WdButton: typeof import('wot-design-uni/components/wd-button/wd-button.vue')['default']
     WdCard: typeof import('wot-design-uni/components/wd-card/wd-card.vue')['default']

+ 24 - 0
src/components/StatusTip.vue

@@ -0,0 +1,24 @@
+<script setup lang="ts">
+import { statusTipProps } from 'wot-design-uni/components/wd-status-tip/types'
+import { StaticUrl } from '@/config'
+
+const props = defineProps({ ...statusTipProps, image: { type: String, default: '' }, imageSize: { type: String, default: '100rpx' } })
+const imgs = computed(() => {
+  if (props.image)
+    return `${StaticUrl}/${props.image}`
+  return `${StaticUrl}/status-tip.png`
+})
+</script>
+
+<template>
+  <wd-status-tip v-bind="props">
+    <template #image>
+      <image
+        :style="{ width: imageSize, height: imageSize }"
+        :src="imgs"
+      />
+    </template>
+  </wd-status-tip>
+</template>
+
+<style lang="scss" scoped></style>

+ 1 - 1
src/subPack-common/addressList/index.vue

@@ -73,7 +73,7 @@ async function handleEditAddress(item: Api.addressList) {
         </view>
         <view class="ios h120rpx" />
       </wd-radio-group>
-      <wd-status-tip v-if="!addresses.length" image="content" tip="暂无内容" />
+      <StatusTip v-if="!addresses.length" tip="暂无内容" />
     </view>
 
     <view class="ios fixed bottom-0 left-0 box-border w-full rounded-t-32rpx bg-white px24rpx">

+ 1 - 1
src/subPack-common/afterSalesList/index.vue

@@ -85,7 +85,7 @@ async function handleCancel(item: Api.AppRefundOrderListVo) {
         </wd-button>
       </view>
     </view>
-    <wd-status-tip v-if="!refundList.length" image="content" tip="暂无内容" />
+    <StatusTip v-if="!refundList.length" tip="暂无内容" />
   </view>
 </template>
 

+ 1 - 1
src/subPack-common/integral/index.vue

@@ -77,7 +77,7 @@ function handleScrollBottom() {
         </view>
         <view v-if="index < pointList.length - 1" class="mt24rpx h-2rpx w-full bg-#F0F0F0" />
       </view>
-      <wd-status-tip v-if="!pointList.length" image="content" tip="暂无内容" />
+      <StatusTip v-if="!pointList.length" tip="暂无内容" />
     </scroll-view>
   </view>
 </template>

+ 1 - 1
src/subPack-smqjh/order/index.vue

@@ -225,7 +225,7 @@ async function handleAfterSale(item: Api.xsbOrderList) {
           </template>
         </view>
       </view>
-      <wd-status-tip v-if="!orderList.length" image="content" tip="暂无内容" />
+      <StatusTip v-if="!orderList.length" tip="暂无内容" />
     </view>
     <view class="h-20rpx" />
   </view>

+ 2 - 2
src/subPack-xsb/commonTab/components/classfiy.vue

@@ -550,7 +550,7 @@ function handlePay() {
                 </view>
               </view>.
             </view>
-            <wd-status-tip v-else image="content" tip="暂无内容" />
+            <StatusTip v-else tip="暂无内容" />
             <view v-if="goodsLoading == 'finished' || isTopLoading" class="h-40vh" />
           </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">
@@ -647,7 +647,7 @@ function handlePay() {
             </view>
           </view>
         </view>
-        <wd-status-tip v-if="!cartList.length" image="content" tip="暂无内容" />
+        <StatusTip v-if="!cartList.length" tip="暂无内容" />
 
         <view class="h320rpx" />
       </view>

+ 1 - 1
src/subPack-xsb/order/index.vue

@@ -209,7 +209,7 @@ async function handleAfterSale(item: Api.xsbOrderList) {
         </view>
       </view>
     </view>
-    <wd-status-tip v-if="!orderList.length" image="content" tip="暂无内容" />
+    <StatusTip v-if="!orderList.length" tip="暂无内容" />
     <view class="h-20rpx" />
   </view>
 </template>

+ 1 - 1
src/subPack-xsb/search/index.vue

@@ -177,7 +177,7 @@ function handleSearchText(text: string) {
         </view>
       </view>
       <wd-loadmore v-if="data.length" :state="state" :loading-props="{ color: '#9ED605', size: 20 }" />
-      <wd-status-tip v-if="!data.length" image="search" tip="当前搜索无结果" />
+      <StatusTip v-if="!data.length" tip="当前搜索无结果" />
     </view>
     <view class="h30rpx" />
   </view>