index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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">{{ item.browseNum }}</text>
  10. <text class="wz">浏览</text>
  11. </view>
  12. <view class="lx" @click.stop="lx(item)">
  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. lx(item) {
  53. uni.navigateTo({ url: '/pages/travel/route' });
  54. },
  55. //详情
  56. detail(item) {
  57. uni.navigateTo({ url: '/pages/travel/detail?id=' + item.contentId });
  58. },
  59. //刷新数据
  60. refresh() {
  61. this.loadMore = true;
  62. this.param.pageNum = 1;
  63. this.list = [];
  64. this.getData();
  65. }
  66. },
  67. //下拉刷新
  68. onPullDownRefresh() {
  69. setTimeout(() => {
  70. uni.stopPullDownRefresh();
  71. this.refresh();
  72. }, 1000);
  73. },
  74. //上拉加载
  75. onReachBottom() {
  76. if (this.loadMore) {
  77. this.param.pageNum++;
  78. this.getData();
  79. }
  80. }
  81. };
  82. </script>
  83. <style lang="scss">
  84. .list {
  85. padding: 0px 10px 70px 10px;
  86. .item {
  87. background-color: white;
  88. padding: 15px 8px 15px 8px;
  89. border-bottom: 1px solid #e5e5e5;
  90. border-radius: 5px;
  91. margin-top: 10px;
  92. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.2);
  93. .pic {
  94. float: left;
  95. width: 30%;
  96. border-radius: 3px;
  97. height: 80px;
  98. background-color: #dcdcdc;
  99. }
  100. .con {
  101. padding-left: 30px;
  102. width: 60%;
  103. float: left;
  104. .title {
  105. font-size: 15px;
  106. text-align: left;
  107. color: #252525;
  108. font-weight: bold;
  109. }
  110. .ms {
  111. margin-top: 10px;
  112. .ll {
  113. color: #d72424;
  114. font-size: 16px;
  115. padding-right: 5px;
  116. }
  117. .wz {
  118. font-size: 12px;
  119. }
  120. }
  121. .lx {
  122. float: right;
  123. color: #fff;
  124. background: #d72424;
  125. border-radius: 10px;
  126. padding: 8px 10px;
  127. font-size: 16px;
  128. color: white;
  129. font-weight: 700;
  130. margin-right: -20px;
  131. .icon {
  132. padding-right: 5px;
  133. font-size: 20px;
  134. }
  135. }
  136. }
  137. }
  138. }
  139. </style>