user.vue 13 KB

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