user.vue 11 KB

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