user.vue 12 KB

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