user.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321
  1. <template>
  2. <view class="container">
  3. <view class="top">
  4. <view class="bg"><image class="imgBg" src="../../static/img/user-bg.png" mode=""></image></view>
  5. <view class="user">
  6. <view class="avtor"><image class="portrait" :src="userInfo.avatar || '/static/img/missing-face.png'"></image></view>
  7. <view class="name">{{ userInfo.nickname || '游客' }}</view>
  8. </view>
  9. </view>
  10. <view class="main">
  11. <view class="title">我的工具</view>
  12. <view class="tt">
  13. <view class="tt-box" @click="nav('/pages/assets/myPing')">
  14. <image src="../../static/img/pinggou.png" class="tt-icon1" mode=""></image>
  15. <view class="tt-txt">我的拼购</view>
  16. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  17. </view>
  18. <view class="tt-box" @click="nav('/pages/user/extension')">
  19. <image src="../../static/img/myTeam.png" class="tt-icon2" mode=""></image>
  20. <view class="tt-txt">我的团队</view>
  21. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  22. </view>
  23. <view class="tt-box" @click="nav('/pages/user/shareQrCode')">
  24. <image src="../../static/img/share.png" class="tt-icon3" mode=""></image>
  25. <view class="tt-txt">团队邀请</view>
  26. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  27. </view>
  28. <view class="tt-box" @click="nav('/pages/money/payment')">
  29. <image src="../../static/img/zfpwd.png" class="tt-icon4" mode=""></image>
  30. <view class="tt-txt">支付密码</view>
  31. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  32. </view>
  33. <view class="tt-box" @click="nav('/pages/public/forget')">
  34. <image src="../../static/img/pwd.png" class="tt-icon1" mode=""></image>
  35. <view class="tt-txt">登录密码</view>
  36. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  37. </view>
  38. <view class="tt-box" @click="server()">
  39. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  40. <view class="tt-txt">联系客服</view>
  41. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  42. </view>
  43. <view class="tt-box" @click="nav('/pages/set/userinfo')">
  44. <image src="../../static/img/set.png" class="tt-icon5" mode=""></image>
  45. <view class="tt-txt">设置</view>
  46. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  47. </view>
  48. </view>
  49. </view>
  50. <uni-popup ref="popup" type="center">
  51. <view class="popup">
  52. <view class="popup-dox">
  53. <image class="popup-logo" src="../../static/img/lianxi.png"></image>
  54. <view class="pop-title">已为您定制专属客服</view>
  55. <image class="popup-text" src=""></image>
  56. <view class="pop-tip flex"><view class="weixin"><image src="../../static/img/weixin.png" mode=""></image></view><view>长按识别咨询客服</view></view>
  57. </view>
  58. </view>
  59. <view class="close_icon" @click="close"><image src="../../static/img/Close.png"></image></view>
  60. </uni-popup>
  61. </view>
  62. </template>
  63. <script>
  64. import { mapState, mapMutations } from 'vuex';
  65. import uniList from '@/components/uni-list/uni-list.vue';
  66. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  67. import { orderData, getUserInfo } from '@/api/user.js';
  68. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  69. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  70. export default {
  71. components: {
  72. uniList,
  73. uniListItem,
  74. uniPopup
  75. },
  76. data() {
  77. return {};
  78. },
  79. onShow() {
  80. //判断是否已经登录
  81. if (this.hasLogin) {
  82. this.loadBaseData();
  83. }else{
  84. uni.showModal({
  85. title: '登录',
  86. content: '您未登录,是否马上登陆?',
  87. success: e => {
  88. if (e.confirm) {
  89. interceptor();
  90. }
  91. },
  92. fail: e => {
  93. console.log(e);
  94. }
  95. });
  96. }
  97. },
  98. computed: {
  99. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  100. },
  101. methods: {
  102. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  103. loadBaseData() {
  104. getUserInfo({}).then(({
  105. data
  106. }) => {
  107. this.setUserInfo(data);
  108. });
  109. },
  110. server(){
  111. this.$refs.popup.open();
  112. },
  113. close(){
  114. this.$refs.popup.close();
  115. },
  116. nav(url) {
  117. // 判断是否已经登录
  118. // if (this.hasLogin) {
  119. console.log(url)
  120. uni.navigateTo({
  121. url: url,
  122. fail() {
  123. uni.switchTab({
  124. url:url
  125. })
  126. }
  127. })
  128. // }else {
  129. // uni.showModal({
  130. // title: '登录',
  131. // content: '您未登录,是否马上登陆?',
  132. // success: e => {
  133. // if (e.confirm) {
  134. // interceptor();
  135. // }
  136. // },
  137. // fail: e => {
  138. // console.log(e);
  139. // }
  140. // });
  141. // }
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss">
  147. page {
  148. height: 100%;
  149. background: #ffffff;
  150. }
  151. .container {
  152. height: 100%;
  153. background: #ffffff;
  154. }
  155. .top {
  156. width: 100%;
  157. height: 320rpx;
  158. position: relative;
  159. .bg {
  160. position: absolute;
  161. width: 100%;
  162. height: 320rpx;
  163. left: 0;
  164. top: 0;
  165. right: 0;
  166. image {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. }
  171. .user {
  172. position: relative;
  173. padding-top: 98rpx;
  174. padding-left: 34rpx;
  175. display: flex;
  176. justify-content: flex-start;
  177. align-items: center;
  178. z-index: 10;
  179. .avtor {
  180. width: 102rpx;
  181. height: 102rpx;
  182. border-radius: 50%;
  183. .portrait {
  184. width: 100%;
  185. height: 100%;
  186. border-radius: 50%;
  187. }
  188. }
  189. .name {
  190. margin-left: 30rpx;
  191. font-size: 36rpx;
  192. font-family: PingFang SC;
  193. font-weight: 500;
  194. color: #ffffff;
  195. }
  196. }
  197. }
  198. .main {
  199. position: relative;
  200. z-index: 11;
  201. width: 100%;
  202. height: 100%;
  203. background: #ffffff;
  204. margin-top: -70rpx;
  205. border-top-left-radius: 60rpx;
  206. border-top-right-radius: 60rpx;
  207. .title {
  208. padding-top: 65rpx;
  209. padding-left: 36rpx;
  210. font-size: 36rpx;
  211. font-family: PingFang SC;
  212. font-weight: bold;
  213. color: #333333;
  214. }
  215. .tt {
  216. margin: 0 auto;
  217. width: 750rpx;
  218. padding: 40rpx 70rpx;
  219. border-radius: 10rpx;
  220. background-color: #ffffff;
  221. .tt-box {
  222. height: 100rpx;
  223. display: flex;
  224. align-items: center;
  225. border-bottom: 1px solid #f0f0f0;
  226. .tt-icon1 {
  227. width: 42rpx;
  228. height: 42rpx;
  229. }
  230. .tt-icon2 {
  231. width: 49rpx;
  232. height: 38rpx;
  233. }
  234. .tt-icon3 {
  235. width: 46rpx;
  236. height: 40rpx;
  237. }
  238. .tt-icon4 {
  239. width: 40rpx;
  240. height: 42rpx;
  241. }
  242. .tt-icon5 {
  243. width: 44rpx;
  244. height: 40rpx;
  245. }
  246. .tt-txt {
  247. margin-left: 36rpx;
  248. font-size: 32rpx;
  249. font-family: PingFang SC;
  250. font-weight: 500;
  251. color: #333333;
  252. flex: 1;
  253. }
  254. .next-icon {
  255. width: 16rpx;
  256. height: 25rpx;
  257. }
  258. }
  259. .border-b {
  260. border-bottom: 1px solid #f1f1f1;
  261. }
  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. justify-content: center;
  293. .weixin {
  294. width: 48rpx;
  295. height: 40rpx;
  296. margin-right: 14rpx;
  297. image{
  298. width: 48rpx;
  299. height: 40rpx;
  300. }
  301. }
  302. }
  303. }
  304. }
  305. .close_icon {
  306. width: 60rpx;
  307. height: 60rpx;
  308. margin: 88rpx auto 0;
  309. image {
  310. width: 100%;
  311. height: 100%;
  312. }
  313. }
  314. </style>