mine.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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">{{userHeatAndPoint.userVoteCount || 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">{{userHeatAndPoint.userPufaPoint || 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. <button :open-type="item.name=='联系我们'?'contact':''" class="u-reset-button" 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. </button>
  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. userHeatAndPoint:{},
  101. //更换主题
  102. themeChecked: true,
  103. iconList: [{
  104. name: '我的兑换',
  105. icon: '/static/mine/duihuan.png',
  106. url: '/pages/mine/order/order',
  107. auth: true //是否登录验证
  108. },
  109. {
  110. name: '我的作品',
  111. icon: '/static/mine/publish.png',
  112. url: '/pages/mine/my-product/my-product',
  113. auth: true //是否登录验证
  114. },
  115. {
  116. name: '我的助力',
  117. icon: '/static/mine/zhuli.png',
  118. url: '/pages/mine/my-help/my-help',
  119. auth: true //是否登录验证
  120. },
  121. {
  122. name: '分割线',
  123. icon: '',
  124. url: '',
  125. auth: false //是否登录验证
  126. },
  127. {
  128. name: '花积分',
  129. icon: '/static/mine/huajifen.png',
  130. url: '/pages/shop/shop',
  131. auth: false //是否登录验证
  132. },
  133. {
  134. name: '积分兑换规则',
  135. icon: '/static/mine/guize.png',
  136. url: '/pages/rule/point',
  137. auth: false
  138. },
  139. {
  140. name: '联系我们',
  141. icon: '/static/mine/kefu.png',
  142. url: 'kefu',
  143. auth: false //是否登录验证
  144. },
  145. // {
  146. // name: '更换主题',
  147. // icon: '/static/mine/theme.png',
  148. // url: 'theme',
  149. // auth: false
  150. // },
  151. ],
  152. }
  153. },
  154. onLoad() {
  155. },
  156. methods: {
  157. init() {
  158. this.fetchUserInfo()
  159. this.fetchHeatValueAndPoint()
  160. },
  161. jump(url, auth) {
  162. if (url=='more') {
  163. this.$u.toast('暂无更多活动')
  164. return
  165. }
  166. if (this.$isEmpty(url)) {
  167. this.$u.toast('暂未开放')
  168. return
  169. }
  170. if (url == '/pages/shop/shop') {
  171. uni.switchTab({
  172. url
  173. })
  174. return
  175. }
  176. if (auth && this.$isEmpty(this.vuex_userId)) {
  177. this.showLogin()
  178. return
  179. }
  180. uni.navigateTo({
  181. url
  182. })
  183. },
  184. async fetchUserInfo() {
  185. let params = {
  186. id: this.vuex_userId
  187. }
  188. let res=await this.$api.loginUser.detail(params)
  189. if (this.$isNotEmpty(res.data.data)) {
  190. this.userData = res.data.data
  191. let userInfo = this.userData
  192. userInfo.sessionKey = this.$cache.get('userInfo').sessionKey
  193. this.$cache.put('userInfo', userInfo)
  194. this.$u.vuex('vuex_phone', this.userData.phone)
  195. }else{
  196. this.$cache.clear()
  197. this.$u.vuex('vuex_userId', null)
  198. this.$u.vuex('vuex_phone', null)
  199. this.showLogin()
  200. }
  201. },
  202. fetchHeatValueAndPoint() {
  203. if (!this.vuex_phone) {
  204. return
  205. }
  206. let params = {
  207. phone: this.vuex_phone
  208. }
  209. this.$api.loginUser.userHeatValueAndPufaPoint(params).then(res => {
  210. this.userHeatAndPoint=res.data.data
  211. })
  212. },
  213. themeChange() {
  214. if (!this.themeChecked) {
  215. this.$u.vuex('vuex_skin', config.themeBlue.skin)
  216. this.$u.vuex('vuex_theme', config.themeBlue.theme)
  217. } else {
  218. this.$u.vuex('vuex_skin', config.themeRed.skin)
  219. this.$u.vuex('vuex_theme', config.themeRed.theme)
  220. }
  221. },
  222. }
  223. }
  224. </script>
  225. <style>
  226. .container {
  227. margin: 26upx;
  228. background-color: #ffffff;
  229. border-radius: 20upx;
  230. }
  231. .custom-style {
  232. width: 100upx;
  233. height: 50upx;
  234. color: #ffffff;
  235. font-size: 28rpx;
  236. }
  237. </style>