travelGuide.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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" style="height: 2vh;display: flex;margin-top: 10px;">
  24. <span style="color: #07c160;font-size: 24rpx;">
  25. {{ item.createTime }}
  26. <!-- <em class="iconfont icon-jifen"></em> -->
  27. </span>
  28. <view class="ck">
  29. <span>
  30. <em class="iconfont icon-chakan"></em>
  31. {{ item.likeNum }}
  32. </span>
  33. <!-- <span>-->
  34. <!-- <em class="iconfont icon-shoucang"></em>-->
  35. <!-- {{ item.watchNum }}-->
  36. <!-- </span>-->
  37. </view>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. list
  46. } from '@/api/travelGuide/travelGuide.js';
  47. export default {
  48. data() {
  49. return {
  50. dataSource: [],
  51. // 数据总量
  52. total: 0,
  53. queryParams: {
  54. // 当前页
  55. pageNum: 1,
  56. // 每页数据量
  57. pageSize: 10,
  58. },
  59. loading: false,
  60. }
  61. },
  62. /**
  63. * 生命周期函数--监听页面加载
  64. */
  65. onLoad(options) {
  66. this.getList(1)
  67. },
  68. onReachBottom(){
  69. let pageNum = this.queryParams.pageNum
  70. let pageSize = this.queryParams.pageSize
  71. let total = this.total
  72. if(pageNum * pageSize >= total){
  73. uni.showToast({
  74. title:'暂无更多数据'
  75. })
  76. return
  77. } else {
  78. this.queryParams.pageNum += 1;
  79. this.getList()
  80. }
  81. },
  82. methods: {
  83. goDetails(id) {
  84. uni.navigateTo({
  85. url: '/pages/highServer/travelGuideDetails/travelGuideDetails?id=' + id,
  86. });
  87. },
  88. // 分页触发
  89. change(e) {
  90. this.getList(e.current);
  91. },
  92. // 获取数据
  93. getList(pageNum) {
  94. let params = {
  95. pageSize: this.queryParams.pageSize,
  96. pageNum: pageNum,
  97. }
  98. list(params).then(res => {
  99. if (res.code == 200) {
  100. this.dataSource = [...this.dataSource,...res.rows]
  101. this.total = res.total
  102. }
  103. })
  104. },
  105. }
  106. }
  107. </script>
  108. <style>
  109. @import './travelGuide.css';
  110. </style>