index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <route lang="json">
  2. {
  3. "style": {
  4. "navigationBarTitleText": "我的荣誉",
  5. "navigationStyle": "custom"
  6. }
  7. }
  8. </route>
  9. <script setup lang="ts">
  10. import NavbarEvo from '@/components/navbar-evo.vue'
  11. import Card from '@/components/card.vue'
  12. import SectionHeading from '@/components/section-heading.vue'
  13. import { getBadges, getCertificates, getHonorStatistics } from '../../../core/libs/requests'
  14. import { useRouter } from '../../../core/utils/router'
  15. import arcBottom from '@designer-hub/assets/src/libs/assets/arcBottom'
  16. import { NetImages } from '../../../core/libs/net-images'
  17. import ProgressEvo from '@/components/progress-evo.vue'
  18. const router = useRouter()
  19. const active = ref('badge')
  20. const tabs = ref([
  21. { label: '徽章', value: 'badge' },
  22. { label: '证书', value: 'certificate' },
  23. ])
  24. const { data: statistics, run: setStatistics } = useRequest(() => getHonorStatistics())
  25. const { data: badges, run: setBadges } = useRequest(() => getBadges({}), {
  26. initialData: {},
  27. })
  28. const { data: certificates, run: setCertificates } = useRequest(() => getCertificates({}), {
  29. initialData: [],
  30. })
  31. onMounted(async () => {
  32. await setStatistics()
  33. await setBadges()
  34. await setCertificates()
  35. console.log(badges.value)
  36. })
  37. </script>
  38. <template>
  39. <div class="flex-grow bg-gradient-to-b from-[#181614] to-[#0f0f0f] flex flex-col gap-4 p-3.5">
  40. <div class="aspect-[1.63/1] m--3.5 overflow-hidden relative">
  41. <wd-img width="100%" mode="widthFix" :src="NetImages.HonorsHeader"></wd-img>
  42. <div class="absolute left-7 bottom-6.5">
  43. <div
  44. class="text-white text-3xl font-bold font-['Alimama_ShuHeiTi'] leading-relaxed pr-2.5"
  45. style="
  46. background: linear-gradient(92deg, #fff 0.4%, #ffebb2 107.42%);
  47. -webkit-background-clip: text;
  48. background-clip: text;
  49. -webkit-text-fill-color: transparent;
  50. "
  51. >
  52. 荣誉主页
  53. </div>
  54. <div class="mt-4 flex justify-between">
  55. <template
  56. v-for="(it, i) in [
  57. { label: '获得徽章', value: statistics?.badgeCount, unit: '枚' },
  58. { label: '获得证书', value: statistics?.certCount, unit: '个' },
  59. ]"
  60. :key="i"
  61. >
  62. <div class="flex flex-col items-center gap-1.25">
  63. <div
  64. class="text-center text-[#f6e8da]/80 text-xs font-normal font-['PingFang_SC'] leading-snug"
  65. >
  66. {{ it.label }}
  67. </div>
  68. <div class="flex items-end gap-1">
  69. <div class="text-center text-white text-2xl font-medium font-['DIN'] leading-6">
  70. {{ it.value }}
  71. </div>
  72. <div
  73. class="text-center text-[#f6e8da]/80 text-xs font-normal font-['PingFang_SC'] leading-snug"
  74. >
  75. {{ it.unit }}
  76. </div>
  77. </div>
  78. </div>
  79. </template>
  80. </div>
  81. </div>
  82. </div>
  83. <NavbarEvo dark fixed transparent></NavbarEvo>
  84. <!-- <wd-tabs v-model="active">
  85. <template v-for="(it, i) in tabs" :key="i">
  86. <wd-tab :title="it.label" :name="it.value"></wd-tab>
  87. </template>
  88. </wd-tabs> -->
  89. <div class="flex items-center justify-around">
  90. <template v-for="(it, i) in tabs" :key="i">
  91. <div class="flex flex-col items-center gap-1" @click="active = it.value">
  92. <div
  93. class="text-center font-normal font-['PingFang_SC']"
  94. :class="`${it.value === active ? 'text-white text-lg leading-relaxed ' : 'text-white/60 text-base leading-normal'}`"
  95. >
  96. {{ it.label }}
  97. </div>
  98. <wd-img v-if="it.value === active" width="17" height="5.6" :src="arcBottom"></wd-img>
  99. </div>
  100. </template>
  101. </div>
  102. <template v-if="active === 'badge'">
  103. <Card custom-class="border border-solid bg-[#25221f]! border-[rgba(255,236,185,0.20)]">
  104. <div class="grid grid-cols-[90px_1fr] gap-x-4">
  105. <div class="grid-row-start-1 grid-row-end-4 col-start-1">
  106. <wd-img width="90" height="90" src="https://via.placeholder.com/86x91"></wd-img>
  107. </div>
  108. <div class="row-start-1 col-start-2 flex items-center justify-between">
  109. <div
  110. class="text-center text-[#ffecb9] text-lg font-normal font-['PingFang_SC'] leading-relaxed"
  111. >
  112. 学习大师
  113. </div>
  114. <div
  115. class="h-[26px] px-2.5 rounded-[30px] border border-solid border-[#ffecb9] justify-center items-center gap-2.5 inline-flex"
  116. >
  117. <div
  118. class="text-center text-[#ffecb9] text-xs font-normal font-['PingFang_SC'] leading-relaxed"
  119. >
  120. 获取条件
  121. </div>
  122. </div>
  123. </div>
  124. <div class="row-start-2 col-start-2">
  125. <div
  126. class="text-start text-white/60 text-xs font-normal font-['PingFang_SC'] leading-relaxed"
  127. >
  128. 参加游学解锁典藏徽章
  129. </div>
  130. </div>
  131. <div class="row-start-3 col-start-2 flex items-center gap-4">
  132. <div class="flex-1">
  133. <ProgressEvo
  134. :height="5"
  135. :model-value="0.2 * 100"
  136. color="linear-gradient(90deg, #FFDA72 0%, #FFECB9 100%)"
  137. ></ProgressEvo>
  138. </div>
  139. <div>
  140. <span class="text-white text-xs font-normal font-['PingFang_SC'] leading-none">
  141. 2
  142. </span>
  143. <span class="text-[#a1a1a1] text-xs font-normal font-['PingFang_SC'] leading-none">
  144. /8
  145. </span>
  146. </div>
  147. </div>
  148. <div class="row-start-4 col-start-1 flex items-center justify-center">
  149. <div
  150. class="w-[59px] h-[21px] px-2.5 bg-[#524c3b] rounded-[30px] shadow shadow-inner justify-center items-center gap-0.5 inline-flex"
  151. >
  152. <div
  153. class="text-center text-[#ffecb9] text-[10px] font-normal font-['PingFang_SC'] leading-relaxed"
  154. >
  155. 获取榜
  156. </div>
  157. </div>
  158. </div>
  159. </div>
  160. </Card>
  161. <template v-for="([key, it], index) in Object.entries(badges)" :key="index">
  162. <Card
  163. custom-class="bg-[#171615]! text-white border border-solid border-[rgba(255,236,185,0.20)]"
  164. >
  165. <div class="flex items-center gap-2 py-4">
  166. <div class="w-1.5 h-1.5 bg-[#ffecb9] rounded-full"></div>
  167. <SectionHeading :title="key.toString()" dark></SectionHeading>
  168. </div>
  169. <div class="grid grid-cols-3 gap-y-6">
  170. <template v-for="(item, i) in it" :key="i">
  171. <div
  172. class="w-full px-4 box-border"
  173. @click="router.push(`/pages/mine/honors/detail/index?data=${JSON.stringify(item)}`)"
  174. >
  175. <wd-img
  176. width="100%"
  177. mode="widthFix"
  178. :src="item.quantity ? item.badgeYesObtainedImage : item.badgeNotObtainedImage"
  179. ></wd-img>
  180. <div
  181. class="text-center text-white text-xs font-normal font-['PingFang_SC'] leading-relaxed"
  182. >
  183. <!-- 清华大学 -->
  184. {{ item.badgeName }}
  185. </div>
  186. </div>
  187. </template>
  188. </div>
  189. <!-- {{ it }} -->
  190. </Card>
  191. </template>
  192. </template>
  193. <template v-if="active === 'certificate'">
  194. <div>
  195. <template v-for="(it, i) in certificates" :key="i">
  196. <div class="grid grid-cols-2">
  197. <wd-img width="100%" :src="it.certificateImage" mode="widthFix"></wd-img>
  198. </div>
  199. </template>
  200. </div>
  201. </template>
  202. </div>
  203. </template>