voteList.vue 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="con">
  3. <view class="search ddflex">
  4. <image src="../../static/images/ssico.png" class="ssico"></image>
  5. <input v-model="cTitle" placeholder="搜索感兴趣的投票话题" @input="inputTopicText" placeholder-class="placeholder" class="ipt fflex" />
  6. <!-- <view class="clear">取消</view> -->
  7. </view>
  8. <view class="list" v-if="hotPollList && hotPollList.length > 0">
  9. <view class="li ddflex" v-for="(item, index) in hotPollList" :key="index" @click="jumpUrl('/office/detail/detail?contentId=' + item.momentsId)">
  10. <text class="num">{{ index + 1 }}</text>
  11. <view class="fflex tover">{{ item.title }}</view>
  12. <text>{{ item.participantsNO }}参与</text>
  13. </view>
  14. </view>
  15. <view class="nodata" v-else>
  16. <image :src="picUrlss + 'empty_jl.png'"></image>
  17. <text>没有相关投票</text>
  18. </view>
  19. </view>
  20. </template>
  21. <script>
  22. const app = getApp();
  23. const req = require('../../utils/request.js');
  24. export default {
  25. data() {
  26. return {
  27. picUrlss: req.public.picUrls,
  28. isLoad: true,
  29. form: {
  30. page: 1,
  31. limit: 10
  32. },
  33. hotPollList: [],
  34. cTitle: '' //输入的关键词
  35. };
  36. },
  37. onLoad() {
  38. this.getHotPoll();
  39. },
  40. onReachBottom() {
  41. this.form.page++;
  42. this.getHotPoll();
  43. },
  44. methods: {
  45. // 监听获取话题输入˚
  46. inputTopicText(e) {
  47. this.isLoad = true;
  48. this.form.page = 1;
  49. this.getHotPoll();
  50. },
  51. jumpUrl(url) {
  52. uni.navigateTo({
  53. url: url
  54. });
  55. },
  56. getHotPoll() {
  57. if (!this.isLoad) return false;
  58. this.isLoad = false;
  59. var dataPram = {};
  60. dataPram.page = this.form.page;
  61. dataPram.limit = this.form.limit;
  62. if (this.cTitle) {
  63. dataPram.search = this.cTitle;
  64. }
  65. dataPram.orderType = 1;
  66. req.getRequest('/api/v3/poll/pollListV2', dataPram, data => {
  67. if (data && data.length >= this.form.limit) {
  68. this.isLoad = true;
  69. }
  70. if (this.form.page > 1) {
  71. data = this.hotPollList.concat(data);
  72. }
  73. this.hotPollList = data;
  74. });
  75. }
  76. }
  77. };
  78. </script>
  79. <style>
  80. @import './voteList.css';
  81. </style>