me-info.vue 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <template>
  2. <view class="mx-30 mt-80">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <view class="h-70"></view>
  5. <!-- #endif -->
  6. <view class="flex items-center justify-between gap-x-20" @click="handleHeaderClick">
  7. <ie-image :src="avatar" custom-class="w-134 h-134" :round="999" />
  8. <view class="flex-1 min-w-1">
  9. <view class="text-40 text-fore-title flex items-center gap-x-20">
  10. <text class="font-bold">{{ nickName }}</text>
  11. <view v-if="isLogin" class="bg-[#EBF4FC] pl-6 pr-20 py-6 rounded-20 flex items-center">
  12. <ie-image src="/static/personal/icon-role.png" custom-class="w-30 h-30" mode="aspectFit" />
  13. <text class="ml-10 text-20 text-primary">{{ roleDesc }}</text>
  14. </view>
  15. </view>
  16. <view v-if="!isLogin" class="mt-8 text-34 text-[#666666]">注册/登录</view>
  17. <view v-else-if="phonenumber" class="mt-8 text-30 text-fore-subcontent">{{ phonenumber }}</view>
  18. </view>
  19. <view>
  20. <ie-image src="/static/personal/setting.png" custom-class="w-48 h-48" @click.stop="handleSettingClick" />
  21. </view>
  22. </view>
  23. <view v-if="isStudent"
  24. class="mt-50 h-184 rounded-15 relative bg-gradient-to-r from-[#253045] to-[#141D2F] overflow-hidden">
  25. <ie-image src="/static/personal/bg-vip-card.png"
  26. custom-class="w-276 h-full absolute left-1/2 top-0 -translate-x-1/2 z-0" mode="heightFix" />
  27. <view class="h-full box-border px-45 flex items-center justify-between relative z-1">
  28. <view class="flex-1 min-w-1">
  29. <view class="flex items-center justify-between">
  30. <ie-image src="/static/personal/icon-vip.png" custom-class="w-210 h-46" />
  31. <view v-if="!isVip" class="flex items-center justify-center px-20 py-10 rounded-22"
  32. style="background: radial-gradient( 0% 0% at 0% 0%, #FEE8BD 0%, #EFCC8D 100%);" @click="handleVip">
  33. <text class="mr-4 text-24 text-[#532F12] font-bold leading-23">开通会员</text>
  34. <uv-icon name="arrow-right" size="13" color="#532F12" />
  35. </view>
  36. </view>
  37. <view class="mt-16 text-26 text-[#FEECCB]">{{ isVip ? `使用有效期至 ${vipInfo.outDate}` : '开通VIP会员,享受更多专属权益' }}
  38. </view>
  39. </view>
  40. <view class="shrink-0">
  41. <ie-image v-if="isVip" src="/static/personal/icon-vip2.png" custom-class="w-160 h-168" mode="heightFix" />
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script lang="ts" setup>
  48. import { useUserStore } from '@/store/userStore';
  49. import { useTransferPage } from '@/hooks/useTransferPage';
  50. const userStore = useUserStore();
  51. const { transferTo, routes } = useTransferPage();
  52. const avatar = computed(() => userStore.avatar);
  53. const nickName = computed(() => userStore.nickName);
  54. const phonenumber = computed(() => userStore.anonymousPhoneNumber);
  55. const isVip = computed(() => userStore.isVip);
  56. const isStudent = computed(() => userStore.isStudent);
  57. const isLogin = computed(() => userStore.isLogin);
  58. const isExperienceVip = computed(() => userStore.isExperienceVip);
  59. const vipInfo = computed(() => userStore.vipInfo);
  60. const roleDesc = computed(() => {
  61. if (isLogin.value && !isVip && !userStore.isStudent) {
  62. return '普通会员';
  63. }
  64. if (isVip.value) {
  65. if (isExperienceVip.value) {
  66. return '体验会员';
  67. }
  68. return 'VIP会员';
  69. }
  70. if (userStore.isAgent) {
  71. return '内部账号';
  72. }
  73. if (userStore.isTeacher) {
  74. return '教师账号';
  75. }
  76. return '普通会员';
  77. });
  78. const handleHeaderClick = async () => {
  79. // 不询问直接跳转登录
  80. const isLogin = await userStore.checkLogin({ askToLogin: false });
  81. if (isLogin) {
  82. setTimeout(async () => {
  83. await userStore.checkInfoComplete();
  84. }, 500)
  85. }
  86. }
  87. const handleVip = () => {
  88. transferTo('/pagesSystem/pages/card-verify/card-verify')
  89. }
  90. const handleSettingClick = async () => {
  91. transferTo(routes.pageSetting);
  92. }
  93. </script>
  94. <style lang="scss" scoped></style>