Procházet zdrojové kódy

feat(components): 添加wd-skeleton组件类型声明

添加WdSkeleton组件到components.d.ts类型声明文件中,支持骨架屏组件的类型提示。

---

refactor(config): 更新开发环境配置

修改src/config/index.ts中的开发环境配置,将开发服务器地址切换到192.168.1.242:8080。

---

feat(index): 添加页面分享功能并优化提示信息

在首页添加小程序分享功能,并将提示信息"敬请期待"改为"敬请期待 !"。

---

feat(login): 优化登录后路由跳转逻辑

在登录页面中,当没有重定向参数时,登录成功后返回上一页而不是跳转到默认页面。

---

feat(my): 完善个人中心页面功能

在个人中心页面添加用户登录状态判断,显示用户信息,增加骨架屏组件的类型引用。

---

feat(commonTab): 添加骨架屏组件并优化加载体验

在通用标签组件中添加wd-skeleton骨架屏组件,用于搜索栏和轮播图的加载状态展示,
优化用户体验,并添加loading属性控制显示。

---

feat(myComponent): 同步个人中心功能到我的页面

将个人中心页面的登录状态判断和用户信息显示功能同步到我的页面组件中。

---

feat(search): 修复搜索页面标签激活问题

在搜索页面中,当搜索文本清空时,将活动标签重置为0,修复页面状态问题。
zhangtao před 4 dny
rodič
revize
56d7b498d6

+ 1 - 0
src/components.d.ts

