user.vue 11 KB

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