mine.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <view :style="vuex_skin">
  3. <!-- #ifdef MP-WEIXIN -->
  4. <u-navbar title-color="#000000" :is-back="false" title="我的"></u-navbar>
  5. <!-- #endif -->
  6. <view class="container" :style="vuex_skin">
  7. <view class="flex justify-between align-center" style="padding: 40rpx 30rpx;" v-if="vuex_userId">
  8. <view class="padding-left">
  9. <view class="text-black text-bold text-xl padding-bottom-20">
  10. {{userData.nickName || ''}}
  11. </view>
  12. <view class="flex align-center padding-top-sm">
  13. <view>
  14. <view class="text-black text-bold center">{{userHeatAndPoint.userVoteCount || 0}}</view>
  15. <view class="text-gray text-sm margin-top-10">票数</view>
  16. </view>
  17. <view style="height: 60upx;border: #D2D2D2 1px solid; margin: 0 30upx;"></view>
  18. <view>
  19. <view class="text-black text-bold center">{{userHeatAndPoint.userPufaPoint || 0}}</view>
  20. <view class="text-gray text-sm margin-top-10">积分</view>
  21. </view>
  22. <view class="padding-left">
  23. <button class="cu-btn sm line-black round center"
  24. @click="jump('/pages/mine/info/info?edit=true',true)">
  25. <text class="cuIcon-post " style="font-size: 26rpx;margin-right: 4rpx;"></text>
  26. <text>修改资料</text>
  27. </button>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="flex align-center" @click="$jump('/pages/mine/info/info',true)">
  32. <view class="padding-right-10">
  33. <u-avatar :src="userData.avatar" size="100"></u-avatar>
  34. </view>
  35. <view class="">
  36. <text class="cuIcon-right" style="color: #C4C4C4;"></text>
  37. </view>
  38. </view>
  39. </view>
  40. <view class="text-center flex" style="padding: 30rpx;" v-else>
  41. <view class="">
  42. <u-avatar src="/static/icon/unlogin.png" size="110"></u-avatar>
  43. </view>
  44. <view class="center margin-left-20 " @click="showLogin">
  45. <view class="cu-btn sm round line-black">
  46. <text>点击授权登录</text>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="flex justify-around align-center" style="padding: 10rpx 40rpx 30rpx;">
  51. <view class="flex" @click="jump('/pages/mine/points/pointsDetail',true)">
  52. <image src="../../static/mine/points.png" style="width: 80upx;height: 80upx;"></image>
  53. <view class="padding-left-sm">
  54. <view class="text-bold text-lg">积分明细</view>
  55. <view class="text-gray text-sm" style="font-weight: 400;">消费赚积分</view>
  56. </view>
  57. </view>
  58. <view class="flex" @click="jump('/pages/mine/my-help/help-records',true)">
  59. <image src="../../static/mine/hot-value.png" style="width: 80upx;height: 80upx;"></image>
  60. <view class="padding-left-sm">
  61. <view class="text-bold text-lg">热力明细</view>
  62. <view class="text-gray text-sm" style="font-weight: 400;">助力奖赏</view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. <view class="container">
  68. <button :open-type="item.name=='联系我们'?'contact':''" v-if="item.show" class="u-reset-button"
  69. v-for="(item, index) in iconList" :key="index" @click="jump(item.url,item.auth)">
  70. <block v-if="item.name == '分割线'">
  71. <view style="padding: 10rpx 20rpx;">
  72. <u-line></u-line>
  73. </view>
  74. </block>
  75. <block v-else>
  76. <view class="flex justify-between align-center" style="padding: 38rpx;">
  77. <view class="flex align-center">
  78. <view class="flex align-center">
  79. <image :src="item.icon" style="width: 38rpx;height: 38rpx;"></image>
  80. </view>
  81. <view class="text-black text-bold padding-left-20" style="font-size: 30rpx;z-index: 99;">
  82. {{item.name}}
  83. </view>
  84. </view>
  85. <view class="">
  86. <text v-if="item.name!='更换主题'" class="cuIcon-right" style="color: #C4C4C4;"></text>
  87. <u-switch @change="themeChange" v-else v-model="themeChecked" size="40"
  88. active-color="#e72226" inactive-color="#6b4ff2"></u-switch>
  89. </view>
  90. </view>
  91. </block>
  92. </button>
  93. </view>
  94. <toast ref="toast"></toast>
  95. <login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
  96. <u-tabbar :bg-color="tabbar.bgColor" :icon-size="tabbar.iconSize" :height="100" :border-top="tabbar.borderTop"
  97. :inactive-color="tabbar.inactiveColor" :active-color="tabbar.activeColor" :list="tabbar.list">
  98. </u-tabbar>
  99. </view>
  100. </template>
  101. <script>
  102. import {
  103. tabbar
  104. } from "@/assets/http/tabbar.js"
  105. import config from '../../assets/http/config.js'
  106. export default {
  107. data() {
  108. return {
  109. //tabbar
  110. tabbar: {},
  111. userId: '',
  112. userData: {},
  113. userHeatAndPoint: {},
  114. //更换主题
  115. themeChecked: true,
  116. iconList: [{
  117. name: '我的兑换',
  118. icon: '/static/mine/duihuan.png',
  119. url: '/pages/mine/order/order',
  120. auth: true, //是否登录验证
  121. show: true
  122. },
  123. {
  124. name: '我的作品',
  125. icon: '/static/mine/publish.png',
  126. url: '/pages/mine/my-product/my-product',
  127. auth: true, //是否登录验证
  128. show: true
  129. },
  130. {
  131. name: '我的助力',
  132. icon: '/static/mine/zhuli.png',
  133. url: '/pages/mine/my-help/my-help',
  134. auth: true, //是否登录验证
  135. show: true
  136. },
  137. {
  138. name: '分割线',
  139. icon: '',
  140. url: '',
  141. auth: false, //是否登录验证
  142. show: true
  143. },
  144. {
  145. name: '更多活动',
  146. icon: '/static/mine/huodong.png',
  147. url: '/pages/activity/list',
  148. auth: false, //是否登录验证
  149. show: true
  150. },
  151. {
  152. name: '积分兑换规则',
  153. icon: '/static/mine/guize.png',
  154. url: '/pages/introduce/notice?title=积分规则',
  155. auth: false,
  156. show: false
  157. },
  158. {
  159. name: '联系我们',
  160. icon: '/static/mine/kefu.png',
  161. url: 'kefu',
  162. auth: false, //是否登录验证
  163. show: true
  164. },
  165. {
  166. name: '更换主题',
  167. icon: '/static/mine/theme.png',
  168. url: 'theme',
  169. auth: false,
  170. show: false
  171. },
  172. {
  173. name: '设置',
  174. icon: '/static/mine/mine-setting.png',
  175. url: '/pages/mine/setting/setting',
  176. auth: false,
  177. show: true
  178. },
  179. ],
  180. }
  181. },
  182. onLoad() {
  183. this.fetchTabbar()
  184. // #ifdef MP-WEIXIN
  185. uni.hideShareMenu()
  186. // #endif
  187. },
  188. methods: {
  189. /**
  190. * 更换主题
  191. */
  192. async fetchTabbar() {
  193. this.tabbar = tabbar
  194. if (this.vuex_theme.bgColor) {
  195. this.tabbar.activeColor = this.vuex_theme.bgColor
  196. } else {
  197. this.tabbar.activeColor = this.$config.themeRed.theme.bgColor
  198. }
  199. },
  200. init() {
  201. this.fetchUserInfo()
  202. this.fetchHeatValueAndPoint()
  203. },
  204. jump(url, auth) {
  205. if (url == 'kefu') {
  206. this.$dialog.showModal('是否添加客服微信?', true, this.vuex_theme.bgColor).then(res => {
  207. this.$util.copy('guoxinshuzi')
  208. })
  209. return
  210. }
  211. if (url == '/pages/shop/shop') {
  212. uni.switchTab({
  213. url
  214. })
  215. return
  216. }
  217. if (auth && this.$isEmpty(this.vuex_userId)) {
  218. this.showLogin()
  219. return
  220. }
  221. uni.navigateTo({
  222. url
  223. })
  224. },
  225. async fetchUserInfo() {
  226. let params = {
  227. id: this.vuex_userId
  228. }
  229. let res = await this.$api.loginUser.detail(params)
  230. if (this.$isNotEmpty(res.data.data)) {
  231. this.userData = res.data.data
  232. let userInfo = this.userData
  233. userInfo.sessionKey = this.$cache.get('userInfo').sessionKey
  234. this.$cache.put('userInfo', userInfo)
  235. this.$u.vuex('vuex_phone', this.userData.phone)
  236. } else {
  237. this.$cache.clear()
  238. this.$u.vuex('vuex_userId', null)
  239. this.$u.vuex('vuex_phone', null)
  240. this.showLogin()
  241. }
  242. },
  243. fetchHeatValueAndPoint() {
  244. if (!this.vuex_phone) {
  245. return
  246. }
  247. let params = {
  248. phone: this.vuex_phone
  249. }
  250. this.$api.loginUser.userHeatValueAndPufaPoint(params).then(res => {
  251. this.userHeatAndPoint = res.data.data
  252. })
  253. },
  254. themeChange() {
  255. if (!this.themeChecked) {
  256. this.$u.vuex('vuex_skin', config.themeBlue.skin)
  257. this.$u.vuex('vuex_theme', config.themeBlue.theme)
  258. } else {
  259. this.$u.vuex('vuex_skin', config.themeRed.skin)
  260. this.$u.vuex('vuex_theme', config.themeRed.theme)
  261. }
  262. },
  263. }
  264. }
  265. </script>
  266. <style>
  267. .container {
  268. margin: 26upx;
  269. background-color: #ffffff;
  270. border-radius: 20upx;
  271. }
  272. .custom-style {
  273. width: 100upx;
  274. height: 50upx;
  275. color: #ffffff;
  276. font-size: 28rpx;
  277. }
  278. </style>