mine-view.vue 6.0 KB

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