cards.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. <script>
  2. import {reload_userinfo} from "../../utils/user";
  3. let $this;
  4. export default {
  5. name: "UserCard",
  6. data() {
  7. return {
  8. userinfo: {
  9. //判断是否第一次进入小程序 1为是第一次 0为非第一次
  10. },
  11. invite_code: 0,
  12. };
  13. },
  14. methods: {
  15. //跳转页面
  16. pageTo($page) {
  17. mpvue.navigateTo({
  18. url: "/pages/" + $page + "/main",
  19. });
  20. }
  21. },
  22. mounted() {
  23. $this.invite_code = wx.getStorageSync("code");
  24. reload_userinfo($this);
  25. },
  26. created() {
  27. $this = this;
  28. },
  29. onPullDownRefresh() {
  30. reload_userinfo($this);
  31. },
  32. };
  33. </script>
  34. <template>
  35. <div id="personal">
  36. <!-- 用户信息 -->
  37. <div :class="{ userinfoYellow: userinfo.isActive, userinfoGrey: userinfo.isntActive}">
  38. <van-row class="padding">
  39. <van-col span="3" offset="2">
  40. <view class="cu-avatar radius lg" :style="'background-image:url(' + userinfo.portrait + ');'"></view>
  41. </van-col>
  42. <van-col span="12" offset="1">
  43. <div class="flex flex-direction align-start justify-start">
  44. <div>
  45. <text class="text-black text-bold">{{ userinfo.user_name }}</text>
  46. </div>
  47. <div class="flex justify-between align-center">
  48. <button class="cu-btn sm round"
  49. :class="{ level_btn_yellow: userinfo.isActive, level_btn_grey: userinfo.isntActive }">
  50. {{ userinfo.level_name }}
  51. </button>
  52. <view class="text-xs padding-left" v-if="userinfo.level*1 === 11">有效期至
  53. {{ userinfo["validity_time_formatted"] }}
  54. </view>
  55. </div>
  56. </div>
  57. </van-col>
  58. <van-col span="5">
  59. <view class="text" @click="pageTo('user_center')">
  60. <text class="cuIcon-people"></text>
  61. <text class="under_line">会员中心</text>
  62. </view>
  63. </van-col>
  64. </van-row>
  65. <!-- <van-row class="padding">-->
  66. <!-- <view style="opacity:1">-->
  67. <!-- <van-col span="4" class="lg" offset="2">-->
  68. <!-- <text class="cuIcon-selection"></text>-->
  69. <!-- 卡号:-->
  70. <!-- </van-col>-->
  71. <!-- <van-col span="8">-->
  72. <!-- <text class="text-white text-bold text-lg">{{ invite_code }}</text>-->
  73. <!-- </van-col>-->
  74. <!-- </view>-->
  75. <!-- </van-row>-->
  76. <van-row class="bottom-info">
  77. <van-col span="6" offset="1">
  78. <div class="flex flex-direction align-center">
  79. <text class="text-xxl">{{ userinfo.play_time }}</text>
  80. <text class="font-sm">可用时长(分钟)</text>
  81. </div>
  82. </van-col>
  83. <van-col span="7" offset="2" @click="pageTo('coupons')">
  84. <div class="flex flex-direction align-center text-link">
  85. <text class="text-xxl">{{ userinfo.coupon }}</text>
  86. <text class="font-sm">已领券数量</text>
  87. </div>
  88. </van-col>
  89. <van-col span="6" offset="2">
  90. <div class="flex flex-direction align-center">
  91. <text class="text-xxl">{{ userinfo.experience }}</text>
  92. <text class="font-sm">次卡</text>
  93. </div>
  94. </van-col>
  95. </van-row>
  96. </div>
  97. <view class="text-center font-sm" v-if="userinfo.level >= 3 && userinfo.level <= 7">
  98. <text class="text-gray">今日专注力免费训练时长还有:
  99. <text class="text-yellow">{{ userinfo.free_time }}</text>
  100. </text>
  101. </view>
  102. <van-toast id="van-toast"/>
  103. </div>
  104. </template>
  105. <style scoped>
  106. .userinfoYellow {
  107. background-image: url("https://img.shuimuai.com/huiyuankadiban.png");
  108. background-position: center;
  109. background-size: 100% 100%;
  110. width: 99%;
  111. height: 173px;
  112. margin: 0px auto;
  113. }
  114. .userinfoGrey {
  115. background-image: url("https://img.shuimuai.com/pic_grey.png");
  116. background-position: center;
  117. background-size: 100% 100%;
  118. width: 99%;
  119. height: 173px;
  120. margin: 0px auto;
  121. }
  122. #personal {
  123. width: 100%;
  124. position: relative;
  125. top: -95px;
  126. z-index: 3;
  127. }
  128. .bottom-info{
  129. display: block;
  130. margin-top:35px;
  131. }
  132. .level_btn_yellow {
  133. background-color: #e3a000;
  134. }
  135. .level_btn_grey {
  136. background-color: #909090;
  137. }
  138. .font-sm {
  139. font-size: 10px;
  140. }
  141. .text-link{
  142. color: #4B3AB0;
  143. }
  144. </style>