my.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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. var config = require('../../common/config_gyq.js');
  56. var http = require('../../common/request.js');
  57. export default {
  58. components: {
  59. Confirm,
  60. CustomTabbar
  61. },
  62. data() {
  63. return {
  64. QINIU_URL,
  65. defaultAvatarUrl: defaultHeadImg,
  66. comboDialoginfo: {
  67. showConfirm: false,
  68. title: '温馨提示',
  69. opType: 'combo',
  70. text: '您还未购买换电套餐,是否前往进行换电套餐?',
  71. confirmBtnText: '前往购买',
  72. showCancelButton: false
  73. },
  74. userInfo: {}
  75. }
  76. },
  77. computed: {
  78. commonTabs() {
  79. return [
  80. { name: `${this.$t('我的车辆')}`, url: '/pages/mileageStatistics/index', icon: 'Fp6G-Kzb-YUGkP2WR-kjTlIbbTj1' },
  81. { name: `${this.$t('用车人')}`, url: '/pages/userManagement/userManagement', icon: 'FnxGW52BCkTkK9HxsTdVrghU7B4D' },
  82. { name: `${this.$t('换电套餐')}`, jumpCheck: 'combo', url: '', icon: 'FsOsd1SxYDHDm00aiwrTib_k0Mbr' }
  83. ]
  84. },
  85. baseTabs() {
  86. const lang = t => this.$t(t)
  87. return [
  88. { name: `${lang('我的订单')}`, url: '/pages/order/order', icon: 'FkLJGLo1faYtJWhW4Q0gt5dphI7g' },
  89. { name: `${lang('换电记录')}`, url: '', icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1' },
  90. { name: `${lang('意见反馈')}`, url: '/pages/feedback/index', icon: 'FnSjwcN7Mcpa-WA7Cqx2cGTvX2V1' },
  91. // { name: `${lang('关于我们')}`, url: '/pages/bluetoothUnlock/unlockSet', icon: 'Fmin1_DG6ZkENCdsI1qJZJpDNkhQ' },
  92. { name: `${lang('客服中心')}`, url: '/pages/bluetoothUnlock/bluetoothPair', icon: 'FhA9TUbTMF0e7ma6NZXqPrkscN6l' },
  93. { name: `${lang('设置')}`, url: '/pages/my/set', icon: 'Fu3f2iRi5BspRfbVLPcw8ryWc4lu' }
  94. ]
  95. }
  96. },
  97. onShow() {
  98. const user_token = storage.getUserToken()
  99. user_token && this.loadUserInfo()
  100. },
  101. methods: {
  102. async loadUserInfo() {
  103. const userInfo = storage.getUserInfoData()
  104. this.setData({ userInfo })
  105. let {data} = await http.postApi(config.API_USER_INFO,{})
  106. if(data.code == 200){
  107. this.userInfo = data.data.userInfo
  108. storage.setUserInfoData(this.userInfo)
  109. }
  110. },
  111. loginHandle() {
  112. uni.navigateTo({ url: '/pages/loginRegister/login' })
  113. },
  114. checkHandle_combo() {
  115. this.comboDialoginfo.showConfirm = true
  116. },
  117. dialogConfirm(type) {
  118. uni.navigateTo({
  119. url:`/pages/batteryPackage/batteryPackage`
  120. })
  121. },
  122. routerLink({ url, jumpCheck }) {
  123. console.log(url);
  124. if (jumpCheck) {
  125. this[`checkHandle_${jumpCheck}`]()
  126. return
  127. }
  128. uni.navigateTo({ url })
  129. }
  130. }
  131. }
  132. </script>
  133. <style lang="scss" scoped>
  134. @import './my.scss';
  135. </style>