@@ -35,6 +35,7 @@ declare module 'vue' {
     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']
     WdStep: typeof import('wot-design-uni/components/wd-step/wd-step.vue')['default']

+ 2 - 2
src/config/index.ts

@@ -11,10 +11,10 @@ const mapEnvVersion = {
   /**
    * 开发版
    */
-  develop: 'http://192.168.1.166:8080', // 张
+  // develop: 'http://192.168.1.166:8080', // 张
   // develop: 'http://192.168.1.101:8080',
   // develop: 'http://192.168.0.157:8080',
-  // develop: 'http://192.168.1.242:8080',
+  develop: 'http://192.168.1.242:8080',
   /**
    * 体验版
    */

+ 6 - 1
src/pages/index/index.vue

@@ -42,11 +42,16 @@ onPageScroll((e) => {
 })
 function handleClick(name: string) {
   if (!name) {
-    show({ msg: '敬请期待' })
+    show({ msg: '敬请期待 !' })
     return
   }
   router.push({ name })
 }
+onShareAppMessage(() => {
+  return {
+    title: '市民请集合',
+  }
+})
 </script>
 
 <template>

+ 6 - 1
src/pages/login/index.vue

@@ -26,7 +26,12 @@ async function handleGetPhone(e: UniHelper.ButtonOnGetphonenumberDetail) {
       token.value = `Bearer ${data.value.access_token}`
       useGlobalToast().show({ msg: '登录成功' })
       setTimeout(() => {
-        router.replace({ path: redirectName.value })
+        if (redirectName.value) {
+          router.replace({ path: redirectName.value })
+        }
+        else {
+          router.back()
+        }
         useUserStore().getUserInfo()
       }, 2000)
     },

+ 24 - 8
src/pages/my/index.vue

@@ -20,6 +20,7 @@ const tabList = ref([
 onMounted(() => {
   useUserStore().getUserInfo()
 })
+const { token, userInfo } = storeToRefs(useUserStore())
 </script>
 
 <template>
@@ -28,15 +29,30 @@ onMounted(() => {
       title="个人中心" custom-style="background-color: transparent !important;" :bordered="false"
       safe-area-inset-top fixed :z-index="99"
     />
-    <view class="header relative h-408rpx rounded-18px" @click="router.push({ name: 'common-user-center' })">
+    <view class="header relative h-408rpx rounded-18px">
       <view class="absolute bottom-100rpx left-0 box-border w-full flex items-center justify-between pl48rpx pr58rpx">
-        <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx" />
-        <view class="text-32rpx font-semibold">
-          请登录后使用完整功能
-        </view>
-        <wd-button custom-class="login-btn">
-          登录
-        </wd-button>
+        <template v-if="!token">
+          <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx" />
+          <view class="text-32rpx font-semibold">
+            请登录后使用完整功能
+          </view>
+          <wd-button custom-class="login-btn" @click="router.replace({ name: 'smqjh-login' })">
+            登录
+          </wd-button>
+        </template>
+        <template v-else>
+          <view class="flex items-center">
+            <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx flex-shrink-0" />
+            <view class="ml20rpx flex-1">
+              <view class="text-32rpx font-semibold">
+                {{ userInfo.nickName }}
+              </view>
+              <view class="mt12rpx rounded-8rpx bg-white px12rpx py4rpx text-24rpx text-[var(--them-color)] opacity-70">
+                中数未来(广州)信息技术有限公司
+              </view>
+            </view>
+          </view>
+        </template>
       </view>
     </view>
     <view class="relative z-50 -mt48rpx">

+ 72 - 40
src/subPack-xsb/commonTab/components/index.vue

@@ -2,7 +2,7 @@
 import { StaticUrl, VITE_OSS_BASE_URL } from '@/config'
 import router from '@/router'
 
-const props = defineProps<{ categoryList: Api.xsbCategories[], swiper: Api.xsbAdvertInfo[], hotText: Api.xsbSearchTerm[], recommendText: Api.xsbSearchTerm[] }>()
+const props = defineProps<{ categoryList: Api.xsbCategories[], swiper: Api.xsbAdvertInfo[], hotText: Api.xsbSearchTerm[], recommendText: Api.xsbSearchTerm[], loading: boolean }>()
 
 const emit = defineEmits(['changeNav'])
 
@@ -43,9 +43,7 @@ function handleScroll(e: UniHelper.ScrollViewOnScrollEvent) {
 onMounted(() => {
   ScrollDown.value = false
 })
-function handleCommonName(name: string) {
-  router.push({ name })
-}
+
 function handleCommonClass(item: Api.xsbCategories) {
   topNavActive.value = item.code
   leftActive.value = item.children[0].code
@@ -83,23 +81,25 @@ function handleGo(e: { index: number, item: Api.xsbAdvertInfo }) {
         class="header-linear h320rpx px24rpx"
         :style="{ paddingTop: `${(Number(statusBarHeight) || 44) + MenuButtonHeight + 12}px` }"
       >
-        <view class="h60rpx w-full flex items-center justify-between rounded-40rpx bg-white pr6rpx" @click="router.push({ name: 'xsb-search' })">
-          <view class="flex items-center pb14rpx pl24rpx pt16rpx">
-            <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"
-                background-color="#fff" direction="vertical"
-              />
+        <wd-skeleton theme="image" :loading="loading" :row-col="[{ height: '30px', width: '100%' }]">
+          <view class="h60rpx w-full flex items-center justify-between rounded-40rpx bg-white pr6rpx" @click="router.push({ name: 'xsb-search' })">
+            <view class="flex items-center pb14rpx pl24rpx pt16rpx">
+              <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"
+                  background-color="#fff" direction="vertical"
+                />
+              </view>
+            </view>
+            <view
+              class="h50rpx w96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
+            >
+              搜索
             </view>
           </view>
-          <view
-            class="h50rpx w96rpx flex items-center justify-center rounded-26rpx bg-[var(--them-color)] text-24rpx text-white font-semibold"
-          >
-            搜索
-          </view>
-        </view>
-        <scroll-view scroll-x class="mb20rpx mt20rpx h44rpx whitespace-nowrap">
+        </wd-skeleton>
+        <scroll-view v-if="recommendText.length" scroll-x class="mb20rpx mt20rpx h44rpx whitespace-nowrap">
           <view class="h-full flex items-center">
             <view
               v-for="item in recommendText"
@@ -111,30 +111,63 @@ function handleGo(e: { index: number, item: Api.xsbAdvertInfo }) {
           </view>
         </scroll-view>
       </view>
-      <view class="px24rpx -mt180rpx">
-        <wd-swiper
-          :autoplay="false" :list="swiperList" :height="138" :indicator="false" value-key="advertImg" @click="handleGo"
-        />
+
+      <view class="px24rpx" :class="[recommendText.length ? '-mt180rpx' : '-mt240rpx']">
+        <wd-skeleton theme="image" :loading="loading" :row-col="[{ height: '138px', width: '100%' }]">
+          <wd-swiper
+            :autoplay="false" :list="swiperList" :height="138" :indicator="false" value-key="advertImg" @click="handleGo"
+          />
+        </wd-skeleton>
         <view class="mt20rpx">
           <wd-card title="" custom-class="card-zt">
-            <view class="px24rpx pt24rpx">
-              <view class="grid grid-cols-5 gap-x-38rpx gap-y-24rpx">
-                <view v-for="item, index in classfiylist" :key="index" @click="handleCommonClass(item)">
-                  <image :src="item.icon" class="h100rpx w100rpx" />
-                  <view class="mt12rpx text-24rpx text-#222">
-                    {{ item.name }}
+            <view :class="[loading ? 'p24rpx' : '']">
+              <wd-skeleton
+                :loading="loading"
+                theme="image" :row-col="[
+                  [
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                  ],
+                  [
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                  ],
+                  [
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                    { width: '48px', height: '48px' },
+                  ],
+                ]"
+              >
+                <view class="px24rpx pt24rpx">
+                  <view class="grid grid-cols-5 gap-x-38rpx gap-y-24rpx">
+                    <view v-for="item, index in classfiylist" :key="index" @click="handleCommonClass(item)">
+                      <image :src="item.icon" class="h100rpx w100rpx" />
+                      <view class="mt12rpx text-24rpx text-#222">
+                        {{ item.name }}
+                      </view>
+                    </view>
                   </view>
                 </view>
-              </view>
-            </view>
-            <view class="swiper-img swiper pb20rpx">
-              <wd-swiper
-                :list="swiperClassList" :indicator="{ type: 'dots-bar' }" height="80"
-                :display-multiple-items="5" :autoplay="false" :loop="false"
-                custom-indicator-class="custom-indicator-class" value-key="icon" text-key="name"
-                image-mode="aspectFit"
-                @click="handleSwiperClick"
-              />
+
+                <view class="swiper-img swiper pb20rpx">
+                  <wd-swiper
+                    :list="swiperClassList" :indicator="{ type: 'dots-bar' }" height="80"
+                    :display-multiple-items="5" :autoplay="false" :loop="false"
+                    custom-indicator-class="custom-indicator-class" value-key="icon" text-key="name"
+                    image-mode="aspectFit"
+                    @click="handleSwiperClick"
+                  />
+                </view>
+              </wd-skeleton>
             </view>
           </wd-card>
         </view>
@@ -180,7 +213,6 @@ function handleGo(e: { index: number, item: Api.xsbAdvertInfo }) {
                 />
                 <view
                   v-for="it in 20" :key="it" class="overflow-hidden rounded-16rpx bg-white pb16rpx"
-                  @click="handleCommonName('xsb-goods')"
                 >
                   <view class="relative h344rpx">
                     <image

+ 25 - 8
src/subPack-xsb/commonTab/components/my.vue

@@ -17,6 +17,8 @@ const tabList = ref([
   { title: '已完成', icon: `${StaticUrl}/6.png`, name: 'xsb-order' },
   { title: '退款售后', icon: `${StaticUrl}/3.png`, name: 'common-afterSalesList' },
 ])
+
+const { token, userInfo } = storeToRefs(useUserStore())
 </script>
 
 <template>
@@ -25,15 +27,30 @@ const tabList = ref([
       title="个人中心" custom-style="background-color: transparent !important;" :bordered="false"
       safe-area-inset-top fixed :z-index="99"
     />
-    <view class="header relative h-408rpx rounded-18px" @click="router.push({ name: 'common-user-center' })">
+    <view class="header relative h-408rpx rounded-18px">
       <view class="absolute bottom-100rpx left-0 box-border w-full flex items-center justify-between pl48rpx pr58rpx">
-        <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx" />
-        <view class="text-32rpx font-semibold">
-          请登录后使用完整功能
-        </view>
-        <wd-button custom-class="login-btn">
-          登录
-        </wd-button>
+        <template v-if="!token">
+          <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx" />
+          <view class="text-32rpx font-semibold">
+            请登录后使用完整功能
+          </view>
+          <wd-button custom-class="login-btn" @click="router.replace({ name: 'smqjh-login' })">
+            登录
+          </wd-button>
+        </template>
+        <template v-else>
+          <view class="flex items-center">
+            <image :src="`${StaticUrl}/9.png`" alt="" class="h100rpx w100rpx flex-shrink-0" />
+            <view class="ml20rpx flex-1">
+              <view class="text-32rpx font-semibold">
+                {{ userInfo.nickName }}
+              </view>
+              <view class="mt12rpx rounded-8rpx bg-white px12rpx py4rpx text-24rpx text-[var(--them-color)] opacity-70">
+                中数未来(广州)信息技术有限公司
+              </view>
+            </view>
+          </view>
+        </template>
       </view>
     </view>
     <view class="relative z-50 -mt48rpx">

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

@@ -57,15 +57,16 @@ function handleClick() {
 onLoad(() => {
   ScrollDown.value = false
 })
+const loading = ref(true)
 async function getCategories() {
   const res = await Apis.xsb.categories({ data: { shopId: 1, channelId: 1 } })
   commonCategoryData.value = res
   topNavActive.value = res[0].code
   leftActive.value = res[0].children[0].code
+  loading.value = false
 }
 async function getCurrentImg() {
   const res = await Apis.xsb.appAdvertInfo({})
-  console.log(res, '但是')
   swiperList.value = res
 }
 async function getSearchData(type: number) {
@@ -78,6 +79,11 @@ onMounted(async () => {
   hotText.value = await getSearchData(2)
   recommendText.value = await getSearchData(3)
 })
+onShareAppMessage(() => {
+  return {
+    title: '市民请集合',
+  }
+})
 </script>
 
 <template>
@@ -87,6 +93,7 @@ onMounted(async () => {
       :swiper="swiperList"
       :hot-text="hotText"
       :recommend-text="recommendText"
+      :loading="loading"
       @change-nav="tabbarName = 'xsb-classfiy'"
     />
     <cart v-if="tabbarName == 'xsb-cart'" />

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

@@ -53,6 +53,7 @@ function handleSearch() {
 watch(() => searchText.value, () => {
   if (!searchText.value) {
     isSearch.value = false
+    activeTab.value = 0
   }
 })
 onReachBottom(() => {