mine-view.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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">205</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">886</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.headimgurl" 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. hotVaule: '205',
  85. points: '886',
  86. isLogin: false,
  87. iconList: [
  88. {name: '我的礼品', icon: '/static/icon-gift.png', width: '36upx', height: '33upx', url: '/pages/activityList/mine/myGift'},
  89. {name: '我的音乐', icon: '/static/icon-music.png', width: '33upx', height: '32upx', url: '/pages/activityList/mine/myMusic'},
  90. // {name: '我的奖金', icon: '/static/icon-awards.png', width: '29upx', height: '38upx', url: '/pages/activityList/mine/myAwards'},
  91. {name: '我的助力', icon: '/static/icon-history.png', width: '32upx', height: '32upx', url: '/pages/activityList/mine/myBoost'},
  92. {name: '我的公益', icon: '/static/icon-welfare.png', width: '31upx', height: '31upx', url: '/pages/activityList/mine/myWelfare'},
  93. {name: '分割线', icon: '', width: '', height: '', url: ''},
  94. {name: '花积分', icon: '/static/icon-mall.png', width: '30upx', height: '26upx', url: ''},
  95. {name: '更多活动', icon: '/static/icon-activity.png', width: '26upx', height: '31upx', url: ''},
  96. {name: '活动规则', icon: '/static/icon-rule.png', width: '29upx', height: '33upx', url: ''}
  97. ],
  98. }
  99. },
  100. mounted() {
  101. if (this.$u.test.isEmpty(uni.getStorageSync("userId"))) {
  102. this.isLogin = false;
  103. } else {
  104. this.isLogin = true;
  105. this.getUserInfo();
  106. }
  107. },
  108. methods: {
  109. toAuth() {
  110. window.location.href = authUrl(this.activityId);
  111. },
  112. getUserInfo() {
  113. this.$u.api.user.detail({id: this.userId}).then(res => {
  114. this.userData = res;
  115. })
  116. },
  117. //跳转需要带参数
  118. edit() {
  119. uni.navigateTo({
  120. url: '/pages/activityList/mine/edit'
  121. })
  122. },
  123. navByIcon(url) {
  124. uni.navigateTo({
  125. url: url
  126. })
  127. }
  128. }
  129. }
  130. </script>
  131. <style>
  132. .container {
  133. margin: 30upx;
  134. background-color: #ffffff;
  135. border-radius: 28upx;
  136. box-shadow: -1upx -1upx 60upx #d8d8d8;
  137. }
  138. .custom-style {
  139. background-color: #5b3ee7;
  140. width: 200upx;
  141. height: 60upx;
  142. color: #ffffff;
  143. }
  144. </style>