index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <!-- vip权益 -->
  2. <template>
  3. <view class="box">
  4. <!-- vip信息 -->
  5. <view class="vipBox">
  6. <view class="avatar">
  7. <img :src="getUserAvatar(baseInfo?.avatar, baseInfo?.sex)" alt="" class="img-box">
  8. <image src="/static/svg/vip.svg" class="vipIcon"></image>
  9. </view>
  10. <view class="nameBox">
  11. <view class="name font-weight-bold font-size-16">{{ baseInfo?.name || userInfo?.phone }}</view>
  12. <view class="vipInfo font-size-14">
  13. 14天双周卡将于{{ remaining }}后过期
  14. </view>
  15. </view>
  16. </view>
  17. <view style="height: 20rpx; background-color: #f8f8fa;"></view>
  18. <view class="card">
  19. <uni-list>
  20. <uni-list-item
  21. v-for="item in list"
  22. :clickable="true"
  23. :key="item.title"
  24. :title="item.title"
  25. showArrow
  26. :rightText="item.rightTex || ''"
  27. @click="handleToLink(item)"
  28. >
  29. </uni-list-item>
  30. </uni-list>
  31. </view>
  32. </view>
  33. </template>
  34. <script setup>
  35. import { userStore } from '@/store/user'
  36. import { ref, computed } from 'vue'
  37. import { getUserAvatar } from '@/utils/avatar'
  38. const useUserStore = userStore()
  39. const baseInfo = computed(() => useUserStore?.baseInfo)
  40. const userInfo = computed(() => useUserStore?.userInfo)
  41. const remaining = computed(() => {
  42. if (!userInfo.value?.vipExpireDate) return '0'
  43. const diffInMs = (userInfo.value?.vipExpireDate-0) - new Date().getTime()
  44. const day = diffInMs / (1000 * 60 * 60 * 24)
  45. return day < 1 ? '今天' : Math.floor(day) + '天'
  46. })
  47. const list = ref([
  48. { title: '简历模板', path: '/pagesA/vip/template/index' },
  49. { title: '屏蔽企业', path: '/pagesA/vip/blockEnt/index' },
  50. ])
  51. // 列表跳转
  52. const handleToLink = (item) => {
  53. uni.navigateTo({
  54. url: item.path
  55. })
  56. }
  57. </script>
  58. <style lang="scss" scoped>
  59. .vipBox {
  60. // color: #a18a0f;
  61. padding: 80rpx 50rpx;
  62. display: flex;
  63. background: linear-gradient(121deg,#fde2c2 29.02%,#c19164 104.03%);
  64. .avatar{
  65. position: relative;
  66. width: 100rpx;
  67. height: 100rpx;
  68. margin: 0;
  69. .img-box {
  70. width: 100%;
  71. height: 100%;
  72. border: 2rpx solid #ccc;
  73. border-radius: 50%;
  74. border: 1px solid gold;
  75. }
  76. .vipIcon {
  77. position: absolute;
  78. width: 50%;
  79. height: 50%;
  80. bottom: 0;
  81. right: 0;
  82. transform: translate(0, 30%);
  83. }
  84. }
  85. .nameBox {
  86. display: flex;
  87. flex-direction: column;
  88. justify-content: space-around;
  89. margin-left: 30rpx;
  90. .name {
  91. color: #724d2b;
  92. }
  93. .vipInfo {
  94. color: #211000;
  95. }
  96. }
  97. }
  98. :deep(.uni-list-item) {
  99. height: 120rpx !important;
  100. line-height: 120rpx !important;
  101. }
  102. :deep(.uni-list-item__content-title) {
  103. font-size: 32rpx !important;
  104. font-weight: 500;
  105. }
  106. </style>