template3.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <script>
  2. import { HTTP_REQUEST_URL } from '@/config/app';
  3. export default {
  4. inject: ['intoPage', 'tapQrCode', 'goMenuPage', 'goEdit', 'bindPhone'],
  5. props: {
  6. userInfo: {
  7. type: Object,
  8. default: () => {}
  9. },
  10. // perShowType 0 手机号 1 ID
  11. perShowType: {
  12. type: Number,
  13. default: 0
  14. }
  15. },
  16. computed: {
  17. headerBg() {
  18. return `url(${HTTP_REQUEST_URL}/statics/images/users/user_header_bg.png)`;
  19. }
  20. },
  21. methods: {
  22. getTimePeriod() {
  23. const currentTime = new Date();
  24. const currentHour = currentTime.getHours();
  25. if (currentHour >= 6 && currentHour < 12) {
  26. return ',早上好';
  27. } else if (currentHour >= 12 && currentHour < 14) {
  28. return ',中午好';
  29. } else if (currentHour >= 14 && currentHour < 18) {
  30. return ',下午好';
  31. } else {
  32. return ',晚上好';
  33. }
  34. }
  35. }
  36. };
  37. </script>
  38. <template>
  39. <view class="user_info_card relative" :style="{ backgroundImage: headerBg }">
  40. <view class="mt-44 flex-between-center top">
  41. <view class="flex-y-center">
  42. <image class="w-80 h-80 rd-50-p111-" :src="userInfo.avatar" @click="goEdit"></image>
  43. <view class="ml-24">
  44. <view class="fs-36 text--w111-333 lh-50rpx fw-500">{{ userInfo.nickname }}</view>
  45. <view class="bind-phone" v-if="!userInfo.phone" @tap="bindPhone">绑定手机号</view>
  46. <view class="fs-24 text--w111-333 lh-34rpx mt-8" v-else>{{ perShowType ? 'ID:' + userInfo.uid : userInfo.phone }}</view>
  47. </view>
  48. </view>
  49. <view class="acea-row row-middle">
  50. <text class="iconfont icon-a-ic_QRcode fs-40" @click="tapQrCode"><text class="tips">会员码</text></text>
  51. <text class="iconfont icon-a-ic_setup1 fs-40 mx-34" @click="intoPage('/pages/users/user_set/index')"></text>
  52. <view class="iconfont icon-ic_message3 fs-40" @click="intoPage('/pages/users/message_center/index')">
  53. <uni-badge v-if="userInfo.service_num" absolute="rightTop" :custom-style="{background: 'var(--view-theme)',top:'-56rpx'}" :text="userInfo.service_num"></uni-badge>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="w-full bg_zs" v-if="userInfo.vip">
  58. <view class="svip_card" @click="intoPage(userInfo.level_status == 1 ? '/pages/users/user_vip/index' : '/pages/annex/vip_grade_active/index')">
  59. <view class="h-full flex-between-center pl-32 pr-28 text--w111-FFD89C fs-24">
  60. <view class="flex-y-center">
  61. <text class="iconfont icon-ic_crown fs-32"></text>
  62. <text class="pl-12">尊贵的{{ userInfo.vip_name }}{{ getTimePeriod() }}</text>
  63. </view>
  64. <view class="flex-y-center">
  65. <text>查看会员权益</text>
  66. <text class="iconfont icon-ic_rightarrow fs-24"></text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. </template>
  73. <style scoped lang="scss">
  74. .navbar {
  75. position: relative;
  76. .content {
  77. position: fixed;
  78. top: 0;
  79. right: 0;
  80. left: 0;
  81. z-index: 998;
  82. font-weight: 500;
  83. font-size: 34rpx;
  84. color: #ffffff;
  85. }
  86. }
  87. .user_info_card {
  88. // min-height: 304rpx;
  89. background-size: 100% 100%;
  90. .top {
  91. padding: 0 48rpx 50rpx 48rpx;
  92. }
  93. .iconfont {
  94. position: relative;
  95. }
  96. .bind-phone {
  97. margin-top: 12rpx;
  98. background: #fff;
  99. border-radius: 30px;
  100. width: max-content;
  101. text-align: center;
  102. font-size: 20rpx;
  103. font-weight: 400;
  104. color: #333333;
  105. line-height: 28rpx;
  106. padding: 6rpx 16rpx;
  107. }
  108. }
  109. .bg_zs {
  110. background-image: url('@/static/img/bg_zs.png');
  111. background-size: 100%;
  112. background-repeat: no-repeat;
  113. background-position-y: 56rpx;
  114. padding-bottom: 130rpx;
  115. }
  116. .svip_card {
  117. width: 662rpx;
  118. height: 92rpx;
  119. background-image: url('@/static/img/user_svip_bg.png');
  120. background-size: 100%;
  121. background-repeat: no-repeat;
  122. position: absolute;
  123. left: 50%;
  124. transform: translateX(-50%);
  125. }
  126. .tips {
  127. position: absolute;
  128. top: -34rpx;
  129. left: 50%;
  130. height: 28rpx;
  131. padding: 0 14rpx;
  132. border-radius: 14rpx;
  133. margin-bottom: 4rpx;
  134. background-color: #ffd89c;
  135. transform: translateX(-50%);
  136. white-space: nowrap;
  137. font-size: 16rpx;
  138. line-height: 28rpx;
  139. color: #9e5e1a;
  140. }
  141. .tips::before {
  142. content: '';
  143. position: absolute;
  144. bottom: -6rpx;
  145. left: calc(50% - 6rpx);
  146. width: 0;
  147. height: 0;
  148. border-left: 6rpx solid transparent;
  149. border-right: 6rpx solid transparent;
  150. border-top: 6rpx solid #ffd89c; /* 修改颜色以改变三角形颜色 */
  151. }
  152. .number {
  153. position: absolute;
  154. top: -8rpx;
  155. right: 0;
  156. min-width: 10rpx;
  157. height: 24rpx;
  158. padding: 0 6rpx;
  159. border: 2rpx solid var(--view-theme);
  160. border-radius: 12rpx;
  161. background-color: #ffffff;
  162. transform: translateX(50%);
  163. font-weight: 500;
  164. font-size: 18rpx;
  165. line-height: 24rpx;
  166. color: var(--view-theme);
  167. }
  168. </style>