index.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view>
  3. <u-navbar title-color="#fff" :custom-back="customBack" :border-bottom="false" back-icon-color="#CCE8FF" :background="{background: '#008CFF' }" title="我的"></u-navbar>
  4. <view class="u-flex user-box u-p-l-30 u-p-r-20 u-p-b-30">
  5. <view class="u-m-r-24" @click="login($store.state.vuex_hasLogin)">
  6. <u-avatar :src="userInfo.headImgUrl || userInfo.avatar||pic" size="140"></u-avatar>
  7. </view>
  8. <view class="u-flex-1" @click="login($store.state.vuex_hasLogin)">
  9. <view class="u-font-18 u-p-b-20">{{ userInfo.nickname || userInfo.userName || '请登录' }}</view>
  10. <view class="u-font-14">手机号:{{ userInfo.mobile || '暂无' }}</view>
  11. </view>
  12. <!-- <view class="u-m-l-10 u-p-10">
  13. <u-icon name="arrow-right" color="#fff" size="28"></u-icon>
  14. </view> -->
  15. </view>
  16. <view class="u-m-t-20">
  17. <u-cell-group>
  18. <u-cell-item icon="car" title="我的车辆" @click="openPage('pages/myCars/myCars')"></u-cell-item>
  19. <u-cell-item icon="order" title="停车记录" @click="openPage('pages/center/order/order')"></u-cell-item>
  20. </u-cell-group>
  21. </view>
  22. <view class="u-m-t-20">
  23. <u-cell-group>
  24. <u-cell-item icon="phone" title="手机号登录" @click="openPage('/pages/center/phoneLogin/phoneLogin')"></u-cell-item>
  25. <!-- <u-cell-item icon="star" title="微信支付" @click="handlewxpay"></u-cell-item> -->
  26. </u-cell-group>
  27. </view>
  28. <u-toast ref="uToast" />
  29. </view>
  30. </template>
  31. <script>
  32. import getUrlParams from "../../utils/getUrlParams.js";
  33. export default {
  34. data() {
  35. return {
  36. pic:'https://uviewui.com/common/logo.png',
  37. userInfo:[],
  38. code:null,
  39. }
  40. },
  41. onLoad() {
  42. },
  43. onShow() {
  44. if(this.$store.state.vuex_hasLogin){
  45. this.userInfo = this.$store.state.vuex_user;
  46. if(this.$store.state.vuex_wxinfo){
  47. this.userInfo = Object.assign(this.userInfo,this.$store.state.vuex_wxinfo);
  48. }
  49. }else{
  50. this.userInfo = [];
  51. };
  52. let locationLocaturl = window.location.search;
  53. this.code = getUrlParams(locationLocaturl,"code");
  54. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  55. },
  56. methods: {
  57. openPage(path) {
  58. console.log('path',path);
  59. this.$u.route({
  60. url: path
  61. })
  62. },
  63. //登录判断
  64. login(status){
  65. console.log('this.$store.state.vuex_hasLogin',this.$store.state.vuex_hasLogin);
  66. if(!status){
  67. console.log('config',this.config);
  68. this.$u.route({
  69. url: 'pages/center/phoneLogin/phoneLogin'
  70. });
  71. }
  72. },
  73. customBack(){
  74. this.$u.route({
  75. type:'switchTab',
  76. url: 'pages/index/index'
  77. });
  78. },
  79. }
  80. }
  81. </script>
  82. <style lang="scss" scoped>
  83. page{background-color: $my-page-bg-color;}
  84. .user-box{
  85. position: relative;
  86. background-color: $my-main-color;
  87. color: #fff;
  88. &:after{
  89. position: absolute;
  90. right: 0;
  91. top: -50rpx;
  92. content: '';
  93. background: url(../../static/img/center-top-bg.png) no-repeat;
  94. background-position: -90rpx 0;
  95. width: 305rpx;
  96. height: 145rpx;
  97. z-index: 999;
  98. }
  99. }
  100. .u-avatar{border: 10rpx solid #4CAEFF;}
  101. .u-cell-box /deep/ .u-cell__left-icon-wrap{color: $my-main-color;}
  102. </style>