my.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <view class="container-view zx-page-linear">
  3. <view class="user-switch-row">
  4. <image
  5. :src="QINIU_URL + 'FlL5BtEdMES2-mntjR9D3CX_LWYv'"
  6. class="message"
  7. @tap="routerLink({ url: '/pages/message/index' })"
  8. />
  9. </view>
  10. <view class="user-info-wrap" @tap="loginHandle">
  11. <image :src="userInfo.headimg || defaultAvatarUrl" class="head-img" />
  12. <view class="user-name">{{ userInfo.nickname || '请点击登录' }}</view>
  13. <view
  14. v-if="userInfo.user_name"
  15. class="e-mail"
  16. >
  17. {{ userInfo.user_name }}
  18. </view>
  19. </view>
  20. <view class="common-tabs">
  21. <view
  22. v-for="(item, index) in commonTabs"
  23. :key="index"
  24. class="item"
  25. @click="routerLink(item)"
  26. >
  27. <image :src="QINIU_URL + item.icon" class="icon" />
  28. <view class="name">{{ item.name }}</view>
  29. </view>
  30. </view>
  31. <view class="tabs-wrap">
  32. <view
  33. v-for="(item, index) in baseTabs"
  34. :key="index"
  35. class="tab-item"
  36. @click="routerLink(item)"
  37. >
  38. <image :src="QINIU_URL + item.icon" class="icon" />
  39. <view class="name">{{ item.name }}</view>
  40. </view>
  41. </view>
  42. <Confirm
  43. v-model="comboDialoginfo.showConfirm"
  44. :dialog-info="comboDialoginfo"
  45. @confirm="dialogConfirm"
  46. />
  47. <CustomTabbar curt-tab="my" />
  48. </view>
  49. </template>
  50. <script>
  51. const storage = require('@/common/storage.js')
  52. import Confirm from '@/component/comPopup/Confirm'
  53. import { QINIU_URL, defaultHeadImg } from '@/common/constant'
  54. import CustomTabbar from '@/component/customTabbar/index'
  55. export default {
  56. components: {
  57. Confirm,
  58. CustomTabbar
  59. },
  60. data() {
  61. return {
  62. QINIU_URL,
  63. defaultAvatarUrl: defaultHeadImg,
  64. comboDialoginfo: {
  65. showConfirm: false,
  66. title: '温馨提示',
  67. opType: 'combo',
  68. text: '您还未购买换电套餐,是否前往进行换电套餐?',
  69. confirmBtnText: '前往购买',
  70. showCancelButton: false
  71. },
  72. userInfo: {}
  73. }
  74. },
  75. computed: {
  76. commonTabs() {
  77. return [
  78. { name: `${this.$t('我的车辆')}`, url: '/pages/mileageStatistics/index', icon: 'Fp6G-Kzb-YUGkP2WR-kjTlIbbTj1' },
  79. { name: `${this.$t('用车人')}`, url: '/pages/userManagement/userManagement', icon: 'FnxGW52BCkTkK9HxsTdVrghU7B4D' },
  80. { name: `${this.$t('换电套餐')}`, jumpCheck: 'combo', url: '', icon: 'FsOsd1SxYDHDm00aiwrTib_k0Mbr' }
  81. ]
  82. },
  83. baseTabs() {
  84. const lang = t => this.$t(t)
  85. return [
  86. { name: `${lang('我的订单')}`, url: '/pages/order/order', icon: 'FkLJGLo1faYtJWhW4Q0gt5dphI7g' },
  87. { name: `${lang('换电记录')}`, url: '', icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1' },
  88. { name: `${lang('意见反馈')}`, url: '/pages/feedback/index', icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1' },
  89. // { name: `${lang('关于我们')}`, url: '/pages/bluetoothUnlock/unlockSet', icon: 'Fmin1_DG6ZkENCdsI1qJZJpDNkhQ' },
  90. { name: `${lang('客服中心')}`, url: '/pages/bluetoothUnlock/bluetoothPair', icon: 'FhA9TUbTMF0e7ma6NZXqPrkscN6l' },
  91. { name: `${lang('设置')}`, url: '/pages/my/set', icon: 'Fu3f2iRi5BspRfbVLPcw8ryWc4lu' }
  92. ]
  93. }
  94. },
  95. onShow() {
  96. const user_token = storage.getUserToken()
  97. user_token && this.loadUserInfo()
  98. },
  99. methods: {
  100. loadUserInfo() {
  101. const userInfo = storage.getUserInfoData()
  102. console.log('userInfo', userInfo)
  103. this.setData({ userInfo })
  104. },
  105. loginHandle() {
  106. uni.navigateTo({ url: '/pages/loginRegister/login' })
  107. },
  108. checkHandle_combo() {
  109. this.comboDialoginfo.showConfirm = true
  110. },
  111. dialogConfirm(type) {
  112. console.log('dialogConfirm', type)
  113. },
  114. routerLink({ url, jumpCheck }) {
  115. console.log(url);
  116. if (jumpCheck) {
  117. this[`checkHandle_${jumpCheck}`]()
  118. return
  119. }
  120. uni.navigateTo({ url })
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. @import './my.scss';
  127. </style>