fuli.vue 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <template>
  2. <view class="fuli">
  3. <view class="swiper-box">
  4. <u-swiper :list="swiperlisi" name="logo" height="320" @click="tobanner" border-radius="20"></u-swiper>
  5. </view>
  6. <view class="u-flex u-row-between u-flex-wrap list-box">
  7. <image :src="item.logo" v-for="(item,index) in list" :key="index" @click="toinfo(item)" mode="aspectFill"></image>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import { mapState } from "vuex"
  13. export default {
  14. data() {
  15. return {
  16. swiperlisi: [],
  17. list: [],
  18. page: 1,
  19. title: ''
  20. }
  21. },
  22. onLoad(option) {
  23. this.title = option.title
  24. this.getbanner()
  25. this.getlist()
  26. },
  27. onShow() {
  28. if (this.title) {
  29. uni.setNavigationBarTitle({
  30. title: this.title
  31. })
  32. }
  33. },
  34. onReachBottom() {
  35. if (this.list.length % 20 == 0) {
  36. this.page++
  37. this.getlist()
  38. }
  39. },
  40. computed: {
  41. ...mapState(['defaultcity'])
  42. },
  43. methods: {
  44. tobanner(e) {
  45. if (this.swiperlisi[e].url) {
  46. uni.navigateTo({
  47. url: this.swiperlisi[e].url
  48. })
  49. }
  50. },
  51. getlist() {
  52. this.$u.post('/api/welfare/welfare_list', {
  53. page: this.page,
  54. page_num: 20,
  55. city_id: this.defaultcity.city_id
  56. }).then(res => {
  57. this.list = this.list.concat(res.data)
  58. })
  59. },
  60. getbanner() {
  61. this.$u.post('/api/Index/banner', {
  62. location: 3
  63. }).then(res => {
  64. this.swiperlisi = res.data
  65. })
  66. },
  67. toinfo(item) {
  68. uni.navigateTo({
  69. url: "./fuli-info?id=" + item.id
  70. })
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="scss">
  76. .fuli {
  77. .swiper-box {
  78. margin: 24rpx;
  79. }
  80. .list-box {
  81. padding: 0 24rpx;
  82. image {
  83. width: 340rpx;
  84. height: 110rpx;
  85. border-radius: 10rpx;
  86. margin-bottom: 20rpx;
  87. }
  88. }
  89. }
  90. </style>