inquiry.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. </view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import {
  41. list,
  42. getDetails
  43. } from '@/api/inquiry/inquiry.js';
  44. export default {
  45. data() {
  46. return {
  47. dataSource: [],
  48. // 数据总量
  49. total: 0,
  50. queryParams: {
  51. // 当前页
  52. pageNum: 1,
  53. // 每页数据量
  54. pageSize: 10,
  55. },
  56. loading: false,
  57. }
  58. },
  59. /**
  60. * 生命周期函数--监听页面加载
  61. */
  62. onLoad(options) {
  63. this.getList(1)
  64. },
  65. onReachBottom() {
  66. let pageNum = this.queryParams.pageNum
  67. let pageSize = this.queryParams.pageSize
  68. let total = this.total
  69. if (pageNum * pageSize >= total) {
  70. uni.showToast({
  71. title: '暂无更多数据'
  72. })
  73. return
  74. } else {
  75. this.queryParams.pageNum += 1;
  76. this.getList()
  77. }
  78. },
  79. methods: {
  80. goDetails(id) {
  81. getDetails(id).then(res => {
  82. let data = res.data
  83. data.urls = data.pictureList
  84. uni.navigateTo({
  85. url: `/pages/common/articleDetail/articleDetail?data=${this.encodify(data)}`
  86. });
  87. })
  88. },
  89. // 分页触发
  90. change(e) {
  91. this.getList(e.current);
  92. },
  93. // 获取数据
  94. getList(pageNum) {
  95. let params = {
  96. pageSize: this.queryParams.pageSize,
  97. pageNum: pageNum,
  98. }
  99. list(params).then(res => {
  100. if (res.code == 200) {
  101. this.dataSource = [...this.dataSource, ...res.rows]
  102. this.total = res.total
  103. }
  104. })
  105. },
  106. }
  107. }
  108. </script>
  109. <style>
  110. @import './inquiry.css';
  111. </style>