user.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. <!-- #ifdef MP -->
  130. <button hover-class="none" class="flex listItem" open-type='contact'>
  131. <view class="flex titleBox">
  132. <image class="listIconImg" src="../../static/icon/myserve.png" mode="widthFix"></image>
  133. <text class="title">客服中心</text>
  134. </view>
  135. <view class="right flex">
  136. <text></text>
  137. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  138. </view>
  139. </button>
  140. <!-- #endif -->
  141. <!-- #ifndef APP -->
  142. <!-- <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  143. <view class="flex titleBox">
  144. <image class="listIconImg" src="../../static/icon/myshare.png" mode="widthFix"></image>
  145. <text class="title">邀请好友</text>
  146. </view>
  147. <view class="right flex">
  148. <text></text>
  149. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  150. </view>
  151. </view> -->
  152. <!-- #endif -->
  153. <!-- #ifdef APP -->
  154. <view class="flex listItem" @click="shareDomApp">
  155. <view class="flex titleBox">
  156. <image class="listIconImg" src="../../static/icon/myshare.png" mode="widthFix"></image>
  157. <text class="title">邀请好友</text>
  158. </view>
  159. <view class="right flex">
  160. <text></text>
  161. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  162. </view>
  163. </view>
  164. <!-- #endif -->
  165. <!-- #ifndef MP -->
  166. <view class="flex listItem" @click="navTo('/pages/public/workwork')">
  167. <view class="flex titleBox">
  168. <image class="listIconImg" src="../../static/icon/myinfo.png" mode="widthFix"></image>
  169. <text class="title">关于我们</text>
  170. </view>
  171. <view class="right flex">
  172. <text></text>
  173. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  174. </view>
  175. </view>
  176. <!-- #endif -->
  177. <view class="flex listItem" @click="navTo('/pages/set/set')">
  178. <view class="flex titleBox">
  179. <image class="listIconImg" src="../../static/icon/myset.png" mode="widthFix"></image>
  180. <text class="title">系统设置</text>
  181. </view>
  182. <view class="right flex">
  183. <text></text>
  184. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  185. </view>
  186. </view>
  187. </view>
  188. </view>
  189. </view>
  190. </scroll-view>
  191. </view>
  192. </template>
  193. <script>
  194. import {
  195. mapState,
  196. mapMutations
  197. } from 'vuex';
  198. import {
  199. share
  200. } from '@/api/wx';
  201. import {
  202. getUser
  203. } from '@/api/user.js';
  204. import {
  205. articleList,
  206. notify
  207. } from '@/api/index.js';
  208. import {
  209. saveUrl,
  210. interceptor
  211. } from '@/utils/loginUtils.js';
  212. export default {
  213. data() {
  214. return {
  215. user: {
  216. avatar: '', //头像
  217. nickname: '', //昵称
  218. },
  219. shareData: {}
  220. };
  221. },
  222. computed: {
  223. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  224. ...mapState(['baseURL', 'urlFile']),
  225. ...mapState(['fx']),
  226. // 总消息条数
  227. notic() {
  228. return this.user.question_sum + this.user.notice_sum;
  229. },
  230. },
  231. // 创建时获取分享信息
  232. onLoad() {
  233. // share().then((res) => {
  234. // this.shareData = res.data.data
  235. // }).catch((res) => {
  236. // console.log(res, '分享加载失败');
  237. // })
  238. },
  239. onShow() {
  240. this.getUser();
  241. },
  242. methods: {
  243. ...mapMutations('user', ['setUserInfo']),
  244. // 跳转卡片页面
  245. navcard() {
  246. // 判断是否已经认证
  247. if (this.user.work_type_id <= 0) {
  248. if (this.user.info_audit_status == 1) {
  249. this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&type=3')
  250. } else {
  251. this.navTo('/pages/user/model/modelrz?modelid=' + this.user.show_template_id)
  252. }
  253. } else {
  254. if (this.user.show_template_id) {
  255. this.navTo('/pages/user/model/model?mtype=' + this.user.show_template_id + '&type=3')
  256. } else {
  257. uni.showModal({
  258. title: '错误',
  259. content: '您未购买模板请先购买',
  260. showCancel: false,
  261. });
  262. }
  263. }
  264. },
  265. //#ifdef APP
  266. shareDomApp() {
  267. uni.share({
  268. provider: 'weixin',
  269. type: 0,
  270. title: '母婴界严选',
  271. summary: '',
  272. imageUrl: this.shareData.img,
  273. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  274. })
  275. },
  276. //#endif
  277. // 获取用户数据
  278. getUser() {
  279. console.log('data')
  280. const that = this;
  281. getUser({}).then((e) => {
  282. this.user = e.data;
  283. this.setUserInfo(e.data)
  284. }).catch((e) => {
  285. console.log(e, 'sj');
  286. })
  287. // 系统消息
  288. // articleList({}, 1).then((e) => {
  289. // that.user.question_sum = e.data.count
  290. // console.log(that, 1);
  291. // }).catch((e) => {
  292. // console.log(e);
  293. // })
  294. // 报警消息
  295. // notify().then((e) => {
  296. // that.user.notice_sum = e.data.count
  297. // }).catch((e) => {
  298. // console.log(e);
  299. // })
  300. },
  301. changeTab() {
  302. this.$emit('tab', true)
  303. },
  304. navTo(url) {
  305. console.log(this.hasLogin, 'this.hasLogin');
  306. if (!this.hasLogin) {
  307. // 保存地址
  308. saveUrl();
  309. // 登录拦截
  310. interceptor();
  311. } else {
  312. uni.navigateTo({
  313. url,
  314. fail(e) {
  315. console.log(e);
  316. }
  317. });
  318. }
  319. },
  320. }
  321. };
  322. </script>
  323. <style lang="scss">
  324. page {
  325. height: 100%;
  326. }
  327. .listBox {
  328. margin-top: 20rpx;
  329. overflow: hidden;
  330. }
  331. .list {
  332. .listItem {
  333. padding: 35rpx 40rpx;
  334. margin-bottom: 15rpx;
  335. background-color: #FFFFFF;
  336. border-radius: 20rpx;
  337. border: none;
  338. line-height: 1;
  339. &::after {
  340. border: none;
  341. }
  342. }
  343. .listIconImg {
  344. width: 36rpx;
  345. height: 36rpx;
  346. }
  347. .right {
  348. .img {
  349. width: 26rpx;
  350. }
  351. }
  352. .titleBox {
  353. .title {
  354. padding-left: 20rpx;
  355. color: $font-color-base;
  356. font-size: $font-base;
  357. }
  358. }
  359. }
  360. .container {
  361. height: 100%;
  362. background-color: $page-color-base;
  363. }
  364. .content-box {
  365. height: 100%;
  366. }
  367. .user-section {
  368. padding: 15rpx 30rpx 0;
  369. position: relative;
  370. background: url('https://api.myjie.cn/resource/appimage/userbg.png');
  371. background-size: 100% 100%;
  372. padding-top: 100rpx;
  373. height: 350rpx;
  374. }
  375. .user-info-box {
  376. height: 180rpx;
  377. color: white;
  378. display: flex;
  379. align-items: center;
  380. justify-content: space-between;
  381. position: relative;
  382. z-index: 1;
  383. .detail {
  384. height: 130rpx;
  385. flex-grow: 1;
  386. overflow: hidden;
  387. .portrait-box {
  388. height: 100%;
  389. .portrait {
  390. width: 130rpx;
  391. height: 100%;
  392. border: 5rpx solid #fff;
  393. border-radius: 50%;
  394. }
  395. }
  396. .info-box {
  397. margin-left: 20rpx;
  398. line-height: 1.5;
  399. flex-grow: 1;
  400. overflow: hidden;
  401. .tipLevel {
  402. height: 36rpx;
  403. margin-right: 20rpx;
  404. }
  405. .username {
  406. font-size: 34rpx;
  407. color: #FFF;
  408. font-weight: bold;
  409. height: 100%;
  410. }
  411. .authentication {
  412. font-size: 24rpx;
  413. color: #FFF;
  414. float: left;
  415. }
  416. }
  417. .righ-tbox {
  418. padding: 10rpx 20rpx;
  419. border-radius: 12rpx;
  420. font-size: 25rpx;
  421. line-height: 1;
  422. color: $base-color;
  423. background-color: #FFF;
  424. .right-tip {
  425. width: 25rpx;
  426. height: 33rpx;
  427. margin-right: 10rpx;
  428. }
  429. }
  430. }
  431. }
  432. .nav-model-rz {
  433. background-color: #FFD7E3;
  434. border-radius: 20rpx;
  435. margin: 0 auto;
  436. padding: 30rpx;
  437. padding-bottom: 15rpx;
  438. padding-top: 50rpx;
  439. line-height: 1;
  440. width: 690rpx;
  441. margin-top: -38rpx;
  442. .tiptext {
  443. color: #F65486;
  444. font-size: 26rpx;
  445. font-weight: bold;
  446. }
  447. .rztext {
  448. color: #FFF;
  449. background-color: #F65486;
  450. border-radius: 100rpx;
  451. padding: 15rpx 20rpx;
  452. font-size: 22rpx;
  453. }
  454. }
  455. .nav-model {
  456. background: url('https://api.myjie.cn/resource/appimage/uservip.png');
  457. background-size: 100% 100%;
  458. color: #FFF;
  459. border-radius: 20rpx;
  460. width: 690rpx;
  461. height: 157rpx;
  462. margin: 0 auto;
  463. margin-top: -80rpx;
  464. font-weight: bold;
  465. z-index: 1;
  466. position: relative;
  467. .next {
  468. width: 26rpx;
  469. height: 28rpx;
  470. margin-right: 40rpx;
  471. }
  472. .right-card {
  473. padding-left: 170rpx;
  474. }
  475. .title {
  476. font-size: 35rpx;
  477. }
  478. .tip {
  479. font-size: 26rpx;
  480. }
  481. }
  482. .cover-container {
  483. padding: 0 30rpx;
  484. position: relative;
  485. padding-bottom: 20rpx;
  486. }
  487. </style>