jialh
2024-12-11 cb5ecb1d5e80fe0b510e5dc229c02bd25a89153b
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<template>
    <view class="container">
        <header>
            <!-- <u-input class="search" placeholder="搜索" type="text" v-model="search" />
            <u-button type="primary" style="width: 100upx;margin-top: 20upx;" size="normal" text="搜索"
                @click="onPageChange(1)"></u-button> -->
            <view class="right">
                <image src="/static/index/search.png" mode=""></image>
                <input class="search" placeholder="请输入感兴趣的政策内容" type="text" v-model="search" />
                <u-button type="primary" style="width: 100upx;border-radius: 18upx;" size="normal" text="搜索"
                    @click="onPageChange(1)"></u-button>
            </view>
        </header>
        <view style="padding: 0 20upx;background-color: #fff;display: flex;justify-content: space-between;">
            <scroll-view scroll-x class="tabs-scroll" style="white-space: nowrap;">
                <u-tabs :list="tabsList" @click="chooseArticleType" style="padding-left: 4px;" lineWidth="20"
                    lineColor="#6190E8" :activeStyle="{
                        color: '#6190E8',
                        transform: 'scale(1.05)'
                    }" :inactiveStyle="{
                        color: '#606266',
                        transform: 'scale(1)'
                    }" itemStyle="padding-left: 15px; padding-right: 15px; height: 54px;" :scrollable="true">
                </u-tabs>
            </scroll-view>
        </view>
        <view v-if="!loading && goodsList.length > 0"
            style="padding: 40upx;background-color: #fff;margin-top: 20upx;color: #969799;font-size: 28upx;padding-bottom: 200upx;">
            <view class="goods-item" v-for="(item, index) in goodsList" :key="index" @click="godetail(item)">
                <view style="background-color: #f7f7f7;padding: 10upx;margin-bottom: 10upx;">
                    <view style="display: flex;justify-content: space-between;">
                        <view style="font-weight: 800px;color: #000;">{{ item.ArticleTitle }}</view>
                        <view style="width: auto;" @click.stop="star(item)">
                            <u-icon name="star-fill" color="gold" size="28"></u-icon>
                        </view>
                    </view>
                    <view style="display: flex;justify-content: space-between;">
                        <view style="font-size: 22upx;line-height: 44upx;">{{ item.Platform }}</view>
                        <u-tag :text="item.PubTime.split(' ')[0]" plain size="mini" type="warning"></u-tag>
                    </view>
                </view>
            </view>
        </view>
        <view v-if="loading" style="margin-top: 100upx;">
            <u-loading-icon></u-loading-icon>
        </view>
        <u-empty v-if="!loading && goodsList.length == 0" mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png">
        </u-empty>
        <view style="position: fixed;bottom: 0;background-color: #fff;width: 100%;">
            <Pagination :totalItems="total" :itemsPerPage="pageSize" :currentPage="pageIndex"
                @page-change="onPageChange" />
        </view>
    </view>
</template>
<script>
    import Pagination from '../../components/Pagination';
    export default {
        components: {
            Pagination
        },
        data() {
            return {
                total: 0,
                pageIndex: 1,
                pageSize: 8,
                search: '',
                titleNViewBackground: '',
                swiperCurrent: 0,
                swiperLength: 0,
                carouselList: [],
                goodsList: [],
 
                showLocation: false,
                locationList: [],
                loading: false,
                tabsList: [{
                        name: '综合',
                        ArticleType: '',
                    },
                    {
                        name: '申报通知',
                        ArticleType: '申报通知'
 
                    },
                    {
                        name: '公示公告',
                        ArticleType: '公示公告'
                    },
                    {
                        name: '政策',
                        ArticleType: '政策'
                    },
                    {
                        name: '法规',
                        ArticleType: '法规'
                    },
                    {
                        name: '其他',
                        ArticleType: '其他'
                    },
                ],
                ArticleType: '',
            };
        },
        onLoad() {
            this.GetArticleCollectionList()
 
        },
        methods: {
            // 收藏
            star(item) {
                const userId = Number(uni.getStorageSync('userId'));
 
                const data = {
                    ArticleId: item.Id,
                    UserId: userId
                };
                this.$http.post('/CollectArticle/DelCollectArticleDataById', data).then(res => {
                    if (res.Check) {
 
                        this.$msg('操作成功');
                        this.pageIndex = 1
                        this.GetArticleCollectionList()
                    } else {
                        this.$msg(res.Msg);
                    }
                });
 
            },
 
            // 
            GetArticleCollectionList() {
                this.loading = true
                let data = {
                    Platform: '',
                    ArticleType: this.ArticleType,
                    Keyword: this.search,
                    PageNumber: this.pageIndex,
                    PageSize: this.pageSize,
                    UserId: uni.getStorageSync('userId')
                }
                this.$http.post('/ArticleData/GetArticleCollectionList', data).then(res => {
                    if (res.Check) {
                        this.goodsList = res.Data.Data
                        this.total = res.Data.TotalCount
                        this.loading = false
                    } else {
                        this.$msg(res.Msg)
                        this.goodsList = []
                        this.loading = false
                    }
                })
            },
            godetail(item) {
                // 手机浏览器跳转
                window.open(item.ArticleUrl, "_blank");
            },
            onPageChange(e) {
                this.pageIndex = e
                this.GetArticleCollectionList()
            },
            chooseArticleType(e) {
                this.pageIndex = 1
                this.ArticleType = e.ArticleType
                this.GetArticleCollectionList()
 
 
            }
 
        }
    }
</script>
 
<style lang="scss" scoped>
    page {
        background-color: #F7F7F7;
    }
 
    .mp-search-box {
        position: absolute;
        left: 0;
        top: 30upx;
        z-index: 9999;
        width: 100%;
        padding: 0 80upx;
 
        .ser-input {
            flex: 1;
            height: 56upx;
            line-height: 56upx;
            text-align: center;
            font-size: 28upx;
            color: $font-color-base;
            border-radius: 20px;
            background: rgba(255, 255, 255, .6);
        }
    }
 
    header {
        padding: 0 30upx;
        height: 120upx;
        background-color: #236AF0;
        display: flex;
        color: #fff;
        font-size: 14px;
 
        .right {
            flex: 1;
            display: flex;
            align-items: center;
            background-color: #fff;
            border-radius: 20upx;
            // height: 80upx;
            // line-height: 80upx;
            padding: 0 10upx 0 20upx;
            margin: 20upx 0;
            color: #236AF0;
 
            image {
                width: 28upx;
                height: 28upx;
                margin-right: 10upx;
            }
 
            .search {
                flex: 1;
            }
        }
 
    }
 
    /* 分类 */
    .cate-section {
        display: flex;
        justify-content: space-around;
        align-items: center;
        flex-wrap: wrap;
        padding: 30upx 22upx;
        background: #fff;
 
        .cate-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            font-size: $font-sm + 2upx;
            color: $font-color-dark;
        }
 
        /* 原图标颜色太深,不想改图了,所以加了透明度 */
        image {
            width: 88upx;
            height: 88upx;
            margin-bottom: 14upx;
            border-radius: 50%;
            opacity: .7;
            box-shadow: 4upx 4upx 20upx rgba(250, 67, 106, 0.3);
        }
    }
 
    .u-page__tag-item {
        height: 40upx;
        line-height: 40upx;
        min-width: 50upx;
        text-align: center;
        margin: 10upx;
    }
</style>