mine.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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}}</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}}</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;">{{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. <login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
  90. </view>
  91. </template>
  92. <script>
  93. import config from '../../assets/http/config.js'
  94. export default {
  95. data() {
  96. return {
  97. userId: '',
  98. userData: {},
  99. //更换主题
  100. themeChecked: true,
  101. iconList: [{
  102. name: '我的兑换',
  103. icon: '/static/mine/duihuan.png',
  104. url: '',
  105. auth: true //是否登录验证
  106. },
  107. {
  108. name: '我的助力',
  109. icon: '/static/mine/zhuli.png',
  110. url: '/pages/mine/my-help/my-help',
  111. auth: true //是否登录验证
  112. },
  113. {
  114. name: '分割线',
  115. icon: '',
  116. url: '',
  117. auth: false //是否登录验证
  118. },
  119. {
  120. name: '花积分',
  121. icon: '/static/mine/huajifen.png',
  122. url: '/pages/shop/shop',
  123. auth: false //是否登录验证
  124. },
  125. {
  126. name: '更多活动',
  127. icon: '/static/mine/huodong.png',
  128. url: '',
  129. auth: false //是否登录验证
  130. },
  131. {
  132. name: '活动规则',
  133. icon: '/static/mine/guize.png',
  134. url: '',
  135. auth: false //是否登录验证
  136. },
  137. {
  138. name: '更换主题',
  139. icon: '/static/mine/theme.png',
  140. url: '',
  141. auth: false //是否登录验证
  142. },
  143. ],
  144. }
  145. },
  146. onLoad() {
  147. },
  148. methods: {
  149. init() {
  150. this.fetchUserInfo()
  151. },
  152. jump(url,auth){
  153. if (this.$isEmpty(url)) {
  154. this.$u.toast('暂未开放')
  155. return
  156. }
  157. if (url=='/pages/shop/shop') {
  158. uni.switchTab({
  159. url
  160. })
  161. return
  162. }
  163. if (auth && this.$isEmpty(this.vuex_userId)) {
  164. this.showLogin()
  165. return
  166. }
  167. uni.navigateTo({
  168. url
  169. })
  170. },
  171. fetchUserInfo() {
  172. let params = {
  173. id: this.vuex_userId
  174. }
  175. this.$api.loginUser.detail(params).then(res => {
  176. if (this.$isNotEmpty(res.data.data)) {
  177. this.userData=res.data.data
  178. let userInfo=this.userData
  179. userInfo.sessionKey=this.$cache.get('userInfo').sessionKey
  180. this.$cache.put('userInfo',userInfo)
  181. this.$u.vuex('vuex_phone',this.userData.phone)
  182. }
  183. })
  184. },
  185. themeChange() {
  186. if (!this.themeChecked) {
  187. this.$u.vuex('vuex_skin', config.themeBlue.skin)
  188. this.$u.vuex('vuex_theme', config.themeBlue.theme)
  189. } else {
  190. this.$u.vuex('vuex_skin', config.themeRed.skin)
  191. this.$u.vuex('vuex_theme', config.themeRed.theme)
  192. }
  193. },
  194. }
  195. }
  196. </script>
  197. <style>
  198. .container {
  199. margin: 26upx;
  200. background-color: #ffffff;
  201. border-radius: 20upx;
  202. }
  203. .custom-style {
  204. width: 100upx;
  205. height: 50upx;
  206. color: #ffffff;
  207. font-size: 28rpx;
  208. }
  209. </style>