me-info.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <template>
  2. <view class="mx-30 mt-80">
  3. <view class="flex items-center justify-between gap-x-20" @click="handleHeaderClick">
  4. <ie-image :src="avatar" custom-class="w-128 h-128" :round="999" />
  5. <view class="flex-1 min-w-1">
  6. <view class="text-40 text-fore-title flex items-center gap-x-20">
  7. <text class="font-bold">{{ nickName }}</text>
  8. <ie-image v-if="!isVip" src="/static/personal/vip_tag.png" custom-class="w-100 h-36" />
  9. </view>
  10. <view v-if="phonenumber" class="text-30 text-fore-subcontent">{{ phonenumber }}</view>
  11. </view>
  12. <view>
  13. <ie-image src="/static/personal/setting.png" custom-class="w-48 h-48" @click.stop="handleSettingClick" />
  14. </view>
  15. </view>
  16. <view class="my-30 flex items-center text-center">
  17. <view class="flex-1">
  18. <view class="text-30 text-fore-title font-bold">0</view>
  19. <view class="mt-10 text-26 text-fore-subcontent">做题数量</view>
  20. </view>
  21. <view class="flex-1">
  22. <view class="text-30 text-fore-title font-bold">0</view>
  23. <view class="mt-10 text-26 text-fore-subcontent">视频观看时长</view>
  24. </view>
  25. <view class="flex-1">
  26. <view class="text-30 text-fore-title font-bold">0</view>
  27. <view class="mt-10 text-26 text-fore-subcontent">登录次数</view>
  28. </view>
  29. </view>
  30. <view v-if="isVip" class="relative">
  31. <ie-image src="/static/personal/buy_vip.png" custom-class="w-full h-96" />
  32. <view class="absolute left-100 right-20 top-0 h-full flex items-center justify-between">
  33. <view class="text-26 text-fore-title">已开通会员,享受权益中</view>
  34. <view class="text-26 text-fore-subcontent">{{ vipInfo.outDate }} 到期</view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script lang="ts" setup>
  40. import { useUserStore } from '@/store/userStore';
  41. import { useTransferPage } from '@/hooks/useTransferPage';
  42. const userStore = useUserStore();
  43. const { transferTo } = useTransferPage();
  44. const avatar = computed(() => userStore.avatar);
  45. const nickName = computed(() => userStore.nickName);
  46. const phonenumber = computed(() => userStore.anonymousPhoneNumber);
  47. const isVip = computed(() => userStore.isVip);
  48. const vipInfo = computed(() => userStore.vipInfo);
  49. const handleHeaderClick = async () => {
  50. // 不询问直接跳转登录
  51. const isLogin = await userStore.checkLogin({ askToLogin: false });
  52. }
  53. const handleSettingClick = async () => {
  54. const isLogin = await userStore.checkLogin({ askToLogin: true });
  55. if (isLogin) {
  56. transferTo('/pagesOther/pages/personal-center/setting/setting');
  57. }
  58. }
  59. </script>
  60. <style lang="scss" scoped></style>