user.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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')"
  21. v-if="!user.mobile"></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/ye.png" mode="scaleToFill"></image>
  27. <block>
  28. 普通用户
  29. </block>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <navigator url="/pages/user/model/mymodel">
  35. <view class="nav-model flex">
  36. <image class="img" src="../../static/error/emptyList.png" mode="scaleToFill"></image>
  37. <view class="right-card">
  38. <view class="title">
  39. 我的名片
  40. </view>
  41. <view class="tip">
  42. 认证成功即可获得母婴师名片
  43. </view>
  44. </view>
  45. <view class="right">
  46. </view>
  47. </view>
  48. </navigator>
  49. <view class="cover-container">
  50. <view class="listBox">
  51. <view class="list">
  52. <view class="flex listItem" @click="navTo('/pages/user/myCart/myCart')">
  53. <view class="flex titleBox">
  54. <image class="listIconImg" src="../../static/icon/myCart.png" mode="widthFix"></image>
  55. <text class="title">我的车辆</text>
  56. </view>
  57. <view class="right flex">
  58. <text></text>
  59. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  60. </view>
  61. </view>
  62. <view class="flex listItem" @click="navTo('/pages/user/repair/userRepair')">
  63. <view class="flex titleBox">
  64. <image class="listIconImg" src="../../static/icon/myWx.png" mode="widthFix"></image>
  65. <text class="title">维修历史</text>
  66. </view>
  67. <view class="right flex">
  68. <text></text>
  69. <!-- <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image> -->
  70. </view>
  71. </view>
  72. <!-- #ifndef APP -->
  73. <view class="flex listItem" @click="navTo('/pages/user/shareQrCode')">
  74. <view class="flex titleBox">
  75. <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
  76. <text class="title">邀请好友</text>
  77. </view>
  78. <view class="right flex">
  79. <text></text>
  80. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  81. </view>
  82. </view>
  83. <!-- #endif -->
  84. <!-- #ifdef APP -->
  85. <view class="flex listItem" @click="shareDomApp">
  86. <view class="flex titleBox">
  87. <image class="listIconImg" src="../../static/icon/myitem.png" mode="widthFix"></image>
  88. <text class="title">邀请好友</text>
  89. </view>
  90. <view class="right flex">
  91. <text></text>
  92. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  93. </view>
  94. </view>
  95. <!-- #endif -->
  96. <!-- #ifndef MP -->
  97. <view class="flex listItem" @click="navTo('/pages/public/workwork')">
  98. <view class="flex titleBox">
  99. <image class="listIconImg" src="../../static/icon/myServer.png" mode="widthFix"></image>
  100. <text class="title">关于我们</text>
  101. </view>
  102. <view class="right flex">
  103. <text></text>
  104. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  105. </view>
  106. </view>
  107. <!-- #endif -->
  108. <view class="flex listItem" @click="navTo('/pages/set/set')">
  109. <view class="flex titleBox">
  110. <image class="listIconImg" src="../../static/icon/mySet.png" mode="widthFix"></image>
  111. <text class="title">设置</text>
  112. </view>
  113. <view class="right flex">
  114. <text></text>
  115. <image class="img" src="../../static/icon/next1.png" mode="widthFix"></image>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. </scroll-view>
  122. </view>
  123. </template>
  124. <script>
  125. import {
  126. mapState,
  127. mapMutations
  128. } from 'vuex';
  129. import {
  130. share
  131. } from '@/api/wx';
  132. import {
  133. getUser
  134. } from '@/api/user.js';
  135. import {
  136. articleList,
  137. notify
  138. } from '@/api/index.js';
  139. import {
  140. saveUrl,
  141. interceptor
  142. } from '@/utils/loginUtils.js';
  143. export default {
  144. data() {
  145. return {
  146. user: {
  147. avatar: '', //头像
  148. nickname: '', //昵称
  149. now_money: 0, //余额
  150. brokerage_price: 0, //佣金
  151. record_sum: 0, //行程
  152. notice_sum: 0, //报警信息
  153. question_sum: 0, //系统消息
  154. // 订单数据类型
  155. orderStatusNum: {
  156. unpaid_count: 0, //待付款
  157. received_count: 0, //待收货
  158. },
  159. },
  160. shareData: {}
  161. };
  162. },
  163. computed: {
  164. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin']),
  165. ...mapState(['baseURL', 'urlFile']),
  166. ...mapState(['fx']),
  167. // 总消息条数
  168. notic() {
  169. return this.user.question_sum + this.user.notice_sum;
  170. },
  171. },
  172. // 创建时获取分享信息
  173. onLoad() {
  174. // share().then((res) => {
  175. // this.shareData = res.data.data
  176. // }).catch((res) => {
  177. // console.log(res, '分享加载失败');
  178. // })
  179. },
  180. onShow() {
  181. this.getUser();
  182. },
  183. methods: {
  184. //#ifdef APP
  185. shareDomApp() {
  186. uni.share({
  187. provider: 'weixin',
  188. type: 0,
  189. title: '母婴界严选',
  190. summary: '新一代智能电动车,手机开关锁、智能防盗、卫星定位,时刻掌握爱车位置。品牌大厂生产,质量好,款式多,售后优,所有车辆支持0元购新车!',
  191. imageUrl: this.shareData.img,
  192. href: this.baseURL + this.urlFile + '/pages/public/register?spread=' + this.userInfo.uid
  193. })
  194. },
  195. //#endif
  196. // 获取用户数据
  197. getUser() {
  198. console.log('data')
  199. const that = this;
  200. getUser({}).then((e) => {
  201. this.user = e.data;
  202. }).catch((e) => {
  203. console.log(e,'sj');
  204. })
  205. // 系统消息
  206. // articleList({}, 1).then((e) => {
  207. // that.user.question_sum = e.data.count
  208. // console.log(that, 1);
  209. // }).catch((e) => {
  210. // console.log(e);
  211. // })
  212. // 报警消息
  213. // notify().then((e) => {
  214. // that.user.notice_sum = e.data.count
  215. // }).catch((e) => {
  216. // console.log(e);
  217. // })
  218. },
  219. changeTab() {
  220. this.$emit('tab', true)
  221. },
  222. navTo(url) {
  223. if (!this.hasLogin) {
  224. // 保存地址
  225. saveUrl();
  226. // 登录拦截
  227. interceptor();
  228. } else {
  229. uni.navigateTo({
  230. url,
  231. fail(e) {
  232. console.log(e);
  233. }
  234. });
  235. }
  236. },
  237. }
  238. };
  239. </script>
  240. <style lang="scss">
  241. page {
  242. height: 100%;
  243. }
  244. .listBox {
  245. margin-top: 20rpx;
  246. overflow: hidden;
  247. }
  248. .list {
  249. .listItem {
  250. padding: 35rpx 40rpx;
  251. margin-bottom: 15rpx;
  252. background-color: #FFFFFF;
  253. border-radius: 20rpx;
  254. }
  255. .listIconImg {
  256. width: 36rpx;
  257. height: 36rpx;
  258. }
  259. .right {
  260. .img {
  261. width: 26rpx;
  262. }
  263. }
  264. .titleBox {
  265. .title {
  266. padding-left: 20rpx;
  267. color: $font-color-base;
  268. font-size: $font-base;
  269. }
  270. }
  271. }
  272. .container {
  273. height: 100%;
  274. background-color: $page-color-base;
  275. }
  276. .content-box {
  277. height: 100%;
  278. }
  279. .user-section {
  280. padding: 15rpx 30rpx 0;
  281. position: relative;
  282. background-color: $base-color;
  283. padding-top: 100rpx;
  284. height: 350rpx;
  285. }
  286. .user-info-box {
  287. height: 180rpx;
  288. color: white;
  289. display: flex;
  290. align-items: center;
  291. justify-content: space-between;
  292. position: relative;
  293. z-index: 1;
  294. .detail {
  295. height: 130rpx;
  296. flex-grow: 1;
  297. overflow: hidden;
  298. .portrait-box {
  299. height: 100%;
  300. .portrait {
  301. width: 130rpx;
  302. height: 100%;
  303. border: 5rpx solid #fff;
  304. border-radius: 50%;
  305. }
  306. }
  307. .info-box {
  308. margin-left: 20rpx;
  309. line-height: 1.5;
  310. flex-grow: 1;
  311. overflow: hidden;
  312. .tipLevel {
  313. height: 36rpx;
  314. margin-right: 20rpx;
  315. }
  316. .username {
  317. font-size: 34rpx;
  318. color: #FFF;
  319. font-weight: bold;
  320. height: 100%;
  321. }
  322. .authentication {
  323. font-size: 24rpx;
  324. color: #FFF;
  325. float: left;
  326. }
  327. }
  328. .righ-tbox{
  329. padding:10rpx 20rpx ;
  330. border-radius: 12rpx;
  331. font-size: 25rpx ;
  332. line-height: 1;
  333. color: $base-color;
  334. background-color: #FFF;
  335. .right-tip{
  336. width: 25rpx;
  337. height: 33rpx;
  338. margin-right: 10rpx;
  339. }
  340. }
  341. }
  342. }
  343. .nav-model{
  344. background: linear-gradient(270deg, #FF99B8, #FF86AB);
  345. color: #FFF;
  346. border-radius: 20rpx;
  347. width: 710rpx;
  348. margin: 0 auto;
  349. margin-top: -50rpx;
  350. font-weight: bold;
  351. z-index: 1;
  352. position: relative;
  353. .img{
  354. height: 157rpx;
  355. }
  356. .title{
  357. font-size: 35rpx;
  358. }
  359. .tip{
  360. font-size: 26rpx;
  361. }
  362. }
  363. .cover-container {
  364. padding: 0 30rpx;
  365. position: relative;
  366. padding-bottom: 20rpx;
  367. }
  368. </style>