index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. <template>
  2. <view class="bottom_tabbar">
  3. <view v-for="(item,index) in list" :key="index" @tap="changeTabbar(index)" :class="{'fb':index===1}">
  4. <image :src="tabbarIndex===index?item.activeImg:item.inactiveImg"></image>
  5. <text :class="{'active':tabbarIndex===index}">{{item.text}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. props: {
  12. tabbarIndex: 0
  13. },
  14. data() {
  15. return {
  16. tabbarValue: 0,
  17. list: [
  18. {
  19. inactiveImg: this.$imgBase+'tab_home1.png',
  20. activeImg: this.$imgBase+'tab_home2.png',
  21. text: '首页',
  22. path: '/pages/home'
  23. },
  24. {
  25. inactiveImg: this.$imgBase+'tab_publish.png',
  26. activeImg: this.$imgBase+'tab_publish.png',
  27. text: '发布问卷',
  28. path: '/pages/publish'
  29. },
  30. {
  31. inactiveImg: this.$imgBase+'tab_user1.png',
  32. activeImg: this.$imgBase+'tab_user2.png',
  33. text: '我的',
  34. path: '/pages/my'
  35. }
  36. ],
  37. loginSuccessUrl:''
  38. }
  39. },
  40. mounted() {
  41. this.tabbarValue = this.tabbarIndex;
  42. },
  43. methods: {
  44. changeTabbar(e) {
  45. this.tabbarValue = e;
  46. if(e===1&&!this.isLogin()) return
  47. uni.reLaunch({
  48. url: this.list[e].path
  49. })
  50. }
  51. }
  52. }
  53. </script>
  54. <style scoped lang="scss">
  55. @import '../../static/_asset-config';
  56. .bottom_tabbar {
  57. width: 100%;
  58. height: 174rpx;
  59. background-image: asset-image('tab_bg.png');
  60. background-position: left bottom;
  61. background-repeat: no-repeat;
  62. background-size: 100% 100%;
  63. display: flex;
  64. position: fixed;
  65. left: 0;
  66. bottom: 0;
  67. z-index: 999;
  68. &>view {
  69. width: calc(100% / 3);
  70. height: 100%;
  71. display: flex;
  72. flex-direction: column;
  73. align-items: center;
  74. image {
  75. width: 42rpx;
  76. height: 46rpx;
  77. margin-top: 37rpx;
  78. }
  79. &.fb{
  80. image{
  81. width: 72rpx;
  82. height: 72rpx;
  83. margin-top: 12rpx;
  84. }
  85. }
  86. text {
  87. margin-top: 14rpx;
  88. font-family: PingFang-SC, PingFang-SC;
  89. font-weight: bold;
  90. font-size: 22rpx;
  91. color: #7C909F;
  92. line-height: 22rpx;
  93. text-align: center;
  94. &.active{
  95. font-weight: bold;
  96. color: #002846;
  97. }
  98. }
  99. }
  100. }
  101. </style>