shuishen
2022-02-18 7473eb735cf82bb88f43b263f9cc74e43fe8f5e3
pages/article/article.vue
@@ -55,7 +55,7 @@
      </view> -->
      <!-- 底部导航条 -->
      <u-tabbar :list="tabbar" :mid-button="false"></u-tabbar>
      <u-tabbar :list="tabbar" :mid-button="true"></u-tabbar>
   </view>
</template>
@@ -70,7 +70,7 @@
            // pathUrl:"http://localhost:89/",
            pathUrl: this.$store.state.piAPI + "",
            page: 1,
            pagesize: 10,
            pagesize: 99999,
            status: 'loadmore',
            // loadStatus:'loading',  //加载样式:more-加载前样式,loading-加载中样式,nomore-没有数据样式
            isLoadMore: false, //是否加载中
@@ -173,7 +173,6 @@
               query
                  .select('#articleBox')
                  .boundingClientRect(data => {
                     that.swiperHeight = (safeArea.bottom - data.top - 50);
                  })
@@ -184,11 +183,12 @@
      //上拉加载更多
      onReachBottom() {
         console.log(2323232)
         if (this.status == 'nomore') return;
         this.page = ++this.page;
         setTimeout(() => {
            this.getArtcilePageList(this.tabInfo);
         }, 1000);
         }, 100);
      },
      methods: {
         goTabDetail(index) {
@@ -199,10 +199,18 @@
            let detail = {
               id: e.id
            };
            //去跳转
            uni.navigateTo({
               url: './article_detail?detailData=' + JSON.stringify(detail)
            });
            if(e.articleType.indexOf("ksp") != -1){
               //去跳转
               uni.navigateTo({
                  url: './article_video?detailData=' + (JSON.stringify(e))
               });
            }else{
               //去跳转
               uni.navigateTo({
                  url: './article_detail?detailData=' + JSON.stringify(detail)
               });
            }
         },
         //on input 通过 keyword 关键字查询
         getKeyword() {
@@ -229,23 +237,23 @@
               }
            }
            uni.request({
               url: this.$store.state.piAPI + '/article/article/pageDate',
               url: that.$store.state.piAPI + '/article/article/pageDate',
               method: 'GET',
               data: paramData,
               success: (res) => {
                  if (res.data.code == 200) {
                     if (res.data.data.records) {
                        //如果总数小于pageSize,不做其他操作
                        if (res.data.data.total < this.pagesize) {
                        if (res.data.data.total < that.pagesize) {
                           that.data = res.data.data.records;
                           that.status = 'nomore';
                        } else {
                           if (res.data.data.records.length < this.pagesize) {
                           if (res.data.data.records.length < that.pagesize) {
                              //如果数量小于分页数量,则为最后一页
                              this.status = 'nomore'
                           } else {
                              that.status = 'nomore'
                           } else {
                              //否则继续加载更多数据
                              this.status = 'loading';
                              that.status = 'loading';
                           }
                           res.data.data.records.forEach((item) => {
                              that.data.push(item);
@@ -265,7 +273,6 @@
            this.getArtcilePageList(e);
         },
         refreshing() {
            if (this.isRefreshing) {
               return;
            }
@@ -274,10 +281,6 @@
            if (!this.triggered) {
               this.triggered = true;
            }
            this.dataListP = [];
            this.dataListQZ = [];
            this.dataListTXL = [];
            this.getArtcilePageList();
         },
@@ -290,11 +293,7 @@
</script>
<style>
   page {
      width: 100%;
      height: 100%;
      background-color: #f7f7f7;
   }
</style>
<style lang="scss" scoped>