index.vue 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="list">
  3. <view class="msearch">
  4. <u-search v-model="param.title" :animation="true" action-text="取消" placeholder="输入搜索内容" shape="round" @search="search" @clear="clear"></u-search>
  5. </view>
  6. <view class="r_item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  7. <image :src="ip + item.showPictures" mode="aspectFill" class="pic"></image>
  8. <view class="con">
  9. <view class="title omit">{{ item.title }}</view>
  10. <view class="ms">
  11. <text class="icon">&#xec86;</text>
  12. <text class="ll">{{ item.browseNum }}</text>
  13. </view>
  14. <view class="lx">
  15. <text class="icon">&#xe603;</text>
  16. <text>景区路线</text>
  17. </view>
  18. </view>
  19. <view class="clear"></view>
  20. </view>
  21. <view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. ip: this.$http.urls.ip,
  29. list: [],
  30. param: { pageNum: 1, pageSize: 10, type: 2 },
  31. loadMore: true
  32. };
  33. },
  34. onLoad() {
  35. this.getData();
  36. },
  37. methods: {
  38. //获取数据
  39. getData() {
  40. this.$http.request({
  41. url: this.$http.urls.getPageContent,
  42. data: this.param,
  43. loading: 'false',
  44. success: res => {
  45. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  46. res.data.rows.forEach(item => {
  47. this.list.push(item);
  48. });
  49. }
  50. });
  51. },
  52. //路线
  53. lx(item) {
  54. uni.navigateTo({ url: '/pages/travel/route?id=' + item.contentId });
  55. },
  56. //详情
  57. detail(item) {
  58. uni.navigateTo({ url: '/pages/travel/detail?id=' + item.contentId });
  59. },
  60. //刷新数据
  61. refresh() {
  62. this.loadMore = true;
  63. this.param.pageNum = 1;
  64. this.list = [];
  65. this.getData();
  66. }
  67. },
  68. //下拉刷新
  69. onPullDownRefresh() {
  70. setTimeout(() => {
  71. uni.stopPullDownRefresh();
  72. this.refresh();
  73. }, 1000);
  74. },
  75. //上拉加载
  76. onReachBottom() {
  77. if (this.loadMore) {
  78. this.param.pageNum++;
  79. this.getData();
  80. }
  81. }
  82. };
  83. </script>
  84. <style lang="scss">
  85. .list {
  86. padding: 10px 17px 70px 17px;
  87. }
  88. </style>