user.vue 11 KB

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