user.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="container">
  3. <view class="user-box flex">
  4. <view class="user-info">
  5. <view class="name">我的</view>
  6. <view class="phone">{{phone}}</view>
  7. <view class="uuid">UID:{{userInfo.uid}}</view>
  8. <view class="level-box">
  9. <image class="image" src="../../static/img/img28.png"></image>
  10. <view class="level">V{{userInfo.level}}</view>
  11. </view>
  12. </view>
  13. <image class="header" :src="userInfo.avatar"></image>
  14. </view>
  15. <view class="list-box">
  16. <view class="list-title">我的工具</view>
  17. <view class="list-cell flex" @click="navTo('/pages/user/myTeam')">
  18. <view class="cell-info flex_item">
  19. <image src="../../static/img/img17.png"></image>
  20. <view class="cell-name">我的分享</view>
  21. </view>
  22. <image src="../../static/img/img23.png"></image>
  23. </view>
  24. <view class="list-cell flex" @click="navTo('/pages/index/share')">
  25. <view class="cell-info flex_item">
  26. <image class="img1" src="../../static/img/img18.png"></image>
  27. <view class="cell-name">邀请链接</view>
  28. </view>
  29. <image src="../../static/img/img23.png"></image>
  30. </view>
  31. <view class="list-cell flex" @click="navTo('/pages/user/payment')">
  32. <view class="cell-info flex_item">
  33. <image class="img2" src="../../static/img/img19.png"></image>
  34. <view class="cell-name">支付密码</view>
  35. </view>
  36. <image src="../../static/img/img23.png"></image>
  37. </view>
  38. <view class="list-cell flex" @click="navTo('/pages/user/loginPass')">
  39. <view class="cell-info flex_item">
  40. <image class="img3" src="../../static/img/img20.png"></image>
  41. <view class="cell-name">登录密码</view>
  42. </view>
  43. <image src="../../static/img/img23.png"></image>
  44. </view>
  45. <view class="list-cell flex" @click="navTo('/pages/user/meaasge')">
  46. <view class="cell-info flex_item">
  47. <image class="img4" src="../../static/img/img21.png"></image>
  48. <view class="cell-name">消息通知</view>
  49. </view>
  50. <image src="../../static/img/img23.png"></image>
  51. </view>
  52. <view class="list-cell flex" @click="server()">
  53. <view class="cell-info flex_item">
  54. <image class="img4" src="../../static/img/img47.png"></image>
  55. <view class="cell-name">联系客服</view>
  56. </view>
  57. <image src="../../static/img/img23.png"></image>
  58. </view>
  59. <view class="list-cell flex" @click="navTo('/pages/set/set')">
  60. <view class="cell-info flex_item">
  61. <image class="img5" src="../../static/img/img22.png"></image>
  62. <view class="cell-name">设置</view>
  63. </view>
  64. <image src="../../static/img/img23.png"></image>
  65. </view>
  66. </view>
  67. <!-- 申请退款弹窗 -->
  68. <uni-popup ref="popup" type="center">
  69. <view class="popup">
  70. <view class="popup-dox">
  71. <image class="popup-logo" src="../../static/img/img48.png"></image>
  72. <view class="pop-title">已为您定制专属客服</view>
  73. <image class="popup-text" src="../../static/img/img50.png"></image>
  74. <view class="pop-tip">微信咨询客服</view>
  75. </view>
  76. </view>
  77. <view class="close_icon" @click="close"><image src="../../static/img/img49.png"></image></view>
  78. </uni-popup>
  79. </view>
  80. </template>
  81. <script>
  82. import { getUserInfo,getUser } from '@/api/user.js';
  83. import { mapState, mapMutations } from 'vuex';
  84. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  85. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  86. export default {
  87. components: {
  88. uniPopup
  89. },
  90. data() {
  91. return {
  92. userInfo:'',
  93. phone:'',
  94. };
  95. },
  96. onLoad(option){
  97. saveUrl();
  98. },
  99. onShow() {
  100. // 判断是否已经登录
  101. if (this.hasLogin) {
  102. this.loadBaseData();
  103. } else {
  104. this.userInfo = '';
  105. }
  106. },
  107. //下拉刷新
  108. onPullDownRefresh() {
  109. this.loadBaseData();
  110. setTimeout(function () {
  111. uni.stopPullDownRefresh();
  112. }, 1000);
  113. },
  114. computed: {
  115. ...mapState('user', ['hasLogin'])
  116. },
  117. methods: {
  118. ...mapMutations('user', ['setUserInfo']),
  119. // 加载初始数据
  120. loadBaseData() {
  121. let obj = this;
  122. getUserInfo({})
  123. .then(({ data }) => {
  124. obj.userInfo = data;
  125. var tel = obj.userInfo.account;
  126. var reg = /^(\d{3})\d{4}(\d{4})$/;
  127. obj.phone = tel.replace(reg, "$1****$2");
  128. obj.setUserInfo(data);
  129. })
  130. .catch(e => {
  131. console.log(e);
  132. });
  133. },
  134. server(){
  135. this.$refs.popup.open();
  136. },
  137. close(){
  138. this.$refs.popup.close();
  139. },
  140. /**
  141. * 统一跳转接口,拦截未登录路由
  142. * navigator标签现在默认没有转场动画,所以用view
  143. */
  144. navTo(url) {
  145. uni.navigateTo({
  146. url
  147. });
  148. },
  149. }
  150. };
  151. </script>
  152. <style lang="scss">
  153. page {
  154. min-height: 100%;
  155. background-color: #ffffff;
  156. .container {
  157. width: 100%;
  158. padding-bottom: 50rpx;
  159. }
  160. }
  161. .user-box{
  162. width: 100%;
  163. height: 440rpx;
  164. padding: 60rpx 35rpx;
  165. background-image: url(../../static/img/logo.png);
  166. background-size: 100% 100%;
  167. color: #FFFFFF;
  168. align-items: flex-start;
  169. .header{
  170. width: 125rpx;
  171. height: 125rpx;
  172. border-radius: 100%;
  173. margin-top: 10%;
  174. }
  175. }
  176. .user-info{
  177. padding-left: 30rpx;
  178. .name{
  179. font-weight: 500;
  180. font-size: 48rpx;
  181. }
  182. .phone{
  183. font-size: 42rpx;
  184. font-weight: 500;
  185. color: #FFFFFF;
  186. padding-top: 50rpx;
  187. }
  188. .uuid{
  189. font-size: 30rpx;
  190. padding-top: 20rpx;
  191. }
  192. .level-box{
  193. margin-top: 25rpx;
  194. position: relative;
  195. .image{
  196. width: 128rpx;
  197. height:45rpx;
  198. }
  199. .level{
  200. position: absolute;
  201. top: 12rpx;
  202. left: 62rpx;
  203. font-size: 24rpx;
  204. color: #826740;
  205. font-weight: bold;
  206. }
  207. }
  208. }
  209. .list-box{
  210. width: 100%;
  211. margin-top: -60rpx;
  212. background-color: #FFFFFF;
  213. border-top-right-radius: 70rpx;
  214. border-top-left-radius: 70rpx;
  215. padding: 60rpx 66rpx 0rpx 55rpx;
  216. .list-title{
  217. font-weight: bold;
  218. color: #333333;
  219. font-size: 36rpx;
  220. }
  221. .list-cell{
  222. padding-top: 40rpx;
  223. border-bottom: 1rpx solid #F3F3F3;
  224. padding-bottom: 30rpx;
  225. .cell-info{
  226. image{
  227. width: 49rpx;
  228. height: 38rpx;
  229. }
  230. .cell-name{
  231. padding-left: 17rpx;
  232. color: #666666;
  233. font-size: 30rpx;
  234. font-weight: 500;
  235. }
  236. }
  237. image{
  238. width: 16rpx;
  239. height: 25rpx;
  240. }
  241. }
  242. }
  243. .img1{
  244. width: 46rpx !important;
  245. height: 40rpx !important;
  246. }
  247. .img2{
  248. width: 40rpx !important;
  249. height: 42rpx !important;
  250. }
  251. .img3{
  252. width: 42rpx !important;
  253. height: 42rpx !important;
  254. }
  255. .img4{
  256. width: 42rpx !important;
  257. height: 41rpx !important;
  258. }
  259. .img5{
  260. width: 44rpx !important;
  261. height: 40rpx !important;
  262. }
  263. //弹窗
  264. .popup {
  265. width: 640rpx;
  266. background-color: #FFFFFF;
  267. border-radius: 15rpx;
  268. text-align: center;
  269. .popup-dox{
  270. position: relative;
  271. top: -60rpx;
  272. .popup-logo {
  273. width: 460rpx;
  274. height: 132rpx;
  275. }
  276. .pop-title{
  277. font-size: 40rpx;
  278. font-weight: bold;
  279. color: #333333;
  280. padding: 25rpx 0rpx;
  281. margin-bottom: 50rpx;
  282. }
  283. .popup-text{
  284. width: 400rpx;
  285. height: 400rpx;
  286. margin-bottom: 50rpx;
  287. }
  288. .pop-tip{
  289. font-size: 30rpx;
  290. font-weight: 500;
  291. color: #333333;
  292. }
  293. }
  294. }
  295. .close_icon {
  296. width: 60rpx;
  297. height: 60rpx;
  298. margin: 88rpx auto 0;
  299. image {
  300. width: 100%;
  301. height: 100%;
  302. }
  303. }
  304. </style>