|
|
<template>
|
|
|
<resources v-bind:content-code.sync="contentCode"></resources>
|
|
|
<div v-for="news in newsList" class="news-box">
|
|
|
<div v-for="news in newsList" class="news-box" v-infinite-scroll="getNewsList()">
|
|
|
<span v-if='news.categoryName !== "最新"' class="tag">{{news.categoryName}}</span>
|
|
|
<div class="img">
|
|
|
<a href='{{"/news/" + news.id}}'>
|
...
|
...
|
@@ -87,8 +87,9 @@ |
|
|
contentCode: contentCode.news[qs.cate || 'new'],
|
|
|
newsList: [],
|
|
|
gender: qs.gender,
|
|
|
page: 1,
|
|
|
limit: 10,
|
|
|
page: 0,
|
|
|
busy: false,
|
|
|
scrollDisabled: false
|
|
|
};
|
|
|
},
|
|
|
watch: {
|
...
|
...
|
@@ -100,21 +101,30 @@ |
|
|
|
|
|
/* 获取资讯列表数据 */
|
|
|
getNewsList() {
|
|
|
$.post({
|
|
|
url: '/news/get-news-list',
|
|
|
data: {
|
|
|
sortId: this.crntCateId,
|
|
|
page: this.page,
|
|
|
limit: this.limit,
|
|
|
gender: this.gender || '1,2,3'
|
|
|
}
|
|
|
}).done(result => {
|
|
|
if (result) {
|
|
|
this.newsList = result;
|
|
|
} else {
|
|
|
tip('服务端无数据返回');
|
|
|
}
|
|
|
}).fail();
|
|
|
if (this.busy === false) {
|
|
|
this.busy = true;
|
|
|
$.post({
|
|
|
url: '/news/get-news-list',
|
|
|
data: {
|
|
|
sortId: this.crntCateId,
|
|
|
page: this.page++,
|
|
|
gender: this.gender || '1,2,3'
|
|
|
}
|
|
|
}).done(result => {
|
|
|
if (result.code === 200) {
|
|
|
if (this.newsList.length > 0 && result.data.list.length > 0) {
|
|
|
Array.prototype.push.apply(this.newsList, result.data.list);
|
|
|
} else {
|
|
|
this.newsList = result.data.list;
|
|
|
}
|
|
|
} else {
|
|
|
this.scrollDisabled = true;
|
|
|
}
|
|
|
this.busy = false;
|
|
|
}).fail(() => {
|
|
|
tip('服务器错误');
|
|
|
});
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/* 分享资讯 */
|
...
|
...
|
|