index.vue 9.7 KB

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