user.vue 12 KB

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