index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <template>
  2. <view class="content">
  3. <!-- <hCustom bgColor="#ccc" :isBack="true" is_status_bar="1">-->
  4. <!-- <view slot="backText">backText</view>-->
  5. <!-- <view slot="content">1</view>-->
  6. <!-- </hCustom>-->
  7. <view class="home" v-if="curr_tab_index == 0">
  8. <home></home>
  9. <view style="height: 192rpx;"></view>
  10. </view>
  11. <view class="mine" v-else-if="curr_tab_index == 2" style="width: 100%;">
  12. <mine ></mine>
  13. <view style="height: 192rpx;"></view>
  14. </view>
  15. <div class="bom shadow-sm posi-fixed posi-fixed-bottom w-100 " style="height: 192rpx;">
  16. <hBomTab :tab_list="tab_list" :curr_tab_index="curr_tab_index" @tabChange="tabChange"></hBomTab>
  17. </div>
  18. </view>
  19. </template>
  20. <script>
  21. import home from '../home/home.vue'
  22. import mine from '../mine/mine.vue'
  23. import hBomTab from '../../_components/hBomTab.vue'
  24. import hCustom from '../../_components/hCustom.vue'
  25. export default {
  26. components:{hBomTab,home,mine,hCustom},
  27. data() {
  28. return {
  29. curr_tab_index: 0,
  30. tab_list: [
  31. {icon: ['tab_hp_normal.png','tab_sy.png'],name: '首页', value: '1' },
  32. {icon: ['tab_add.png','tab_add.png'], value: '2'},
  33. {icon: ['tab_mine.png','tab_mine_selected.png'],name: '我的', value: '3'}
  34. ],
  35. // tab_titles :[ //tab对应的标题配置
  36. // {front_color:'#fff',background_color:'#009FE8',title:'首页',},
  37. // {front_color:'#000000',background_color:'#ffffff',title:''},
  38. // {front_color:'#ffffff',background_color:'#1A7BFE',title:''}
  39. // ]
  40. }
  41. },
  42. onLoad() {
  43. },
  44. onShow() {
  45. // console.log(this.curr_tab_index)
  46. },
  47. methods: {
  48. checkLogin() {
  49. var token = uni.getStorageSync('token')
  50. // var token = "df057579-73c8-4bdd-8312-f64db8efd699"
  51. if (token == undefined || token == '') {
  52. uni.navigateTo({
  53. url: '/pages/login/login'
  54. })
  55. return false
  56. }
  57. return true
  58. },
  59. tabChange (val) {
  60. let index = val.index;
  61. // this.navGo(index)
  62. if(index== 2) {
  63. if (!this.checkLogin()) {
  64. return
  65. }
  66. uni.setNavigationBarTitle({
  67. title: "我的"
  68. })
  69. this.curr_tab_index = index;
  70. }else if(index== 0) {
  71. uni.setNavigationBarTitle({
  72. title: "首页"
  73. })
  74. this.curr_tab_index = index;
  75. }else{
  76. if (!this.checkLogin()) {
  77. return
  78. }
  79. uni.navigateTo({
  80. url:'/add/pages/addvacfrom/addpeople'
  81. })
  82. }
  83. },
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. page {
  89. background: #f2f2f2;
  90. }
  91. </style>
  92. <style scoped lang="scss">
  93. .content {
  94. display: flex;
  95. justify-content: center;
  96. .home{
  97. width: 100%;
  98. }
  99. .bom{
  100. z-index: 1000;
  101. }
  102. }
  103. </style>