indexRouter.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <!-- 底部tab导航 -->
  3. <view>
  4. <Home v-if="nowchos === 0"></Home>
  5. <Order ref="order" v-else-if="nowchos === 1"></Order>
  6. <Mine ref="mine" :token="token" :userInfo="userInfo" v-else-if="nowchos === 2"></Mine>
  7. <!-- <Information v-else-if="nowchos === 2"></Information>
  8. <Mine ref="mine" v-else-if="nowchos === 3"></Mine> -->
  9. <view class="bottomboxs">
  10. <x-navbottom :nowchos='nowchos' @botomchos='botomchos'></x-navbottom>
  11. </view>
  12. </view>
  13. </template>
  14. <script>
  15. import Home from './home/index.vue' // 引入首页
  16. import Order from './order/index.vue' // 引入收益首页
  17. import Information from './information/index.vue' // 记录
  18. import Mine from './mine/index.vue' // 记录
  19. export default {
  20. components: { //在这里注册相应的组件
  21. Home,
  22. Order,
  23. Information,
  24. Mine,
  25. },
  26. data() {
  27. return {
  28. nowchos: 0, //当前选择了那个底部菜单
  29. userInfo: {},
  30. isorders: 0,
  31. userType: 3,
  32. token: '',
  33. }
  34. },
  35. onShow() {
  36. const that = this
  37. uni.$on('booking', () => {
  38. that.nowchos = 1
  39. that.$forceUpdate()
  40. that.$nextTick(() => {
  41. setTimeout(function() {
  42. that.$refs.order.getOrderList()
  43. });
  44. })
  45. })
  46. if (that.nowchos == 2) {
  47. that.$nextTick(() => {
  48. setTimeout(function() {
  49. // that.$refs.mine.refreshTokenil()
  50. }, 100);
  51. })
  52. }
  53. var token = that.$cache.getToken()
  54. that.token = token
  55. var userInfo = that.$cache.getCache('userInfo')
  56. if (userInfo) {
  57. that.userInfo = userInfo
  58. }
  59. },
  60. mounted() {
  61. var userInfo = this.$cache.getCache('userInfo')
  62. if (userInfo.provUser) {
  63. this.isorders = userInfo.provUser.isorders
  64. this.userType = userInfo.provUser.userType
  65. }
  66. },
  67. methods: {
  68. // tab
  69. botomchos(e) {
  70. const that = this
  71. if (e == 2) {
  72. that.$nextTick(() => {
  73. setTimeout(function() {
  74. // that.$refs.mine.refreshTokenil()
  75. }, 100);
  76. })
  77. }
  78. uni.setStorageSync('nowchos', e);
  79. that.nowchos = e
  80. },
  81. }
  82. }
  83. </script>
  84. <style lang="scss">
  85. .bottomboxs {
  86. position: relative;
  87. bottom: 0;
  88. z-index: 2023;
  89. height: 100rpx;
  90. }
  91. </style>