home-frame.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <view class="content">
  3. <view class="info">
  4. <slot></slot>
  5. </view>
  6. <view class="foot">
  7. <view class="list" v-for="(item,index) in list" :key="index" @tap="toPath(index,item)"
  8. v-if="item.is_use=='0'">
  9. <image class="image" :src="item.normal.length>0?item.normal[0].url:''" mode="" v-if="active!=index">
  10. </image>
  11. <image class="image" :src="item.active.length>0?item.active[0].url:''" mode="" v-else></image>
  12. <view class="name" :style="{color:active==index?'var(--rgbfa4)':''}">{{item.name}}
  13. </view>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. export default {
  20. props: {
  21. },
  22. data() {
  23. return {
  24. // 平台信息
  25. basicInfo: {},
  26. // 底部菜单
  27. active: 0,
  28. list: []
  29. }
  30. },
  31. onLoad() {},
  32. onShow() {},
  33. created() {
  34. const that = this;
  35. that.search()
  36. },
  37. methods: {
  38. search() {
  39. const that = this;
  40. let pages = getCurrentPages();
  41. let currentPage = pages[pages.length - 1];
  42. uni.getStorage({
  43. key: 'basicInfo',
  44. success: (res) => {
  45. let data = res.data
  46. that.$set(that, `basicInfo`, data);
  47. // 底部菜单
  48. let foot_menus = data.foot_menus;
  49. let list = foot_menus.sort((a, b) => {
  50. return a.sort - b.sort
  51. });
  52. that.$set(that, `list`, list);
  53. let routeInfo = list.find((i) => i.route == currentPage.route);
  54. if (routeInfo) {
  55. let index = list.findIndex((i) => i.route == currentPage.route);
  56. that.$set(that, `active`, index);
  57. }
  58. }
  59. })
  60. },
  61. toPath(index, e) {
  62. const that = this;
  63. that.$set(that, `active`, index);
  64. that.$emit('toPath', e)
  65. }
  66. }
  67. }
  68. </script>
  69. <style lang="scss">
  70. .content {
  71. .info {
  72. width: 100vw;
  73. height: 92vh;
  74. overflow: auto;
  75. }
  76. .foot {
  77. position: absolute;
  78. bottom: 0;
  79. width: 100vw;
  80. height: 8vh;
  81. overflow: hidden;
  82. background-color: var(--rgb161);
  83. color: var(--rgbfff);
  84. display: flex;
  85. flex-direction: row;
  86. justify-content: space-around;
  87. .list {
  88. padding: 1vw 0;
  89. text-align: center;
  90. .image {
  91. width: 7vw;
  92. height: 6vw;
  93. }
  94. .name {
  95. font-size: 12px;
  96. }
  97. }
  98. }
  99. }
  100. </style>