user.vue 8.2 KB

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