mine.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. <template>
  2. <view :style="vuex_skin">
  3. <view class="container" :style="vuex_skin">
  4. <view class="flex justify-between align-center" style="padding: 40rpx 30rpx;" v-if="vuex_userId">
  5. <view class="padding-left">
  6. <view class="text-black text-bold text-xl padding-bottom-20">
  7. {{userData.nickName || ''}}
  8. </view>
  9. <view class="flex align-center padding-top-sm">
  10. <view>
  11. <view class="text-black text-bold center">{{userData.heatValue || 0}}</view>
  12. <view class="text-gray text-sm margin-top-10">热力</view>
  13. </view>
  14. <view style="height: 60upx;border: #D2D2D2 1px solid; margin: 0 30upx;"></view>
  15. <view>
  16. <view class="text-black text-bold center">{{userData.pufaPoint || 0}}</view>
  17. <view class="text-gray text-sm margin-top-10">积分</view>
  18. </view>
  19. <view class="padding-left">
  20. <button class="cu-btn sm line-black round"
  21. @click="jump('/pages/mine/info/info?edit=true',true)">
  22. <text class="cuIcon-post " style="font-size: 26rpx;margin-right: 4rpx;"></text>
  23. <text>修改资料</text>
  24. </button>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="flex align-center" @click="$jump('/pages/mine/info/info',true)">
  29. <view class="padding-right-10">
  30. <u-avatar :src="userData.avatar" size="100"></u-avatar>
  31. </view>
  32. <view class="">
  33. <text class="cuIcon-right" style="color: #C4C4C4;"></text>
  34. </view>
  35. </view>
  36. </view>
  37. <view class="text-center flex" style="padding: 30rpx;" v-else>
  38. <view class="">
  39. <u-avatar src="/static/icon/unlogin.png" size="110"></u-avatar>
  40. </view>
  41. <view class="center margin-left-20 " @click="showLogin">
  42. <view class="cu-btn sm round line-black">
  43. <text>点击授权登录</text>
  44. </view>
  45. </view>
  46. </view>
  47. <view class="flex justify-around align-center" style="padding: 10rpx 40rpx 30rpx;">
  48. <view class="flex" @click="jump('/pages/mine/points/pointsDetail',true)">
  49. <image src="../../static/mine/points.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 text-sm" style="font-weight: 400;">消费赚积分</view>
  53. </view>
  54. </view>
  55. <view class="flex" @click="jump('/pages/mine/my-help/help-records',true)">
  56. <image src="../../static/mine/hot-value.png" style="width: 80upx;height: 80upx;"></image>
  57. <view class="padding-left-sm">
  58. <view class="text-bold text-lg">热力明细</view>
  59. <view class="text-gray text-sm" style="font-weight: 400;">助力奖赏</view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="container">
  65. <view v-for="(item, index) in iconList" :key="index" @click="jump(item.url,item.auth)">
  66. <block v-if="item.name == '分割线'">
  67. <view style="padding: 10rpx 20rpx;">
  68. <u-line></u-line>
  69. </view>
  70. </block>
  71. <block v-else>
  72. <view class="flex justify-between align-center" style="padding: 38rpx;">
  73. <view class="flex align-center">
  74. <view class="flex align-center">
  75. <image :src="item.icon" style="width: 38rpx;height: 38rpx;"></image>
  76. </view>
  77. <view class="text-black text-bold padding-left-20" style="font-size: 30rpx;z-index: 99;">{{item.name}}
  78. </view>
  79. </view>
  80. <view class="">
  81. <text v-if="item.name!='更换主题'" class="cuIcon-right" style="color: #C4C4C4;"></text>
  82. <u-switch @change="themeChange" v-else v-model="themeChecked" size="40"
  83. active-color="#e72226" inactive-color="#6b4ff2"></u-switch>
  84. </view>
  85. </view>
  86. </block>
  87. </view>
  88. </view>
  89. <toast ref="toast" ></toast>
  90. <login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
  91. </view>
  92. </template>
  93. <script>
  94. import config from '../../assets/http/config.js'
  95. export default {
  96. data() {
  97. return {
  98. userId: '',
  99. userData: {},
  100. //更换主题
  101. themeChecked: true,
  102. iconList: [{
  103. name: '我的兑换',
  104. icon: '/static/mine/duihuan.png',
  105. url: '',
  106. auth: true //是否登录验证
  107. },
  108. {
  109. name: '我的作品',
  110. icon: '/static/mine/publish.png',
  111. url: '/pages/mine/my-product/my-product',
  112. auth: true //是否登录验证
  113. },
  114. {
  115. name: '我的助力',
  116. icon: '/static/mine/zhuli.png',
  117. url: '/pages/mine/my-help/my-help',
  118. auth: true //是否登录验证
  119. },
  120. {
  121. name: '分割线',
  122. icon: '',
  123. url: '',
  124. auth: false //是否登录验证
  125. },
  126. {
  127. name: '花积分',
  128. icon: '/static/mine/huajifen.png',
  129. url: '/pages/shop/shop',
  130. auth: false //是否登录验证
  131. },
  132. {
  133. name: '更多活动',
  134. icon: '/static/mine/huodong.png',
  135. url: 'more',
  136. auth: false //是否登录验证
  137. },
  138. {
  139. name: '活动规则',
  140. icon: '/static/mine/guize.png',
  141. url: '/pages/webview/point_rule?url=https://vote.guosen-fumao.cn/point_rule.html',
  142. auth: false
  143. },
  144. // {
  145. // name: '更换主题',
  146. // icon: '/static/mine/theme.png',
  147. // url: 'theme',
  148. // auth: false
  149. // },
  150. ],
  151. }
  152. },
  153. onLoad() {
  154. },
  155. methods: {
  156. init() {
  157. this.fetchUserInfo()
  158. },
  159. jump(url, auth) {
  160. if (url=='more') {
  161. this.$u.toast('暂无更多活动')
  162. return
  163. }
  164. if (this.$isEmpty(url)) {
  165. this.$u.toast('暂未开放')
  166. return
  167. }
  168. if (url == '/pages/shop/shop') {
  169. uni.switchTab({
  170. url
  171. })
  172. return
  173. }
  174. if (auth && this.$isEmpty(this.vuex_userId)) {
  175. this.showLogin()
  176. return
  177. }
  178. uni.navigateTo({
  179. url
  180. })
  181. },
  182. fetchUserInfo() {
  183. let params = {
  184. id: this.vuex_userId
  185. }
  186. this.$api.loginUser.detail(params).then(res => {
  187. if (this.$isNotEmpty(res.data.data)) {
  188. this.userData = res.data.data
  189. let userInfo = this.userData
  190. userInfo.sessionKey = this.$cache.get('userInfo').sessionKey
  191. this.$cache.put('userInfo', userInfo)
  192. this.$u.vuex('vuex_phone', this.userData.phone)
  193. }
  194. })
  195. },
  196. themeChange() {
  197. if (!this.themeChecked) {
  198. this.$u.vuex('vuex_skin', config.themeBlue.skin)
  199. this.$u.vuex('vuex_theme', config.themeBlue.theme)
  200. } else {
  201. this.$u.vuex('vuex_skin', config.themeRed.skin)
  202. this.$u.vuex('vuex_theme', config.themeRed.theme)
  203. }
  204. },
  205. }
  206. }
  207. </script>
  208. <style>
  209. .container {
  210. margin: 26upx;
  211. background-color: #ffffff;
  212. border-radius: 20upx;
  213. }
  214. .custom-style {
  215. width: 100upx;
  216. height: 50upx;
  217. color: #ffffff;
  218. font-size: 28rpx;
  219. }
  220. </style>