user.vue 9.2 KB

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