index.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. <template>
  2. <view>
  3. <view class="list">
  4. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  5. <image :src="ip + item.showPictures" mode="aspectFill" class="pic"></image>
  6. <view class="con">
  7. <view class="title omit">{{ item.title }}</view>
  8. <view class="ms">
  9. <text class="ll">1233</text>
  10. <text class="wz">浏览</text>
  11. </view>
  12. <view class="lx">
  13. <text class="icon">&#xe696;</text>
  14. 景区路线
  15. </view>
  16. </view>
  17. <view class="clear"></view>
  18. </view>
  19. <view class="loading"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. ip: this.$http.urls.ip,
  28. list: [],
  29. param: { pageNum: 1, pageSize: 10, type: 2 },
  30. loadMore: true
  31. };
  32. },
  33. onLoad() {
  34. this.getData();
  35. },
  36. methods: {
  37. //获取数据
  38. getData() {
  39. this.$http.request({
  40. url: this.$http.urls.getPageContent,
  41. data: this.param,
  42. loading: 'false',
  43. success: res => {
  44. this.loadMore = res.data.pages > this.param.pageNum ? true : false;
  45. res.data.rows.forEach(item => {
  46. this.list.push(item);
  47. });
  48. }
  49. });
  50. },
  51. //详情
  52. detail(item) {
  53. uni.navigateTo({ url: '/pages/travel/detail' });
  54. },
  55. //刷新数据
  56. refresh() {
  57. this.loadMore = true;
  58. this.param.pageNum = 1;
  59. this.list = [];
  60. this.getData();
  61. }
  62. },
  63. //下拉刷新
  64. onPullDownRefresh() {
  65. setTimeout(() => {
  66. uni.stopPullDownRefresh();
  67. this.refresh();
  68. }, 1000);
  69. },
  70. //上拉加载
  71. onReachBottom() {
  72. if (this.loadMore) {
  73. this.param.pageNum++;
  74. this.getData();
  75. }
  76. }
  77. };
  78. </script>
  79. <style lang="scss">
  80. .list {
  81. padding: 0px 10px 70px 10px;
  82. .item {
  83. background-color: white;
  84. padding: 15px 8px 15px 8px;
  85. border-bottom: 1px solid #e5e5e5;
  86. border-radius: 5px;
  87. margin-top: 10px;
  88. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
  89. .pic {
  90. float: left;
  91. width: 30%;
  92. border-radius: 3px;
  93. height: 80px;
  94. background-color: #dcdcdc;
  95. }
  96. .con {
  97. padding-left: 30px;
  98. width: 60%;
  99. float: left;
  100. .title {
  101. font-size: 15px;
  102. text-align: left;
  103. color: #252525;
  104. font-weight: bold;
  105. }
  106. .ms {
  107. margin-top: 10px;
  108. .ll {
  109. color: #d72424;
  110. font-size: 16px;
  111. padding-right: 5px;
  112. }
  113. .wz {
  114. font-size: 12px;
  115. }
  116. }
  117. .lx {
  118. float: right;
  119. color: #fff;
  120. background: #d72424;
  121. border-radius: 10px;
  122. padding: 8px 10px;
  123. font-size: 16px;
  124. color: white;
  125. font-weight: 700;
  126. margin-right: -20px;
  127. .icon {
  128. padding-right: 5px;
  129. font-size: 20px;
  130. }
  131. }
  132. }
  133. }
  134. }
  135. </style>