user.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508
  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+'&look=1')
  253. }else{
  254. this.navTo('/pages/user/model/model')
  255. }
  256. }
  257. },
  258. //#ifdef APP
  259. shareDomApp() {
  260. uni.share({
  261. provider: 'weixin',
  262. type: 0,
  263. title: '母婴界严选',
  264. summary: '',
  265. imageUrl: this.shareData.img,
  266. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  267. })
  268. },
  269. //#endif
  270. // 获取用户数据
  271. getUser() {
  272. console.log('data')
  273. const that = this;
  274. getUser({}).then((e) => {
  275. this.user = e.data;
  276. this.setUserInfo(e.data)
  277. }).catch((e) => {
  278. console.log(e, 'sj');
  279. })
  280. // 系统消息
  281. // articleList({}, 1).then((e) => {
  282. // that.user.question_sum = e.data.count
  283. // console.log(that, 1);
  284. // }).catch((e) => {
  285. // console.log(e);
  286. // })
  287. // 报警消息
  288. // notify().then((e) => {
  289. // that.user.notice_sum = e.data.count
  290. // }).catch((e) => {
  291. // console.log(e);
  292. // })
  293. },
  294. changeTab() {
  295. this.$emit('tab', true)
  296. },
  297. navTo(url) {
  298. console.log(this.hasLogin,'this.hasLogin');
  299. if (!this.hasLogin) {
  300. // 保存地址
  301. saveUrl();
  302. // 登录拦截
  303. interceptor();
  304. } else {
  305. uni.navigateTo({
  306. url,
  307. fail(e) {
  308. console.log(e);
  309. }
  310. });
  311. }
  312. },
  313. }
  314. };
  315. </script>
  316. <style lang="scss">
  317. page {
  318. height: 100%;
  319. }
  320. .listBox {
  321. margin-top: 20rpx;
  322. overflow: hidden;
  323. }
  324. .list {
  325. .listItem {
  326. padding: 35rpx 40rpx;
  327. margin-bottom: 15rpx;
  328. background-color: #FFFFFF;
  329. border-radius: 20rpx;
  330. border: none;
  331. line-height: 1;
  332. &::after{
  333. border: none;
  334. }
  335. }
  336. .listIconImg {
  337. width: 36rpx;
  338. height: 36rpx;
  339. }
  340. .right {
  341. .img {
  342. width: 26rpx;
  343. }
  344. }
  345. .titleBox {
  346. .title {
  347. padding-left: 20rpx;
  348. color: $font-color-base;
  349. font-size: $font-base;
  350. }
  351. }
  352. }
  353. .container {
  354. height: 100%;
  355. background-color: $page-color-base;
  356. }
  357. .content-box {
  358. height: 100%;
  359. }
  360. .user-section {
  361. padding: 15rpx 30rpx 0;
  362. position: relative;
  363. background: url('https://api.myjie.cn/resource/appimage/userbg.png');
  364. background-size: 100% 100%;
  365. padding-top: 100rpx;
  366. height: 350rpx;
  367. }
  368. .user-info-box {
  369. height: 180rpx;
  370. color: white;
  371. display: flex;
  372. align-items: center;
  373. justify-content: space-between;
  374. position: relative;
  375. z-index: 1;
  376. .detail {
  377. height: 130rpx;
  378. flex-grow: 1;
  379. overflow: hidden;
  380. .portrait-box {
  381. height: 100%;
  382. .portrait {
  383. width: 130rpx;
  384. height: 100%;
  385. border: 5rpx solid #fff;
  386. border-radius: 50%;
  387. }
  388. }
  389. .info-box {
  390. margin-left: 20rpx;
  391. line-height: 1.5;
  392. flex-grow: 1;
  393. overflow: hidden;
  394. .tipLevel {
  395. height: 36rpx;
  396. margin-right: 20rpx;
  397. }
  398. .username {
  399. font-size: 34rpx;
  400. color: #FFF;
  401. font-weight: bold;
  402. height: 100%;
  403. }
  404. .authentication {
  405. font-size: 24rpx;
  406. color: #FFF;
  407. float: left;
  408. }
  409. }
  410. .righ-tbox {
  411. padding: 10rpx 20rpx;
  412. border-radius: 12rpx;
  413. font-size: 25rpx;
  414. line-height: 1;
  415. color: $base-color;
  416. background-color: #FFF;
  417. .right-tip {
  418. width: 25rpx;
  419. height: 33rpx;
  420. margin-right: 10rpx;
  421. }
  422. }
  423. }
  424. }
  425. .nav-model-rz{
  426. background-color:#FFD7E3 ;
  427. border-radius: 20rpx;
  428. margin: 0 auto;
  429. padding: 30rpx;
  430. padding-bottom: 15rpx;
  431. padding-top: 50rpx;
  432. line-height: 1;
  433. width: 690rpx;
  434. margin-top: -38rpx;
  435. .tiptext{
  436. color:#F65486 ;
  437. font-size: 26rpx;
  438. font-weight: bold;
  439. }
  440. .rztext{
  441. color: #FFF;
  442. background-color: #F65486;
  443. border-radius: 100rpx;
  444. padding: 15rpx 20rpx;
  445. font-size: 22rpx;
  446. }
  447. }
  448. .nav-model {
  449. background: url('https://api.myjie.cn/resource/appimage/uservip.png');
  450. background-size: 100% 100%;
  451. color: #FFF;
  452. border-radius: 20rpx;
  453. width: 690rpx;
  454. height: 157rpx;
  455. margin: 0 auto;
  456. margin-top: -80rpx;
  457. font-weight: bold;
  458. z-index: 1;
  459. position: relative;
  460. .next {
  461. width: 26rpx;
  462. height: 28rpx;
  463. margin-right: 40rpx;
  464. }
  465. .right-card {
  466. padding-left: 170rpx;
  467. }
  468. .title {
  469. font-size: 35rpx;
  470. }
  471. .tip {
  472. font-size: 26rpx;
  473. }
  474. }
  475. .cover-container {
  476. padding: 0 30rpx;
  477. position: relative;
  478. padding-bottom: 20rpx;
  479. }
  480. </style>