user.vue 11 KB

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