index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. if(this.$store.state.vuex_hasLogin){
  43. this.userInfo = this.$store.state.vuex_user;
  44. if(this.$store.state.vuex_wxinfo){
  45. this.userInfo = Object.assign(this.userInfo,this.$store.state.vuex_wxinfo);
  46. }
  47. }else{
  48. this.userInfo = [];
  49. };
  50. let locationLocaturl = window.location.search;
  51. this.code = getUrlParams(locationLocaturl,"code");
  52. if(this.code&&!this.$store.state.vuex_wxinfo.openId){this.handleGetWXInfo(this.code)};
  53. },
  54. methods: {
  55. openPage(path) {
  56. console.log('path',path);
  57. this.$u.route({
  58. url: path
  59. })
  60. },
  61. //登录判断
  62. login(status){
  63. if(!status){
  64. console.log('config',this.config);
  65. window.location.replace(this.config.loginUrl)
  66. }
  67. },
  68. customBack(){
  69. this.$u.route({
  70. type:'switchTab',
  71. url: 'pages/index/index'
  72. });
  73. },
  74. }
  75. }
  76. </script>
  77. <style lang="scss" scoped>
  78. page{background-color: $my-page-bg-color;}
  79. .user-box{background-color: $my-main-color;color: #fff;}
  80. .u-avatar{border: 10rpx solid #4CAEFF;}
  81. </style>