Authored by Tao

modify channel && news

... ... @@ -9,7 +9,6 @@
@scroll="scrollHandler"
:options="options"
@pulling-up="onPullingUp"
@pulling-down="onPullingDown"
:data="productList.list">
<div class="channel-body" ref="body">
<div ref="topSource" class="channel-html">
... ... @@ -57,9 +56,9 @@ export default {
scrollbar: true,
pullUpLoad: true,
// pullDownRefresh: true,
pullDownRefresh: {
txt: '刷新成功',
}
// pullDownRefresh: {
// txt: '刷新成功',
// }
},
scrollEvents: ['scroll'],
scrollY: 0,
... ... @@ -217,12 +216,12 @@ export default {
}
},
onPullingDown() {
let params = this.searchParams;
// onPullingDown() {
// let params = this.searchParams;
params.isReset = true;
this.fetchList(params);
},
// params.isReset = true;
// this.fetchList(params);
// },
},
components: {
Swiper,
... ...
... ... @@ -9,7 +9,7 @@
<div class="news-content">
<Tab v-if="newsList.tabList.length > 0" :list="newsList.tabList || []"></Tab>
<List v-if="newsList.list && newsList.list.length > 0" :list="newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-6op: 60px"></UfoNoItem>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-top: 60px"></UfoNoItem>
</div>
</Scroll>
</div>
... ... @@ -32,7 +32,9 @@ export default {
msg: '消息',
options: {
pullUpLoad: {
threshold: 100,
txt: {
txt: '加载中...',
noMore: '~ 已经到底啦 ~'
}
}
... ... @@ -73,7 +75,9 @@ export default {
this.params.page = this.params.page + 1;
this.newsList.page = result.data.page;
this.newsList.totalPage = result.data.totalPage;
if (this.newsList.page == this.newsList.totalPage) {
if (this.newsList.page < this.newsList.totalPage) {
this.newsList.isMoreData = true;
} else {
this.newsList.isMoreData = false;
}
}
... ... @@ -91,6 +95,7 @@ export default {
return;
}
this.fetchList(this.params);
this.$refs.scroll.forceUpdate();
},
},
components: {
... ...
... ... @@ -9,7 +9,7 @@
<div class="news-content">
<Title :title="title"></Title>
<List v-if="newsList.list && newsList.list.length > 0" :list="newsList.list || []"></List>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-6op: 60px"></UfoNoItem>
<UfoNoItem v-else :tip="`暂无数据`" style="margin-top: 60px"></UfoNoItem>
</div>
</Scroll>
</div>
... ... @@ -29,7 +29,9 @@ export default {
return {
options: {
pullUpLoad: {
threshold: 100,
txt: {
more: '加载中...',
noMore: '~ 已经到底啦 ~'
}
}
... ... @@ -68,13 +70,14 @@ export default {
async fetchList() {
let result = await this.fetchNewsList({ ...this.params });
if (result.code && result.code == 200) {
console.log(result.data);
if (!this.newsList.isMoreData) return;
this.newsList.list = this.newsList.list.concat(result.data.list);
this.newsList.list = result.data.totalPage == 0 ? this.newsList.list : this.newsList.list.concat(result.data.list);
this.params.page = this.params.page + 1;
this.newsList.page = result.data.page;
this.newsList.totalPage = result.data.totalPage;
if (this.newsList.page == this.newsList.totalPage) {
if (this.newsList.page < this.newsList.totalPage) {
this.newsList.isMoreData = true;
} else {
this.newsList.isMoreData = false;
}
}
... ... @@ -86,6 +89,7 @@ export default {
return;
}
this.fetchList(this.params);
this.$refs.scroll.forceUpdate();
}
},
components: {
... ...
... ... @@ -51,18 +51,18 @@ export default function() {
console.log(obj);
let { isResetPage, limit, page, totalPage, type } = obj;
const result = await this.$api.post('/api/ufo/home/newsList', {
page, type: type || '', limit,
page, type: type || '', limit
});
if (result.code === 200) {
result.data.list && result.data.list.map((res) => {
res.createTime = moment(new Date(res.createTime * 1000)).format('YYYY.MM.DD HH:mm');
});
if (type) {
commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
} else {
commit(Types.FETCH_NEWS_LIST, {list: result.data});
}
// if (type) {
// commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
// } else {
// commit(Types.FETCH_NEWS_LIST, {list: result.data});
// }
return result;
}
},
... ...