Administrator
2021-06-15 df5fd3427870d83085f8bb02c038fdd443b6542f
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
<template>
    <view class="advisory-big">
        
         <!-- <view
            ref="k-scroll-view"
            :refreshType="refreshType"
            :refreshTip="refreshTip"
            :loadTip="loadTip"
            :loadingTip="loadingTip"
            :emptyTip="emptyTip"
            :touchHeight="touchHeight"
            :height="height"
            :bottom="bottom"
            :autoPullUp="autoPullUp"
            @onPullDown="handlePullDown"
            @onPullUp="handleLoadMore"> -->
            <view  v-for="i in data" class="advisory-model" @click="goDetail(i)">
                <view class="advisory-left">
                    <view class="advisory-title-top">
                        <view class="advisory-title">{{i.title}}</view>
                    </view>
                    <view class="advisory-title-down">
                        <view class="advisory-title-name">{{i.sourceName}}</view>
                        <view class="advisory-title-time">{{i.createTime}}</view>
                    </view>
                </view>
                <view class="advisory-right">
                    <image :src="i.url"></image>
                </view>
                
            </view>
        <!-- </view> -->
        <!-- <uni-load-more :status="status" :content-text="contentText"/> -->
        
        
    </view>
</template>
 
<script>
    // import kScrollView from '@/components/k-scroll-view/k-scroll-view.vue';
    export default{
        // components: {
        //     kScrollView
        // },
        data(){
            return {
                // pathUrl:"http://localhost:89/",
                pathUrl:"http://s16s652780.51mypc.cn/api/blade-jfpts",
                // refreshType: 'custom',
                // refreshTip: '正在下拉',
                // loadTip: '获取更多数据',
                // loadingTip: '正在加载中...',
                // emptyTip: '--我是有底线的--',
                // touchHeight: 50,
                // height: 0,
                // bottom: 50,
                // autoPullUp: true,
                // stopPullDown:true, // 如果为 false 则不使用下拉刷新,只进行上拉加载
                // status: 'more',
                // statusTypes: [{
                //     value: 'more',
                //     text: '加载前',
                //     checked: true
                // }, {
                //     value: 'loading',
                //     text: '加载中',
                //     checked: false
                // }, {
                //     value: 'noMore',
                //     text: '没有更多',
                //     checked: false
                // }],
                // contentText: {
                //     contentdown: '下拉查看更多',
                //     contentrefresh: '加载中',
                //     contentnomore: '没有更多'
                // },
                data:[]
            }
        },
        mounted(){
            this.getArtcilePageList();
        },
        onPullDownRefresh () {            // 下拉刷新事件
            console.log('触发下拉刷新了')
            // 一些列操作
            uni.stopPullDownRefresh()        // 结束当前刷新事件
          },
        methods:{
            //去跳转详情页面
            goDetail(e){
                
                //内容传值容易报错,所以直传id,然后调用接口去查询
                // let detail = {
                //     title: e.title,
                //     content: e.content,
                //     id: e.id,
                //     createTime: e.createTime,
                //     sourceName: e.sourceName,
                //     imgUrl: e.url,
                //     videoUrl:e.videoUrl
                // };
                
                let detail = {
                    id: e.id
                };
                //去跳转
                uni.navigateTo({
                    url: './article_detail?detailData=' + JSON.stringify(detail)
                });
            },
            
            //获取资讯信息
            getArtcilePageList(){
                var that = this;
                uni.request({
                    url: that.pathUrl+'/article/article/page',
                    method:'GET',
                    success: (res) => {
                        that.data = res.data.data.records;
                    }
                });
            },
            //下拉获取更多
            // handlePullDown(stopLoad) {
            //     this.data = [];
            //     for (var i = 0; i < 10; i++) {
            //         this.data.push(i);
            //     }
            //     stopLoad ? stopLoad() : '';
            // },
            // //上拉加载
            // handleLoadMore(stopLoad) {
            //     const size = this.data.length;
            //     if (size < 100) {
            //         const data = [];
            //         for (var i = 0; i < 10; i++) {
            //             data.push(size + i);
            //         }
            //         this.data = this.data.concat(data);
            //         stopLoad ? stopLoad() : '';
            //     } else {
            //         stopLoad ? stopLoad({ isEnd: true }) : '';
            //     }
            // },
            // handleGoTop() {
            //     this.$refs['k-scroll-view'].goTop();
            // }
        }
    }
</script>
 
<style lang="scss" scoped>
    .advisory-big{
        width: 100%;
        height: 70%;
        position: absolute;
        top: 2%;
        // background-color: #0078A8;
        
        .advisory-model{
            width: 100%;
            height: 20%;
            // background-color: #00FF00;
            
            
            .advisory-left{
                width: 61%;
                height: 80%;
                float: left;
                position: relative;
                // background-color: #00FFFF;
                position: relative;
                left: 4%;
                top: 10%;
                
                
                .advisory-title-top{
                    // background-color: #2692FD;
                    width: 100%;
                    height: 75%;
                    
                    .advisory-title{
                        width: 92%;
                        font-size: 15px;
                        font-weight: 550;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box; 
                        -webkit-line-clamp: 2; 
                        -webkit-box-orient: vertical;
                    }
                    
                    
                }
                
                .advisory-title-down{
                    // background-color: #0078A8;
                    width: 100%;
                    height: 25%;
                    font-size: 12px;
                    font-weight: 550;
                    color: #808080;
                    
                    .advisory-title-name{
                        width: 130rpx;
                        float: left;
                        letter-spacing: 1px;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        display: -webkit-box; 
                        -webkit-line-clamp: 1; 
                        -webkit-box-orient: vertical;
                        // background-color:#0078A8;
                    }
                    
                    .advisory-title-time{
                        position: relative;
                        left: 15rpx;
                    }
                }
                
            }
            
            .advisory-right{
                // background-color: #222222;
                width: 32%;
                height: 80%;
                left: 63%;
                position: relative;
                top: 10%;
                
                image{
                    position: relative;
                    left: 0px;
                    top: -100%;
                    width: 100%;
                    height: 100%;
                    border-radius: 5px;
                }
            }
            
            
        }
        
        
        
        
        
    }
    
    
    
    
</style>