Explorar el Código

feat: 荣誉数量

EvilDragon hace 3 meses
padre
commit
bea71d576a

+ 1 - 0
packages/app/src/core/libs/net-images.ts

@@ -12,4 +12,5 @@ export enum NetImages {
   Stars = 'https://image.zhuchaohui.com/zhucaohui/dc15a86a2034ddc17e2825b56319902af1635c20e065919750ebbe51ee95f635.png',
   HonorsHeader = 'https://image.zhuchaohui.com/zhucaohui/3945d2a7643317aca126c4b766139c4560c6ce2c051b7e03ee0ac664abe966c3.png',
   CyclingRankingsHeaderBg = 'https://image.zhuchaohui.com/zhucaohui/2351014a57a0df427516c4993876ade7e3695ce33b1f227c52c8381aa631ba02.png',
+  HonorsLogo = 'https://image.zhuchaohui.com/zhucaohui/109805f7e6a8866e6484eea793de572e97cde85c5d65a2f514cf66aacc41609d.svg',
 }

+ 8 - 0
packages/app/src/core/libs/requests.ts

@@ -926,6 +926,14 @@ export const getBadges = (query = {}) =>
 export const getCertificates = (query = {}) =>
   httpGet<Certificate[]>('/app-api/member/stylist-honor/get-certificate-list')
 /**
+ * 获取荣誉统计
+ */
+export const getHonorStatistics = () =>
+  httpGet<{
+    certCount: number
+    badgeCount: number
+  }>('/app-api/member/stylist-honor/get-honor-count')
+/**
  * 获取骑行下拉
  */
 export const getRidingOptions = () =>

+ 8 - 25
packages/app/src/pages/mine/honors/index.vue

@@ -10,7 +10,7 @@
 import NavbarEvo from '@/components/navbar-evo.vue'
 import Card from '@/components/card.vue'
 import SectionHeading from '@/components/section-heading.vue'
-import { getBadges, getCertificates } from '../../../core/libs/requests'
+import { getBadges, getCertificates, getHonorStatistics } from '../../../core/libs/requests'
 import { useRouter } from '../../../core/utils/router'
 import arcBottom from '@designer-hub/assets/src/libs/assets/arcBottom'
 import { NetImages } from '../../../core/libs/net-images'
@@ -22,32 +22,15 @@ const tabs = ref([
   { label: '徽章', value: 'badge' },
   { label: '证书', value: 'certificate' },
 ])
-// 游学徽章,活动徽章,积分徽章,典藏勋章,传播徽章,打卡徽章,课程徽章
-const badgeTypes = ref([
-  { label: '游学徽章', value: '游学徽章' },
-  { label: '活动徽章', value: '活动徽章' },
-  { label: '积分徽章', value: '积分徽章' },
-  { label: '典藏勋章', value: '典藏勋章' },
-  { label: '传播徽章', value: '传播徽章' },
-  { label: '打卡徽章', value: '打卡徽章' },
-  { label: '课程徽章', value: '课程徽章' },
-])
-const { data: badges, run: setBadges } = useRequest(
-  () =>
-    // Promise.all(badgeTypes.value.map((it) => getBadges({}))).then((res) => ({
-    //   data: res,
-    //   code: 0,
-    //   msg: 'ok',
-    // })),
-    getBadges({}),
-  {
-    initialData: {},
-  },
-)
+const { data: statistics, run: setStatistics } = useRequest(() => getHonorStatistics())
+const { data: badges, run: setBadges } = useRequest(() => getBadges({}), {
+  initialData: {},
+})
 const { data: certificates, run: setCertificates } = useRequest(() => getCertificates({}), {
   initialData: [],
 })
 onMounted(async () => {
+  await setStatistics()
   await setBadges()
   await setCertificates()
   console.log(badges.value)
@@ -72,8 +55,8 @@ onMounted(async () => {
         <div class="mt-4 flex justify-between">
           <template
             v-for="(it, i) in [
-              { label: '获得徽章', value: 10, unit: '枚' },
-              { label: '获得证书', value: 10, unit: '个' },
+              { label: '获得徽章', value: statistics?.badgeCount, unit: '枚' },
+              { label: '获得证书', value: statistics?.certCount, unit: '个' },
             ]"
             :key="i"
           >

+ 25 - 7
packages/app/src/pages/mine/index.vue

@@ -15,10 +15,11 @@ import {
   storeAndPunchIn,
   getAppMemberLevelConfigs,
   getCircleTaskStatus,
+  getHonorStatistics,
 } from '../../core/libs/requests'
 import { useUserStore } from '../../store'
 import { storeToRefs } from 'pinia'
-import { isEmpty } from 'radash'
+import { isEmpty, set } from 'radash'
 import TasksCard from './components/tasks-card.vue'
 import { useRouter } from '../../core/utils/router'
 import { NetImages } from '../../core/libs/net-images'
@@ -80,6 +81,7 @@ const { data: designerInfo, run: setDesignerInfo } = useRequest(
 const { data: levelConfigs, run: setLevelConfigs } = useRequest(() => getAppMemberLevelConfigs(), {
   initialData: [],
 })
+const { data: statistics, run: setStatistics } = useRequest(() => getHonorStatistics())
 const menus = ref([
   { title: '积分明细', icon: integral, path: '/pages/mine/points/index' },
   { title: '优惠券包', icon: coupon, path: '/pages/mine/coupons/index' },
@@ -208,7 +210,7 @@ onShow(async () => {
       ...userInfo.value,
       ...data.value,
     })
-    await Promise.all([setDesignerInfo(), getTaskData(), setTaskStatus()])
+    await Promise.all([setDesignerInfo(), getTaskData(), setTaskStatus(), setStatistics()])
     console.log(taskStatusData.value)
   }
 })
@@ -246,11 +248,27 @@ onPageScroll(({ scrollTop }: { scrollTop: number }) => {
       <div class="my-6.5 px-3.5 flex">
         <img class="w-[72px] h-[72px] rounded-full border border-white" :src="avatar" />
         <div class="ms-3.5 ml-3.5">
-          <div
-            class="text-white text-xl font-normal font-['PingFang_SC'] leading-normal"
-            @click="nickNameClickHandle"
-          >
-            {{ !isLogined ? '请点击登录' : userInfo?.nickname }}
+          <div class="flex items-center gap-1.25">
+            <div
+              class="text-white text-xl font-normal font-['PingFang_SC'] leading-normal"
+              @click="nickNameClickHandle"
+            >
+              {{ !isLogined ? '请点击登录' : userInfo?.nickname }}
+            </div>
+            <div>
+              <div class="w-[76px] h-6 relative">
+                <div
+                  class="w-[76px] h-[18px] left-3 pl-1 top-[1.5px] absolute bg-[#4f4b42] rounded-[3px] border border-solid border-[#a89f89]"
+                >
+                  <div
+                    class="text-center text-[#f2e3c4] text-xs font-normal font-['PingFang_SC'] leading-normal"
+                  >
+                    荣誉徽章:{{ statistics?.badgeCount }}
+                  </div>
+                </div>
+                <wd-img width="23" height="23" :src="NetImages.HonorsLogo"></wd-img>
+              </div>
+            </div>
           </div>
           <div
             v-if="!isCertified"