mine-view.vue 6.2 KB

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