海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

99 lines
2.7 KiB

4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view class="page-color">
  3. <view class="padding-lr lf-p-t-30" v-if="article_list.length">
  4. <view class="card-discover lf-m-b-30" v-for="(item,index) of article_list" :key="index">
  5. <view class="lf-h-100 lf-w-100 lf-flex" @click="$url('/pages/notice/article?article_id='+item.big.id)" v-if="item.big">
  6. <image :src="item.big.image" mode="aspectFill" style="width: 686rpx;height: 300rpx;border-radius: 20rpx 20rpx 0 0;"></image>
  7. </view>
  8. <view class="flex-direction bg-white discover-radius" v-if="item.children">
  9. <view class="flex align-center text-center lf-p-30 solid-bottom" v-for="(i,index) of item.children" :key="index" @click="$url('/pages/notice/article?article_id='+i.id)">
  10. <view>
  11. <image :src="i.image" mode="aspectFill" style="width: 100rpx;height: 100rpx;border-radius: 10rpx;"></image>
  12. </view>
  13. <view class="lf-line-2 lf-color-333 lf-font-28 lf-text-left lf-m-l-20" style="line-height: 44rpx;">
  14. {{i.title}}
  15. </view>
  16. </view>
  17. </view>
  18. </view>
  19. </view>
  20. <!-- 加载 -->
  21. <view class="loading-more lf-p-b-40">
  22. <text v-if="article_list.length && loadingClass==false" :class="{'loading-more-text': loadingClass}">{{ loadingText }}</text>
  23. <lf-nocontent v-if="!article_list.length && loadingClass==false"></lf-nocontent>
  24. </view>
  25. <!-- 回到顶部 -->
  26. <u-back-top :scroll-top="pageScrollTop" :custom-style="{background: 'rgba(51, 51 51, 0.3)'}"></u-back-top>
  27. </view>
  28. </template>
  29. <script>
  30. export default {
  31. data() {
  32. return {
  33. page: 1,
  34. article_list: [],
  35. loadingClass: true,
  36. loadingText: '正在加载中',
  37. isPage: false
  38. }
  39. },
  40. methods: {
  41. getArticle() {
  42. this.$http(this.API.API_FINDARTICLE,{page: this.page}).then(res => {
  43. let isPage = res.data.next_page_url == null?false:true;
  44. this.isPage = isPage;
  45. if(!isPage){
  46. this.loadingClass = false;
  47. this.loadingText = '没有更多数据啦~';
  48. }
  49. if(this.page == 1){
  50. this.article_list = res.data.data;
  51. }else{
  52. this.article_list.push(...res.data.data);
  53. }
  54. console.log(res)
  55. }).catch(err => {
  56. })
  57. },
  58. },
  59. onLoad() {
  60. this.getArticle()
  61. },
  62. onReachBottom(){
  63. if(this.isPage){
  64. this.page = this.page + 1;
  65. this.getArticle();
  66. }
  67. },
  68. onPullDownRefresh(){
  69. this.page = 1;
  70. this.isPage = true;
  71. this.loadingClass = true;
  72. this.loadingText = '正在加载中';
  73. this.getArticle();
  74. uni.stopPullDownRefresh();
  75. }
  76. }
  77. </script>
  78. <style>
  79. page{
  80. background-color: #F6F6F6;
  81. }
  82. </style>
  83. <style scoped>
  84. .page-color {
  85. width: 100%;
  86. height: 100%;
  87. background-color: #F6F6F6;
  88. }
  89. .card-discover {
  90. border-radius: 20rpx;
  91. }
  92. .discover-radius {
  93. border-radius: 0 0 20rpx 20rpx;
  94. }
  95. </style>