user.vue 11 KB

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