user.vue 13 KB

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