linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
    <view class="">
        <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>
            <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>
 
<script>
    import {
        getPage,
        getCategory
    } from "@/api/article/article.js";
    import noticeList from "@/components/noticeList/noticeList.vue"
    export default {
        components: {
            noticeList
        },
        data() {
            return {
                tabList: [],
                tabId: "",
                tabIndex: 0,
                list: [],
                currentPage: 1,
                loadingStatus: 'nomore',
                eventType: "",
                type: ""
            }
        },
        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.getNoticeList()
        // },
 
        methods: {
            refreshList() {
                this.$refs.paging.reload();
            },
 
            changeTab(e) {
                this.tabIndex = e.index;
                this.tabId = e.dictKey;
                this.list = [];
                this.currentPage = 1;
                this.$refs.paging.reload();
                // this.getNoticeList()
            },
 
            getCateList() {
                getCategory({
                    parentId: '1722966265111248897',
                }).then(res => {
                    console.log(res)
                    let data = res.data;
                    data.unshift({
                        dictKey: "",
                        dictValue: "全部"
                    })
 
                    this.tabList = data;
                    // this.tabId = data[0].dictKey;
                    // 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,
                    eventType: this.eventType
                }
                const res = await getPage(param)
                const {
                    code,
                    data: {
                        records
                    }
                } = res
                if (code != 200) {
                    uni.showToast({
                        title: '数据请求失败',
                        icon: 'error'
                    })
                    return
                }
                this.list = [...this.list, ...records]
                this.loadingStatus = 'nomore'
 
            },
            navTo(id, type) {
                this.$u.func.globalNavigator(`detail?id=${id}&type=${type}`, "navTo")
            }
        }
    }
</script>
 
<style lang="scss">
    page {
        background-color: #f5f5f5;
    }
 
    .tab {
        width: 100%;
        height: 88rpx;
        // position: fixed;
        /*#ifdef H5*/
        top: 88rpx;
        /*#endif*/
        /*#ifdef MP-WEIXIN*/
        top: 0;
        /*#endif*/
        left: 0;
        background-color: #fff;
        padding: 0 30rpx;
        box-sizing: border-box;
        z-index: 999;
    }
 
    .list {
        margin-top: 20rpx;
        padding: 0 30rpx;
    }
</style>