introduction.vue 2.0 KB

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