linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
subPackage/article/list.vue
@@ -1,30 +1,16 @@
<template>
   <view class="">
      <view class="tab">
         <u-tabs :list="tabList" :current="tabIndex" keyName="dictValue" @change="changeTab"
            :inactiveStyle="{color:'#999999'}" :activeStyle="{color:'#017BFC'}"></u-tabs>
      </view>
      <view class="list">
         <view class="notic-list bgc-ff" v-for="(item,index) in noticeList" key="index" @click="navTo(item.id)">
            <view class="f-28 mb-30">
               {{item.title}}
            </view>
            <view class="flex a-i-c j-c-s-b">
               <view class="f-28 flex a-i-c">
                  <!-- <view class="flex a-i-c mr-30">
                  <u-icon name="thumb-up-fill" size="24" color="#CECECE"></u-icon>
                  <text class="f-24 c-99 ml-10">{{item.countNumber}}</text>
               </view> -->
                  <view class="flex a-i-c">
                     <u-icon name="eye-fill" size="20" color="#CECECE"></u-icon>
                     <text class="f-24 c-99 ml-10">{{item.viewNumber}}</text>
                  </view>
               </view>
               <text class="f-24 c-99">{{item.createTime}}</text>
            </view>
      <z-paging ref="paging" v-model="list" :auto="false" @query="queryList" @onRefresh="refreshList"
         loading-more-no-more-text="没有更多了">
         <view class="tab" slot="top" v-show="tabList.length">
            <u-tabs :list="tabList" :current="tabIndex" keyName="dictValue" @change="changeTab"
               :inactiveStyle="{color:'#999999'}" :activeStyle="{color:'#017BFC'}"></u-tabs>
         </view>
         <u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line />
      </view>
         <view class="list bgc-ff">
            <notice-list :data="list" :page-type="type" />
         </view>
      </z-paging>
      <!-- <u-loadmore :status="loadingStatus" loadmoreText="开始加载" loadingText="数据加载中" nomoreText="没有更多了" line /> -->
   </view>
</template>
@@ -33,39 +19,77 @@
      getPage,
      getCategory
   } from "@/api/article/article.js";
   import noticeList from "@/components/noticeList/noticeList.vue"
   export default {
      components: {
         noticeList
      },
      data() {
         return {
            tabList: [],
            tabId: "",
            tabIndex: 0,
            noticeList: [],
            list: [],
            currentPage: 1,
            loadingStatus: 'nomore'
            loadingStatus: 'nomore',
            eventType: "",
            type: ""
         }
      },
      onLoad() {
         this.getCateList()
      onLoad(option) {
         console.log(option);
         if (option.type == 1) {
            // this.eventType = option.type;
            // if (option.type == 0) {
            //    this.tabList = [{
            //       dictKey: "",
            //       dictValue: "公益报名"
            //    }]
            // } else {
            //    this.tabList = [{
            //       dictKey: "",
            //       dictValue: "选举调查"
            //    }]
            // }
            // this.getNoticeList()
            uni.setNavigationBarTitle({
               title: "公共收益"
            })
            this.type = option.type;
            this.$refs.paging.reload();
         } else if (option.type == 6) {
            uni.setNavigationBarTitle({
               title: "反诈宣传"
            })
            this.type = option.type;
            this.$refs.paging.reload();
         } else {
            this.getCateList()
         }
      },
      onReachBottom() {
         this.currentPage++
         this.getPageList()
      },
      // onReachBottom() {
      //    this.currentPage++
      //    this.getNoticeList()
      // },
      methods: {
         refreshList() {
            this.$refs.paging.reload();
         },
         changeTab(e) {
            this.tabIndex = e.index;
            this.tabId = e.dictKey;
            this.noticeList = [];
            this.list = [];
            this.currentPage = 1;
            this.getNoticeList()
            this.$refs.paging.reload();
            // this.getNoticeList()
         },
         getCateList() {
            getCategory({
               parentId: '1722966265111248897'
               parentId: '1722966265111248897',
            }).then(res => {
               console.log(res)
               let data = res.data;
@@ -73,18 +97,36 @@
                  dictKey: "",
                  dictValue: "全部"
               })
               this.tabList = data;
               // this.tabId = data[0].dictKey;
               this.getNoticeList()
               // this.getNoticeList()
               this.$refs.paging.reload();
            })
         },
         queryList(pageNo, pageSize) {
            getPage({
               current: pageNo,
               size: pageSize,
               articleType: this.tabId,
               eventType: this.eventType,
               type: this.type,
               houseCode: uni.getStorageSync("siteInfo").houseCode
            }).then(res => {
               this.$refs.paging.complete(res.data.records);
            })
         },
         async getNoticeList() {
            this.loadingStatus = 'loadingmore'
            const param = {
               size: 10,
               current: this.currentPage,
               articleType: this.tabId
               articleType: this.tabId,
               eventType: this.eventType
            }
            const res = await getPage(param)
            const {
@@ -100,18 +142,18 @@
               })
               return
            }
            this.noticeList = [...this.noticeList, ...records]
            this.list = [...this.list, ...records]
            this.loadingStatus = 'nomore'
         },
         navTo(id) {
            this.$u.func.globalNavigator(`detail?id=${id}`, "navTo")
         navTo(id, type) {
            this.$u.func.globalNavigator(`detail?id=${id}&type=${type}`, "navTo")
         }
      }
   }
</script>
<style>
<style lang="scss">
   page {
      background-color: #f5f5f5;
   }
@@ -119,7 +161,7 @@
   .tab {
      width: 100%;
      height: 88rpx;
      position: fixed;
      // position: fixed;
      /*#ifdef H5*/
      top: 88rpx;
      /*#endif*/
@@ -131,15 +173,10 @@
      padding: 0 30rpx;
      box-sizing: border-box;
      z-index: 999;
   }
   .list {
      margin-top: 108rpx;
   }
   .notic-list {
      padding: 30rpx;
      border-bottom: 1px solid #f5f5f5;
      margin-top: 20rpx;
      padding: 0 30rpx;
   }
</style>