mine-view.vue 5.8 KB

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