user.vue 11 KB

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