user.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  1. <template>
  2. <view class="container">
  3. <scroll-view class="content-box" scroll-y="true">
  4. <view class="user-section">
  5. <view class="user-info-box ">
  6. <view class="detail flex">
  7. <view class="portrait-box" @click="navTo('/pages/set/userinfo')">
  8. <image class="portrait" :src="user.avatar || '/static/error/missing-face.png'"></image>
  9. </view>
  10. <view class="info-box">
  11. <view class="username flex-start">
  12. <text class="clamp padding-r-20">
  13. {{ user.nickname || '游客' }}
  14. </text>
  15. <view class="tipLevel flex-shrink-false">
  16. </view>
  17. </view>
  18. <view class="flex-start flex">
  19. <view class="authentication">{{user.mobile}}</view>
  20. </view>
  21. </view>
  22. <view class="righ-tbox flex">
  23. <image class="right-tip" src="../../static/icon/tiptop.png" mode="scaleToFill"></image>
  24. <block v-if="!user.work_type_title">
  25. 普通用户
  26. </block>
  27. <block v-else>
  28. {{user.work_type_title}}
  29. </block>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="nav-model flex" @click="navcard">
  35. <view class="right-card">
  36. <view class="title">
  37. 我的数字名片
  38. </view>
  39. <view class="tip" v-if="user.info_audit_status==-2">
  40. 审核成功即可获得母婴界数字名片
  41. </view>
  42. <view class="tip" v-else-if="user.info_audit_status==1">
  43. 点击查看您的母婴界数字名片
  44. </view>
  45. <view class="tip" v-else-if="user.info_audit_status==0&&user.work_type_id<=0">
  46. 数字名片资料审核中请等待审核完毕
  47. </view>
  48. <view class="tip" v-else-if="user.info_audit_status==0&&user.work_type_id>0">
  49. 修改数字名片资料审核中请等待审核完毕
  50. </view>
  51. </view>
  52. <image class="next" src="../../static/icon/next2.png" mode="scaleToFill"></image>
  53. </view>
  54. <!-- <view class="nav-model-rz flex" v-if="user.work_type_id>0&&user.type_audit_status!=1"
  55. @click="user.type_audit_status==0||navTo('/pages/user/model/shoprz')">
  56. <view class="tiptext" v-if="user.type_audit_status==-2">
  57. 您未完成平台认证,请立即认证>>
  58. </view>
  59. <view class="tiptext" v-else-if="user.type_audit_status==-1">
  60. 您平台认证失败,请重新认证>>
  61. </view>
  62. <view class="tiptext" v-else-if="user.type_audit_status==-3">
  63. 您平台认证已失效,请重新认证>>
  64. </view>
  65. <view class="tiptext" v-else-if="user.type_audit_status==0">
  66. 您已提交认证信息请等待认证结束
  67. </view>
  68. <view class="rztext" v-if="user.type_audit_status==-2">
  69. 立即认证
  70. </view>
  71. <view class="rztext" v-else-if='user.type_audit_status==-3||user.type_audit_status==-1'>
  72. 重新生成
  73. </view>
  74. </view> -->
  75. <view class="cover-container">
  76. <view class="listBox">
  77. <view class="list">
  78. <!-- <view class="flex listItem" @click="navTo('/pages/user/myCart/myCart')">
  79. <view class="flex titleBox">
  80. <image class="listIconImg" src="../../static/icon/mymoney.png" mode="widthFix"></image>
  81. <text class="title">我的钱包</text>
  82. </view>
  83. <view class="right flex">
  84. <text></text>
  85. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  86. </view>
  87. </view> -->
  88. <view class="flex listItem" @click="navTo('/pages/user/myteam')">
  89. <view class="flex titleBox">
  90. <image class="listIconImg" src="../../static/icon/myshare.png" mode="widthFix"></image>
  91. <text class="title">影响指数</text>
  92. </view>
  93. <view class="right flex">
  94. <text></text>
  95. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  96. </view>
  97. </view>
  98. <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  99. <view class="flex titleBox">
  100. <image class="listIconImg" src="../../static/icon/myshareimg.png" mode="widthFix">
  101. </image>
  102. <text class="title">邀请海报</text>
  103. </view>
  104. <view class="right flex">
  105. <text></text>
  106. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  107. </view>
  108. </view>
  109. <view class="flex listItem" @click="navTo('/pages/user/model/mymodellist')">
  110. <view class="flex titleBox">
  111. <image class="listIconImg" src="../../static/icon/mymodel.png" mode="widthFix"></image>
  112. <text class="title">我的模板</text>
  113. </view>
  114. <view class="right flex">
  115. <text></text>
  116. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  117. </view>
  118. </view>
  119. <!-- <view class="flex listItem" @click="navTo('/pages/user/myCart/myCart')">
  120. <view class="flex titleBox">
  121. <image class="listIconImg" src="../../static/icon/myaddress.png" mode="widthFix"></image>
  122. <text class="title">收货地址</text>
  123. </view>
  124. <view class="right flex">
  125. <text></text>
  126. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  127. </view>
  128. </view> -->
  129. <view class="flex listItem" @click="openCode">
  130. <view class="flex titleBox">
  131. <image class="listIconImg" src="../../static/icon/myCode.png" mode="widthFix"></image>
  132. <text class="title">激活模版</text>
  133. </view>
  134. <view class="right flex">
  135. <text></text>
  136. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  137. </view>
  138. </view>
  139. <view class="flex listItem" @click="navTo('/pages/user/mySc')">
  140. <view class="flex titleBox">
  141. <image class="listIconImg" src="../../static/icon/myinfo.png" mode="widthFix"></image>
  142. <text class="title">我的收藏</text>
  143. </view>
  144. <view class="right flex">
  145. <text></text>
  146. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  147. </view>
  148. </view>
  149. <!-- #ifdef MP -->
  150. <button hover-class="none" class="flex listItem" open-type='contact'>
  151. <view class="flex titleBox">
  152. <image class="listIconImg" src="../../static/icon/myserve.png" mode="widthFix"></image>
  153. <text class="title">客服中心</text>
  154. </view>
  155. <view class="right flex">
  156. <text></text>
  157. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  158. </view>
  159. </button>
  160. <!-- #endif -->
  161. <!-- #ifndef APP -->
  162. <!-- <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  163. <view class="flex titleBox">
  164. <image class="listIconImg" src="../../static/icon/myshare.png" mode="widthFix"></image>
  165. <text class="title">邀请好友</text>
  166. </view>
  167. <view class="right flex">
  168. <text></text>
  169. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  170. </view>
  171. </view> -->
  172. <!-- #endif -->
  173. <!-- #ifdef APP -->
  174. <view class="flex listItem" @click="shareDomApp">
  175. <view class="flex titleBox">
  176. <image class="listIconImg" src="../../static/icon/myshare.png" mode="widthFix"></image>
  177. <text class="title">邀请好友</text>
  178. </view>
  179. <view class="right flex">
  180. <text></text>
  181. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  182. </view>
  183. </view>
  184. <!-- #endif -->
  185. <!-- #ifndef MP -->
  186. <view class="flex listItem" @click="navTo('/pages/public/workwork')">
  187. <view class="flex titleBox">
  188. <image class="listIconImg" src="../../static/icon/myinfo.png" mode="widthFix"></image>
  189. <text class="title">关于我们</text>
  190. </view>
  191. <view class="right flex">
  192. <text></text>
  193. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  194. </view>
  195. </view>
  196. <!-- #endif -->
  197. <view class="flex listItem" @click="navTo('/pages/set/set')">
  198. <view class="flex titleBox">
  199. <image class="listIconImg" src="../../static/icon/myset.png" mode="widthFix"></image>
  200. <text class="title">系统设置</text>
  201. </view>
  202. <view class="right flex">
  203. <text></text>
  204. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. </view>
  210. </scroll-view>
  211. <uni-popup ref="popup" type="center">
  212. <swiper class="alertBox" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="1000">
  213. <swiper-item v-for="ls in ggList">
  214. <image @click="openXcx(ls)" class="alertImage" :src="ls.img" mode="scaleToFill"></image>
  215. </swiper-item>
  216. </swiper>
  217. </uni-popup>
  218. </view>
  219. </template>
  220. <script>
  221. import {
  222. mapState,
  223. mapMutations
  224. } from 'vuex';
  225. import {
  226. share
  227. } from '@/api/wx';
  228. import {
  229. getUser,
  230. useCode
  231. } from '@/api/user.js';
  232. // #ifdef MP
  233. // 不要删,删除会导致修改资料页面报错无法引用到该对象
  234. // import setAll from '@/api/set';
  235. // #endif
  236. import {
  237. articleList,
  238. notify
  239. } from '@/api/index.js';
  240. import {
  241. saveUrl,
  242. interceptor
  243. } from '@/utils/loginUtils.js';
  244. import {
  245. getBannerList
  246. } from '@/api/model.js';
  247. export default {
  248. data() {
  249. return {
  250. user: {
  251. avatar: '', //头像
  252. nickname: '', //昵称
  253. },
  254. shareData: {},
  255. ggList: [] ,//弹窗广告列表
  256. showGG:false,//判断是否已经显示广告
  257. };
  258. },
  259. computed: {
  260. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  261. ...mapState(['baseURL', 'urlFile']),
  262. ...mapState(['fx']),
  263. // #ifdef MP
  264. ...mapState(['systeam']),
  265. // #endif
  266. // 总消息条数
  267. notic() {
  268. return this.user.question_sum + this.user.notice_sum;
  269. },
  270. },
  271. // 创建时获取分享信息
  272. onLoad() {
  273. console.log(11223344);
  274. this.getGG();
  275. },
  276. onShow() {
  277. console.log(112233);
  278. this.getUser();
  279. console.log(this.showGG,'this.showGG');
  280. // 判断是否要显示广告弹窗
  281. if(!this.showGG&&this.hasLogin&&this.ggList.length>0){
  282. this.showGG=true;
  283. this.$nextTick(()=>{
  284. this.$refs.popup.open()
  285. })
  286. }
  287. },
  288. methods: {
  289. ...mapMutations('user', ['setUserInfo']),
  290. getGG() {
  291. getBannerList({
  292. page_id: 73
  293. }).then(
  294. (res) => {
  295. this.ggList = res.data.list.map((re) => {
  296. if (re.data.length > 0) {
  297. const json = JSON.parse(re.data)
  298. for (var i = 0; i < json.length; i++) {
  299. const item = json[i]
  300. const key = item.code;
  301. re[key] = item[key] ? item[key] : ''
  302. }
  303. }
  304. return re
  305. })
  306. console.log(this.ggList)
  307. }
  308. ).catch(
  309. (res) => {
  310. console.log(res);
  311. }
  312. )
  313. },
  314. // 打开小程序
  315. openXcx(item) {
  316. // #ifdef MP
  317. if (item.wxcode.length > 0) {
  318. wx.navigateToMiniProgram({
  319. appId: item.wxcode,
  320. path: item.url,
  321. })
  322. } else {
  323. if (item.url == '') {
  324. this.$refs.popup.close()
  325. } else {
  326. uni.navigateTo({
  327. url: item.url
  328. })
  329. }
  330. }
  331. // #endif
  332. },
  333. // 激活验证码
  334. openCode() {
  335. uni.showModal({
  336. title: '联系客服中心领取激活码',
  337. placeholderText: '请输入激活key',
  338. editable: true,
  339. confirmText: '激活',
  340. success: res => {
  341. if (res.confirm) {
  342. useCode({
  343. code: res.content
  344. }).then((e) => {
  345. uni.showToast({
  346. title: '激活成功'
  347. });
  348. }).catch((e) => {
  349. console.log(e)
  350. uni.showToast({
  351. title: e.msg,
  352. icon: "error"
  353. });
  354. })
  355. }
  356. },
  357. fail: () => {},
  358. complete: () => {}
  359. });
  360. },
  361. // 跳转卡片页面
  362. navcard() {
  363. if (this.hasLogin) {
  364. // 判断是否已经认证
  365. if (this.user.work_type_id <= 0) {
  366. if (this.user.info_audit_status == 1) {
  367. this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&type=3')
  368. } else {
  369. this.navTo('/pages/user/model/modelrz?modelid=' + this.user.show_template_id)
  370. }
  371. } else {
  372. if (this.user.show_template_id) {
  373. this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&type=3')
  374. } else {
  375. if (this.systeam == 'ios') {
  376. uni.showModal({
  377. title: '错误',
  378. content: 'IOS暂不支持',
  379. showCancel: false,
  380. });
  381. } else {
  382. uni.showModal({
  383. title: '错误',
  384. content: '您未购买模板请先购买',
  385. showCancel: false,
  386. });
  387. }
  388. }
  389. }
  390. } else {
  391. saveUrl()
  392. interceptor()
  393. }
  394. },
  395. //#ifdef APP
  396. shareDomApp() {
  397. uni.share({
  398. provider: 'weixin',
  399. type: 0,
  400. title: '母婴界严选',
  401. summary: '',
  402. imageUrl: this.shareData.img,
  403. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  404. })
  405. },
  406. //#endif
  407. // 获取用户数据
  408. getUser() {
  409. const that = this;
  410. getUser({}).then((e) => {
  411. this.user = e.data;
  412. this.setUserInfo(e.data)
  413. }).catch((e) => {
  414. console.log(e, 'sj');
  415. })
  416. },
  417. changeTab() {
  418. this.$emit('tab', true)
  419. },
  420. navTo(url) {
  421. if (!this.hasLogin) {
  422. // 保存地址
  423. saveUrl();
  424. // 登录拦截
  425. interceptor();
  426. } else {
  427. uni.navigateTo({
  428. url,
  429. fail(e) {
  430. console.log(e);
  431. }
  432. });
  433. }
  434. },
  435. }
  436. };
  437. </script>
  438. <style lang="scss">
  439. page {
  440. height: 100%;
  441. }
  442. .listBox {
  443. margin-top: 20rpx;
  444. overflow: hidden;
  445. }
  446. .list {
  447. .listItem {
  448. padding: 35rpx 40rpx;
  449. margin-bottom: 15rpx;
  450. background-color: #FFFFFF;
  451. border-radius: 20rpx;
  452. border: none;
  453. line-height: 1;
  454. &::after {
  455. border: none;
  456. }
  457. }
  458. .listIconImg {
  459. width: 36rpx;
  460. height: 36rpx;
  461. }
  462. .right {
  463. .img {
  464. width: 26rpx;
  465. }
  466. }
  467. .titleBox {
  468. .title {
  469. padding-left: 20rpx;
  470. color: $font-color-base;
  471. font-size: $font-base;
  472. }
  473. }
  474. }
  475. .container {
  476. height: 100%;
  477. background-color: $page-color-base;
  478. }
  479. .content-box {
  480. height: 100%;
  481. }
  482. .user-section {
  483. padding: 15rpx 30rpx 0;
  484. position: relative;
  485. background: url('https://api.myjie.cn/resource/appimage/userbg.png');
  486. background-size: 100% 100%;
  487. padding-top: 100rpx;
  488. height: 350rpx;
  489. }
  490. .user-info-box {
  491. height: 180rpx;
  492. color: white;
  493. display: flex;
  494. align-items: center;
  495. justify-content: space-between;
  496. position: relative;
  497. z-index: 1;
  498. .detail {
  499. height: 130rpx;
  500. flex-grow: 1;
  501. overflow: hidden;
  502. .portrait-box {
  503. height: 100%;
  504. .portrait {
  505. width: 130rpx;
  506. height: 100%;
  507. border: 5rpx solid #fff;
  508. border-radius: 50%;
  509. }
  510. }
  511. .info-box {
  512. margin-left: 20rpx;
  513. line-height: 1.5;
  514. flex-grow: 1;
  515. overflow: hidden;
  516. .tipLevel {
  517. height: 36rpx;
  518. margin-right: 20rpx;
  519. }
  520. .username {
  521. font-size: 34rpx;
  522. color: #FFF;
  523. font-weight: bold;
  524. height: 100%;
  525. }
  526. .authentication {
  527. font-size: 24rpx;
  528. color: #FFF;
  529. float: left;
  530. }
  531. }
  532. .righ-tbox {
  533. padding: 10rpx 20rpx;
  534. border-radius: 12rpx;
  535. font-size: 25rpx;
  536. line-height: 1;
  537. color: $base-color;
  538. background-color: #FFF;
  539. .right-tip {
  540. width: 25rpx;
  541. height: 33rpx;
  542. margin-right: 10rpx;
  543. }
  544. }
  545. }
  546. }
  547. .nav-model-rz {
  548. background-color: #FFD7E3;
  549. border-radius: 20rpx;
  550. margin: 0 auto;
  551. padding: 30rpx;
  552. padding-bottom: 15rpx;
  553. padding-top: 50rpx;
  554. line-height: 1;
  555. width: 690rpx;
  556. margin-top: -38rpx;
  557. .tiptext {
  558. color: #F65486;
  559. font-size: 26rpx;
  560. font-weight: bold;
  561. }
  562. .rztext {
  563. color: #FFF;
  564. background-color: #F65486;
  565. border-radius: 100rpx;
  566. padding: 15rpx 20rpx;
  567. font-size: 22rpx;
  568. }
  569. }
  570. .nav-model {
  571. background: url('https://api.myjie.cn/resource/appimage/uservip.png');
  572. background-size: 100% 100%;
  573. color: #FFF;
  574. border-radius: 20rpx;
  575. width: 690rpx;
  576. height: 157rpx;
  577. margin: 0 auto;
  578. margin-top: -80rpx;
  579. font-weight: bold;
  580. z-index: 1;
  581. position: relative;
  582. .next {
  583. width: 26rpx;
  584. height: 28rpx;
  585. margin-right: 40rpx;
  586. }
  587. .right-card {
  588. padding-left: 170rpx;
  589. }
  590. .title {
  591. font-size: 35rpx;
  592. }
  593. .tip {
  594. font-size: 26rpx;
  595. }
  596. }
  597. .cover-container {
  598. padding: 0 30rpx;
  599. position: relative;
  600. padding-bottom: 20rpx;
  601. }
  602. .alertBox {
  603. width: 479rpx;
  604. height: 832rpx;
  605. .alertImage {
  606. border-radius: 20rpx;
  607. width: 479rpx;
  608. height: 832rpx;
  609. }
  610. }
  611. </style>