activity.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. <template>
  2. <view class="list">
  3. <view class="msearch" style="margin-bottom: 15px;">
  4. <u-search v-model="param.title" :animation="true" action-text="取消" placeholder="输入搜索内容" shape="round" @search="search" @clear="clear"></u-search>
  5. </view>
  6. <u-time-line>
  7. <u-time-line-item class="hot_item" nodeTop="2" v-for="(item, index) in list" :key="index">
  8. <template v-slot:node>
  9. <view class="u-node" style="background: #fde4e8;"><text class="icon" style="color: #e22929;">&#xe60b;</text></view>
  10. </template>
  11. <template v-slot:content>
  12. <view class="content" @click="detail(item)">
  13. <view class="title">{{ item.title }}</view>
  14. <view class="ck">点击查看活动内容</view>
  15. <view class="time">{{ item.createTime }}</view>
  16. </view>
  17. </template>
  18. </u-time-line-item>
  19. </u-time-line>
  20. <view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. list: [],
  28. param: { pageNum: 1, pageSize: 10, type: 4 },
  29. loadMore: true
  30. };
  31. },
  32. onLoad() {
  33. this.getData();
  34. },
  35. methods: {
  36. //获取数据
  37. getData() {
  38. this.$http.request({
  39. url: this.$http.urls.getPageContent,
  40. data: this.param,
  41. loading: 'false',
  42. success: res => {
  43. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  44. res.data.rows.forEach(item => {
  45. this.list.push(item);
  46. });
  47. }
  48. });
  49. },
  50. //详情
  51. detail(item) {
  52. uni.navigateTo({ url: '/pages/travel/detail?id=' + item.contentId });
  53. },
  54. //刷新数据
  55. refresh() {
  56. this.loadMore = true;
  57. this.param.pageNum = 1;
  58. this.list = [];
  59. this.getData();
  60. }
  61. },
  62. //下拉刷新
  63. onPullDownRefresh() {
  64. setTimeout(() => {
  65. uni.stopPullDownRefresh();
  66. this.refresh();
  67. }, 1000);
  68. },
  69. //上拉加载
  70. onReachBottom() {
  71. if (this.loadMore) {
  72. this.param.pageNum++;
  73. this.getData();
  74. }
  75. }
  76. };
  77. </script>
  78. <style lang="scss">
  79. .list {
  80. padding: 15px 20px 30px 20px;
  81. }
  82. </style>