mine-view.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <template>
  2. <view>
  3. <view class="container">
  4. <view class="flex justify-between align-center" style="height: 200upx;" v-if="isLogin">
  5. <view class="padding-left">
  6. <view class="text-black text-bold text-xl">{{userData.nickName}}</view>
  7. <view class="flex align-center padding-top-sm">
  8. <view>
  9. <view class="text-black text-bold">{{+userData.totalHot}}</view>
  10. <view class="text-gray text-sm margin-top-xs">热力</view>
  11. </view>
  12. <view style="height: 60upx;border: #dadada 1px solid; margin: 0 30upx;"></view>
  13. <view>
  14. <view class="text-black text-bold">{{+userData.totalPoints}}</view>
  15. <view class="text-gray text-sm margin-top-xs">积分</view>
  16. </view>
  17. <view class="padding-left">
  18. <button class="cu-btn sm line-black round" @click="edit">
  19. <text class="cuIcon-post padding-right-xs"></text>
  20. <text>修改资料</text>
  21. </button>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="flex align-center">
  26. <view class="padding-right">
  27. <u-avatar :src="userData.avatar" size="120"></u-avatar>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="text-center padding-sm" v-else>
  32. <view class="margin-bottom">
  33. <u-avatar size="120"></u-avatar>
  34. </view>
  35. <u-button class="custom-style" shape="circle" @click="toAuth">授权登录</u-button>
  36. </view>
  37. <view class="padding-lg flex justify-around align-center">
  38. <view class="flex" @click="navByIcon('/pages/activityList/mine/pointsDetail')">
  39. <image src="/static/icon-points.png" style="width: 80upx;height: 80upx;"></image>
  40. <view class="padding-left-sm">
  41. <view class="text-bold text-lg">积分明细</view>
  42. <view class="text-gray">消费赚积分</view>
  43. </view>
  44. </view>
  45. <view class="flex" @click="navByIcon('/pages/activityList/mine/boostDetail')">
  46. <image src="/static/icon-order.png" style="width: 80upx;height: 80upx;"></image>
  47. <view class="padding-left-sm">
  48. <view class="text-bold text-lg">热力明细</view>
  49. <view class="text-gray">助力奖赏</view>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <view class="container">
  55. <block v-for="(item, index) in iconList" :key="index">
  56. <view class="padding" v-if="item.name == '分割线'">
  57. <u-line color="#d3d3d3"></u-line>
  58. </view>
  59. <view class="flex justify-between align-center padding" @click="navByIcon(item.url)" v-else>
  60. <view class="flex align-center">
  61. <view class="flex align-center" style="width: 38rpx;height: 38rpx;">
  62. <image :src="item.icon" :style="{width: item.width, height: item.height}"></image>
  63. </view>
  64. <view class="text-black text-bold text-lg padding-left">{{item.name}}</view>
  65. </view>
  66. <view class="cuIcon-right"></view>
  67. </view>
  68. </block>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import {authUrl} from '@/common/conf/config.js'
  74. export default {
  75. props: {
  76. activityId: {
  77. type: String,
  78. default: '',
  79. }
  80. },
  81. data() {
  82. return {
  83. userData: {},
  84. isLogin: false,
  85. iconList: [
  86. {name: '我的礼品', icon: '/static/icon-gift.png', width: '36upx', height: '33upx', url: '/pages/activityList/mine/myGift'},
  87. {name: '我的音乐', icon: '/static/icon-music.png', width: '33upx', height: '32upx', url: '/pages/activityList/mine/myMusic'},
  88. // {name: '我的奖金', icon: '/static/icon-awards.png', width: '29upx', height: '38upx', url: '/pages/activityList/mine/myAwards'},
  89. {name: '我的助力', icon: '/static/icon-history.png', width: '32upx', height: '32upx', url: '/pages/activityList/mine/myBoost'},
  90. {name: '我的公益', icon: '/static/icon-welfare.png', width: '31upx', height: '31upx', url: '/pages/activityList/mine/myWelfare'},
  91. {name: '分割线', icon: '', width: '', height: '', url: ''},
  92. {name: '花积分', icon: '/static/icon-mall.png', width: '30upx', height: '26upx', url: ''},
  93. {name: '更多活动', icon: '/static/icon-activity.png', width: '26upx', height: '31upx', url: ''},
  94. {name: '活动规则', icon: '/static/icon-rule.png', width: '29upx', height: '33upx', url: ''}
  95. ],
  96. }
  97. },
  98. mounted() {
  99. let userId = uni.getStorageSync("userId")
  100. if (this.$u.test.isEmpty(userId)) {
  101. this.isLogin = false;
  102. } else {
  103. this.isLogin = true;
  104. this.getUserInfo(userId);
  105. }
  106. },
  107. methods: {
  108. toAuth() {
  109. window.location.href = authUrl(this.activityId);
  110. },
  111. getUserInfo(userId) {
  112. this.$u.api.user.detail({id: userId}).then(res => {
  113. this.userData = res;
  114. })
  115. },
  116. //跳转需要带参数
  117. edit() {
  118. uni.navigateTo({
  119. url: '/pages/activityList/mine/edit?userId=' + this.userData.id
  120. })
  121. },
  122. navByIcon(url) {
  123. if (!this.isLogin) {
  124. this.toAuth();
  125. } else {
  126. uni.navigateTo({
  127. url: url
  128. })
  129. }
  130. }
  131. }
  132. }
  133. </script>
  134. <style>
  135. .container {
  136. margin: 30upx;
  137. background-color: #ffffff;
  138. border-radius: 28upx;
  139. box-shadow: -1upx -1upx 60upx #d8d8d8;
  140. }
  141. .custom-style {
  142. background-color: #5b3ee7;
  143. width: 200upx;
  144. height: 60upx;
  145. color: #ffffff;
  146. }
  147. </style>