index.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <route lang="json5">
  2. { layout: 'tabbar', style: { navigationBarTitleText: '我的', navigationStyle: 'custom' } }
  3. </route>
  4. <script setup lang="ts">
  5. import { onMounted, ref } from 'vue'
  6. import CardMenu from '@/components/card-menu.vue'
  7. import SectionHeading from '@/components/section-heading.vue'
  8. import { designer, settled, treaty, vipBg, memberTextV1 } from '../../core/libs/pngs'
  9. import {
  10. integral,
  11. coupon,
  12. order,
  13. agent,
  14. setting,
  15. vip,
  16. scan,
  17. memberIconV1,
  18. } from '../../core/libs/svgs'
  19. import { getMemberUserInfo, getTasks } from '../../core/libs/requests'
  20. import { useUserStore } from '../../store'
  21. import { storeToRefs } from 'pinia'
  22. import { isEmpty } from 'radash'
  23. import TasksCard from './components/tasks-card.vue'
  24. const userStore = useUserStore()
  25. const { isLogined, userInfo } = storeToRefs(userStore)
  26. const { setUserInfo } = userStore
  27. const { data, run } = useRequest(getMemberUserInfo)
  28. const { data: taskData, run: getTaskData } = useRequest(() => getTasks({}), {
  29. initialData: { list: [] },
  30. })
  31. const menus = ref([
  32. { title: '积分明细', icon: integral },
  33. { title: '优惠券包', icon: coupon },
  34. { title: '我的订单', icon: order },
  35. { title: '专属客服', icon: agent },
  36. { title: '个人设置', icon: setting },
  37. ])
  38. const pieces = ref([
  39. {
  40. title: '设计师成长计划',
  41. desc: '赋能设计共同成长',
  42. icon: designer,
  43. class: 'items-start! pb-0 pr-0',
  44. iconSize: 102,
  45. gridItemClass: 'col-start-1 row-start-1 row-end-3',
  46. },
  47. {
  48. title: '材料商入驻',
  49. desc: '提供优质材料商',
  50. icon: settled,
  51. class: 'flex-row! pb-0 pr-0',
  52. iconSize: 68,
  53. gridItemClass: 'col-start-2 row-start-1',
  54. },
  55. {
  56. title: '筑巢荟公约',
  57. desc: '共同遵守平台公约',
  58. icon: treaty,
  59. class: 'col-start-2 row-start-2 flex-row! pb-0',
  60. iconSize: 44,
  61. gridItemClass: 'col-start-2 row-start-2',
  62. },
  63. ])
  64. const avatar = computed(() =>
  65. !isEmpty(userInfo.value.avatar) ? userInfo.value.avatar : 'https://via.placeholder.com/72x72',
  66. )
  67. const nickNameClickHandle = async () => {
  68. if (isLogined.value) return
  69. uni.navigateTo({ url: '/pages/login/index' })
  70. }
  71. onShow(async () => {
  72. if (isLogined.value) {
  73. await run()
  74. setUserInfo({
  75. ...userInfo.value,
  76. ...data.value,
  77. })
  78. }
  79. })
  80. const handleToAuthentication = () => {
  81. if (!isLogined.value) return
  82. uni.navigateTo({ url: '/pages/mine/authentication/index' })
  83. }
  84. const handleToHomepage = () => {
  85. uni.navigateTo({ url: '/pages/mine/homepage/index' })
  86. }
  87. onMounted(async () => {
  88. // await run()
  89. // console.log(data.value)
  90. await getTaskData()
  91. })
  92. const navBarProps = ref({ customClass: 'bg-transparent!' })
  93. onPageScroll(({ scrollTop }: { scrollTop: number }) => {
  94. console.log(scrollTop)
  95. navBarProps.value.customClass = scrollTop === 0 ? 'bg-transparent!' : ''
  96. })
  97. </script>
  98. <template>
  99. <view>
  100. <wd-navbar
  101. fixed
  102. safeAreaInsetTop
  103. custom-class="bg-transparent!"
  104. :bordered="false"
  105. v-bind="navBarProps"
  106. >
  107. <template #left>
  108. <wd-button type="text" size="small" custom-class="p-0!" :round="false">
  109. <wd-img width="25" height="25" :src="scan" custom-class="vertical-bottom"></wd-img>
  110. </wd-button>
  111. </template>
  112. </wd-navbar>
  113. <!-- <StartMenuButton>
  114. <div class="flex">
  115. <wd-button type="text" size="small" custom-class="p-0!" :round="false">
  116. <wd-img width="25" height="25" :src="scan" custom-class="vertical-bottom"></wd-img>
  117. </wd-button>
  118. </div>
  119. </StartMenuButton> -->
  120. <div
  121. class="bg-black/30 backdrop-blur-[60px] flex flex-col justify-end box-border"
  122. :class="[userInfo.userStatusEnabled ? 'aspect-[0.94/1] pb-44' : 'aspect-[1.15/1] pb-20']"
  123. >
  124. <div class="my-6.5 px-3.5 flex">
  125. <img class="w-[72px] h-[72px] rounded-full border border-white" :src="avatar" />
  126. <div class="ms-3.5 ml-3.5">
  127. <div
  128. class="text-white text-xl font-normal font-['PingFang SC'] leading-normal"
  129. @click="nickNameClickHandle"
  130. >
  131. {{ !isLogined ? '请点击登录' : userInfo?.nickname }}
  132. </div>
  133. <div
  134. v-if="!userInfo.userStatusEnabled"
  135. class="mt-2 w-[63px] h-[26px] bg-black/10 rounded-[20px] border border-white/60 flex items-center justify-center"
  136. >
  137. <div
  138. class="text-center text-white text-xs font-normal font-['PingFang SC'] leading-normal"
  139. >
  140. 未认证
  141. </div>
  142. </div>
  143. <div
  144. v-if="userInfo.userStatusEnabled"
  145. class="flex items-center text-white"
  146. @click="handleToHomepage"
  147. >
  148. <div
  149. class="text-center text-white text-sm font-normal font-['PingFang SC'] leading-normal"
  150. >
  151. 个人主页
  152. </div>
  153. <wd-icon name="arrow-right"></wd-icon>
  154. </div>
  155. </div>
  156. </div>
  157. <div class="px-3.5 flex items-center">
  158. <div class="flex items-center">
  159. <div class="text-white text-base font-normal font-['PingFang SC'] leading-normal mr-1">
  160. 36
  161. </div>
  162. <div
  163. class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang SC'] leading-normal"
  164. >
  165. 分享
  166. </div>
  167. </div>
  168. <div class="h-4 w-[2px] mx-4 bg-[#e9e7e4]"></div>
  169. <div class="flex items-center">
  170. <div class="text-white text-base font-normal font-['PingFang SC'] leading-normal mr-1">
  171. 36
  172. </div>
  173. <div
  174. class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang SC'] leading-normal"
  175. >
  176. 分享
  177. </div>
  178. </div>
  179. <div class="h-4 w-[2px] mx-4 bg-[#e9e7e4]"></div>
  180. <div class="flex items-center">
  181. <div class="text-white text-base font-normal font-['PingFang SC'] leading-normal mr-1">
  182. 36
  183. </div>
  184. <div
  185. class="text-center text-[#e9e7e4] text-xs font-normal font-['PingFang SC'] leading-normal"
  186. >
  187. 分享
  188. </div>
  189. </div>
  190. </div>
  191. </div>
  192. <div class="relative top--18" v-if="!userInfo.userStatusEnabled">
  193. <div class="mx-3.5 box-border absolute left-0 right-0 top-0">
  194. <wd-img :src="vipBg" width="100%" mode="widthFix"></wd-img>
  195. </div>
  196. <div class="mx-3.5 box-border absolute left-0 right-0 top-0 p-3.5">
  197. <div class="flex items-center">
  198. <wd-img custom-class="vertical-bottom" :src="vip" width="35" mode="widthFix"></wd-img>
  199. <div
  200. class="ml-2 text-center text-[#faeac6] text-sm font-normal font-['PingFang SC'] leading-normal"
  201. >
  202. 查看会员等级权益
  203. </div>
  204. <div class="flex-1"></div>
  205. <div
  206. class="w-[83px] h-[29px] bg-gradient-to-l from-[#ffdab6] to-[#ffebd5] rounded-[30px] flex items-center justify-center"
  207. @click="handleToAuthentication()"
  208. >
  209. <div
  210. class="text-[#9e5934] text-[13px] font-normal font-['PingFang SC'] leading-relaxed"
  211. >
  212. 去认证
  213. </div>
  214. </div>
  215. </div>
  216. </div>
  217. </div>
  218. <template v-else>
  219. <div class="relative top--36">
  220. <div
  221. class="mx-3.5 absolute left-0 right-0 top--4 h-[180px] bg-gradient-to-r from-[#141414] to-[#4b4b49] rounded-tl-[10px] rounded-tr-[10px] p-3.5 box-border"
  222. :class="['text-[#8FB8DB]']"
  223. >
  224. <div class="flex items-center">
  225. <wd-img class="" width="20" height="20" :src="memberIconV1"></wd-img>
  226. <wd-img class="" width="108" height="27" :src="memberTextV1"></wd-img>
  227. <div class="flex-1"></div>
  228. <div
  229. class="h-[22px] bg-gradient-to-r from-[#333333] to-[#20201e] rounded-tl-[20px] rounded-bl-[20px] mr--3.5 px-2"
  230. >
  231. <div class="text-xs font-normal font-['PingFang SC'] leading-relaxed">
  232. 更多等级权益
  233. </div>
  234. </div>
  235. </div>
  236. <div class="flex items-end mt-10">
  237. <div>
  238. <span class="text-4xl font-normal font-['D-DIN Exp']">{{ userInfo.point }}</span>
  239. <span class="text-center text-xs font-normal font-['PingFang SC']">积分</span>
  240. </div>
  241. <div class="flex-1"></div>
  242. <div class="text-sm font-normal font-['PingFang SC']">
  243. 会员号:{{ userInfo.userId }}
  244. </div>
  245. </div>
  246. </div>
  247. </div>
  248. <!-- <div class="relative h-4 box-border bg-transparent rounded-b-[50%] z-1"></div> -->
  249. </template>
  250. <view class="bg-neutral-100 relative bottom-4 rounded-t-2xl py-1 px-3.5">
  251. <div class="flex justify-around my-6">
  252. <template v-for="({ title, icon }, i) in menus" :key="i">
  253. <div class="flex flex-col items-center">
  254. <div class="relative flex-col justify-start items-start inline-flex">
  255. <wd-img :src="icon" width="24" height="24" custom-class="vertical-bottom"></wd-img>
  256. </div>
  257. <div
  258. class="mt-2 text-black/90 text-[12.86px] font-normal font-['PingFang SC'] leading-relaxed"
  259. >
  260. {{ title }}
  261. </div>
  262. </div>
  263. </template>
  264. </div>
  265. <TasksCard custom-class="my-6" :items="taskData.list"></TasksCard>
  266. <SectionHeading custom-class="my-6" title="和筑巢荟一起共同成长"></SectionHeading>
  267. <CardMenu :items="pieces" custom-class="grid-cols-2" />
  268. </view>
  269. </view>
  270. </template>
  271. <style scoped lang="scss"></style>