loveAtVillage.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <template>
  2. <!-- 乡村婚恋列表 -->
  3. <view class="container">
  4. <view class="rnwdList">
  5. <view class="list" @tap="goDetails(item.id)" v-for="(item, index1) in dataSource" :key="index1">
  6. <span class="listTitle">{{ item.titleName }}</span>
  7. <view class="onePic" v-if="item.pictureList != null && item.pictureList.length == 1">
  8. <image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
  9. </image>
  10. </view>
  11. <view class="twoPic" v-if="item.pictureList != null && item.pictureList.length == 2">
  12. <image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
  13. </image>
  14. </view>
  15. <view class="threePic" v-if="item.pictureList != null && item.pictureList.length == 3">
  16. <image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList" :key="index2">
  17. </image>
  18. </view>
  19. <view class="threePic" v-if="item.pictureList != null && item.pictureList.length > 3">
  20. <image :src="loadImgSrcLocalhost(item2)" v-for="(item2, index2) in item.pictureList"
  21. v-if="index2 < 3" :key="index2"></image>
  22. </view>
  23. <view class="jlSj">
  24. <view class="ck f-r">
  25. <span>
  26. <em class="iconfont icon-chakan"></em>
  27. {{ item.likeNum }}
  28. </span>
  29. <span>
  30. <em class="iconfont icon-shoucang"></em>
  31. {{ item.watchNum }}
  32. </span>
  33. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import { list } from '@/api/specialService/loveAtVillage.js';
  41. export default {
  42. data() {
  43. return {
  44. dataSource: [],
  45. // 数据总量
  46. total: 0,
  47. queryParams: {
  48. // 当前页
  49. pageNum: 1,
  50. // 每页数据量
  51. pageSize: 10,
  52. },
  53. loading: false,
  54. }
  55. },
  56. /**
  57. * 生命周期函数--监听页面加载
  58. */
  59. onLoad(options) {
  60. this.getList(1)
  61. },
  62. onReachBottom(){
  63. let pageNum = this.queryParams.pageNum
  64. let pageSize = this.queryParams.pageSize
  65. let total = this.total
  66. if(pageNum * pageSize >= total){
  67. uni.showToast({
  68. title:'暂无更多数据'
  69. })
  70. return
  71. } else {
  72. this.queryParams.pageNum += 1;
  73. this.getList(this.queryParams.pageNum)
  74. }
  75. },
  76. methods: {
  77. goDetails(id) {
  78. uni.navigateTo({
  79. url: '/pages/specialService/loveAtVillage/details?id=' + id,
  80. });
  81. },
  82. // 分页触发
  83. change(e) {
  84. this.getList(e.current);
  85. },
  86. // 获取数据
  87. getList(pageNum) {
  88. let params = {
  89. pageSize: this.queryParams.pageSize,
  90. pageNum: pageNum,
  91. }
  92. list(params).then(res => {
  93. if (res.code == 200) {
  94. this.dataSource = [...this.dataSource,...res.rows]
  95. this.total = res.total
  96. }
  97. })
  98. },
  99. }
  100. }
  101. </script>
  102. <style>
  103. @import './loveAtVillage.css';
  104. </style>