user.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482
  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">
  7. <image class="portrait" :src="userInfo.avatar || '/static/img/missing-face.png'"></image>
  8. <view class="he"><image class="image" v-if="userInfo.point.length != 0" src="../../static/img/hehuoren.png"></image></view>
  9. </view>
  10. <view class="">
  11. <view class="name">
  12. <view class="name-left clamp">{{ userInfo.phone || userInfo.email || '游客' }}</view>
  13. <view class="name-right">
  14. <image class="image" src="../../static/img/img28.png"></image>
  15. <view class="level" v-if="userInfo.level">{{ userInfo.level_info.name }}</view>
  16. <view class="level" v-else>V0</view>
  17. </view>
  18. </view>
  19. <view class="id">uid:{{ userInfo.uid }}</view>
  20. </view>
  21. </view>
  22. <view class="config" @click="nav('/pages/set/userinfo')">
  23. <view class="myself"><image src="../../static/img/myself.png" mode=""></image></view>
  24. <view class="">
  25. 我的资料
  26. </view>
  27. </view>
  28. </view>
  29. <view class="main">
  30. <view class="title">我的工具</view>
  31. <view class="tt">
  32. <view class="tt-box" @click="nav('/pages/assets/myPing')">
  33. <image src="../../static/img/pinggou.png" class="tt-icon1" mode=""></image>
  34. <view class="tt-txt">我的拼购</view>
  35. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  36. </view>
  37. <view class="userInfo.point">
  38. <view class="tt-box" v-if="userInfo.point.length != 0" @click="nav('/pages/user/myNote')">
  39. <image src="../../static/img/myPoint.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>
  44. <view class="tt-box" @click="nav('/pages/market/myCalculation')">
  45. <image src="../../static/img/myKJ.png" class="tt-icon1" mode=""></image>
  46. <view class="tt-txt">我的矿机</view>
  47. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  48. </view>
  49. <view class="tt-box" @click="nav('/pages/index/info')" v-if="userInfo.level >= 4">
  50. <image src="../../static/img/data.png" class="tt-icon1" mode=""></image>
  51. <view class="tt-txt">汇总数据</view>
  52. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  53. </view>
  54. <view class="tt-box" @click="nav('/pages/user/fulilist')">
  55. <image src="../../static/img/gift.png" class="tt-icon1" mode=""></image>
  56. <view class="tt-txt">拼购福利</view>
  57. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  58. </view>
  59. <view class="tt-box" @click="nav('/pages/user/extension')">
  60. <image src="../../static/img/myTeam.png" class="tt-icon2" mode=""></image>
  61. <view class="tt-txt">我的团队</view>
  62. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  63. </view>
  64. <view class="tt-box" @click="nav('/pages/user/shareQrCode')">
  65. <image src="../../static/img/share.png" class="tt-icon3" mode=""></image>
  66. <view class="tt-txt">团队邀请</view>
  67. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  68. </view>
  69. <view class="tt-box" @click="server()">
  70. <image src="../../static/img/kefu.png" class="tt-icon1" mode=""></image>
  71. <view class="tt-txt">联系客服</view>
  72. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  73. </view>
  74. <view class="tt-box" @click="nav('/pages/set/set')">
  75. <image src="../../static/img/set.png" class="tt-icon5" mode=""></image>
  76. <view class="tt-txt">设置</view>
  77. <image src="../../static/img/jiantou.png" class="next-icon" mode=""></image>
  78. </view>
  79. </view>
  80. <view class="kb"></view>
  81. </view>
  82. <uni-popup ref="popup" type="center">
  83. <view class="popup">
  84. <view class="popup-dox">
  85. <image class="popup-logo" src="../../static/img/lianxi.png"></image>
  86. <view class="pop-title">已为您定制专属客服</view>
  87. <view>{{ weixin }}</view>
  88. <image class="popup-text" @longtap="bc_code" :src="erweima"></image>
  89. <view class="btn" @click="copy(weixin)">复制微信号</view>
  90. <view class="pop-tip flex">
  91. <view class="weixin"><image src="../../static/img/weixin.png" mode=""></image></view>
  92. <view>长按保存二维码</view>
  93. </view>
  94. </view>
  95. </view>
  96. <view class="close_icon" @click="close"><image src="../../static/img/Close.png"></image></view>
  97. </uni-popup>
  98. </view>
  99. </template>
  100. <script>
  101. import uniCopy from '@/components/js_sdk/xb-copy/uni-copy.js';
  102. import { mapState, mapMutations } from 'vuex';
  103. import uniList from '@/components/uni-list/uni-list.vue';
  104. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  105. import { orderData, getUserInfo, service } from '@/api/user.js';
  106. import { saveUrl, interceptor } from '@/utils/loginUtils.js';
  107. import uniPopup from '@/components/uni-popup/uni-popup.vue';
  108. export default {
  109. components: {
  110. uniList,
  111. uniListItem,
  112. uniPopup
  113. },
  114. data() {
  115. return {
  116. erweima: '',
  117. weixin: ''
  118. };
  119. },
  120. onShow() {
  121. //判断是否已经登录
  122. if (this.hasLogin) {
  123. this.loadBaseData();
  124. } else {
  125. uni.showModal({
  126. title: '登录',
  127. content: '您未登录,是否马上登陆?',
  128. success: e => {
  129. if (e.confirm) {
  130. interceptor();
  131. }
  132. },
  133. fail: e => {
  134. console.log(e);
  135. }
  136. });
  137. }
  138. },
  139. computed: {
  140. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  141. },
  142. methods: {
  143. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  144. loadBaseData() {
  145. console.log(this.userInfo);
  146. getUserInfo({}).then(({ data }) => {
  147. this.setUserInfo(data);
  148. });
  149. service({}).then(({ data }) => {
  150. this.erweima = data.service_qr;
  151. this.weixin = data.service_wechat;
  152. });
  153. },
  154. server() {
  155. this.$refs.popup.open();
  156. },
  157. close() {
  158. this.$refs.popup.close();
  159. },
  160. nav(url) {
  161. // 判断是否已经登录
  162. // if (this.hasLogin) {
  163. console.log(url);
  164. uni.navigateTo({
  165. url: url,
  166. fail() {
  167. uni.switchTab({
  168. url: url
  169. });
  170. }
  171. });
  172. // }else {
  173. // uni.showModal({
  174. // title: '登录',
  175. // content: '您未登录,是否马上登陆?',
  176. // success: e => {
  177. // if (e.confirm) {
  178. // interceptor();
  179. // }
  180. // },
  181. // fail: e => {{}
  182. // console.log(e);
  183. // }
  184. // });
  185. // }
  186. },
  187. bc_code() {
  188. let that = this;
  189. console.log('保存二维码', this.erweima);
  190. uni.downloadFile({
  191. //获得二维码的临时地址
  192. url: this.erweima,
  193. success: res => {
  194. //console.log('获取url',res)
  195. if (res.statusCode == 200) {
  196. uni.saveImageToPhotosAlbum({
  197. filePath: res.tempFilePath, //传入临时地址
  198. success() {
  199. that.$api.msg('保存成功'); //封装的提示
  200. },
  201. fail() {
  202. that.$api.msg('保存失败');
  203. }
  204. });
  205. }
  206. }
  207. });
  208. },
  209. copy(value) {
  210. let obj = this;
  211. let content = value; //需要复制的内容
  212. console.log('复制的内容:', content);
  213. // content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  214. const result = uniCopy(content);
  215. if (result === false) {
  216. uni.showToast({
  217. title: '不支持'
  218. });
  219. } else {
  220. uni.showToast({
  221. title: '复制成功',
  222. icon: 'none'
  223. });
  224. }
  225. }
  226. }
  227. };
  228. </script>
  229. <style lang="scss">
  230. page {
  231. height: 100%;
  232. background: #ffffff;
  233. }
  234. .container {
  235. height: 100%;
  236. background: #ffffff;
  237. }
  238. .kb {
  239. height: 100rpx;
  240. }
  241. .top {
  242. width: 100%;
  243. height: 340rpx;
  244. position: relative;
  245. .bg {
  246. position: absolute;
  247. width: 100%;
  248. height: 340rpx;
  249. left: 0;
  250. top: 0;
  251. right: 0;
  252. image {
  253. width: 100%;
  254. height: 100%;
  255. }
  256. }
  257. .user {
  258. position: relative;
  259. padding-top: 98rpx;
  260. padding-left: 34rpx;
  261. display: flex;
  262. justify-content: flex-start;
  263. align-items: center;
  264. z-index: 10;
  265. .avtor {
  266. width: 102rpx;
  267. height: 102rpx;
  268. border-radius: 50%;
  269. position: relative;
  270. .portrait {
  271. width: 100%;
  272. height: 100%;
  273. border-radius: 50%;
  274. }
  275. .he {
  276. position: absolute;
  277. height: 30rpx;
  278. bottom: -4rpx;
  279. left: 0;
  280. .image {
  281. width: 102rpx;
  282. height: 30rpx;
  283. }
  284. }
  285. }
  286. .name {
  287. margin-left: 30rpx;
  288. font-size: 36rpx;
  289. font-family: PingFang SC;
  290. font-weight: 500;
  291. color: #ffffff;
  292. display: flex;
  293. justify-content: start;
  294. .name-left {
  295. max-width: 220rpx;
  296. }
  297. .name-right {
  298. margin-left: 20rpx;
  299. width: 50rpx;
  300. height: 60rpx;
  301. position: relative;
  302. image {
  303. width: 100%;
  304. height: 100%;
  305. }
  306. .level {
  307. position: absolute;
  308. top: 35%;
  309. left: 50%;
  310. margin-left: -12rpx;
  311. font-size: 20rpx;
  312. }
  313. }
  314. }
  315. .id {
  316. margin-left: 30rpx;
  317. font-size: 30rpx;
  318. font-family: PingFang SC;
  319. font-weight: 500;
  320. color: #ffffff;
  321. }
  322. }
  323. }
  324. .main {
  325. position: relative;
  326. z-index: 11;
  327. width: 100%;
  328. height: 100%;
  329. background: #ffffff;
  330. margin-top: -70rpx;
  331. border-top-left-radius: 60rpx;
  332. border-top-right-radius: 60rpx;
  333. .title {
  334. padding-top: 65rpx;
  335. padding-left: 36rpx;
  336. font-size: 36rpx;
  337. font-family: PingFang SC;
  338. font-weight: bold;
  339. color: #333333;
  340. }
  341. .tt {
  342. margin: 0 auto;
  343. width: 750rpx;
  344. padding: 40rpx 70rpx;
  345. border-radius: 10rpx;
  346. background-color: #ffffff;
  347. .tt-box {
  348. height: 100rpx;
  349. display: flex;
  350. align-items: center;
  351. border-bottom: 1px solid #f0f0f0;
  352. .tt-icon1 {
  353. width: 42rpx;
  354. height: 42rpx;
  355. }
  356. .tt-icon2 {
  357. width: 49rpx;
  358. height: 38rpx;
  359. }
  360. .tt-icon3 {
  361. width: 46rpx;
  362. height: 40rpx;
  363. }
  364. .tt-icon4 {
  365. width: 40rpx;
  366. height: 42rpx;
  367. }
  368. .tt-icon5 {
  369. width: 44rpx;
  370. height: 40rpx;
  371. }
  372. .tt-txt {
  373. margin-left: 36rpx;
  374. font-size: 32rpx;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. color: #333333;
  378. flex: 1;
  379. }
  380. .next-icon {
  381. width: 16rpx;
  382. height: 25rpx;
  383. }
  384. }
  385. .border-b {
  386. border-bottom: 1px solid #f1f1f1;
  387. }
  388. }
  389. }
  390. .popup {
  391. width: 640rpx;
  392. background-color: #ffffff;
  393. border-radius: 15rpx;
  394. text-align: center;
  395. .popup-dox {
  396. position: relative;
  397. top: -60rpx;
  398. .popup-logo {
  399. width: 460rpx;
  400. height: 132rpx;
  401. }
  402. .pop-title {
  403. font-size: 40rpx;
  404. font-weight: bold;
  405. color: #333333;
  406. padding: 25rpx 0rpx;
  407. margin-bottom: 50rpx;
  408. }
  409. .popup-text {
  410. width: 400rpx;
  411. height: 400rpx;
  412. margin-bottom: 50rpx;
  413. }
  414. .btn {
  415. width: 300rpx;
  416. height: 50rpx;
  417. line-height: 50rpx;
  418. background: linear-gradient(90deg, #60bab0, #60bab0, #45969b);
  419. margin: 0 auto;
  420. color: #ffffff;
  421. border-radius: 25rpx;
  422. }
  423. .pop-tip {
  424. font-size: 30rpx;
  425. font-weight: 500;
  426. color: #333333;
  427. justify-content: center;
  428. margin-top: 20rpx;
  429. .weixin {
  430. width: 48rpx;
  431. height: 40rpx;
  432. margin-right: 14rpx;
  433. image {
  434. width: 48rpx;
  435. height: 40rpx;
  436. }
  437. }
  438. }
  439. }
  440. }
  441. .close_icon {
  442. width: 60rpx;
  443. height: 60rpx;
  444. margin: 88rpx auto 0;
  445. image {
  446. width: 100%;
  447. height: 100%;
  448. }
  449. }
  450. .config {
  451. z-index: 10;
  452. background: #fff;
  453. text-align: right;
  454. font-size: 26rpx !important;
  455. border-radius: 34px 0px 0px 34px;
  456. position: absolute;
  457. top: 120rpx;
  458. right: 0;
  459. font-size: 20rpx;
  460. font-family: PingFang SC;
  461. font-weight: 500;
  462. color: #60bab0;
  463. line-height: 58rpx;
  464. padding:2rpx 20rpx;
  465. display: flex;
  466. align-items: center;
  467. .myself {
  468. padding-top: 12rpx;
  469. margin-right: 10rpx;
  470. image {
  471. height: 30rpx;
  472. width: 30rpx;
  473. }
  474. }
  475. }
  476. </style>