user.vue 8.6 KB

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