Authored by Tao

modify news pages

... ... @@ -53,7 +53,12 @@ export default {
methods: {
...mapActions(['fetchNewsList', 'fetchNewsTabList']),
async onPullingUp() {
await this.fetchNewsList();
if (!this.newsList.isMoreData ) return false;
let params = {
type: '',
isPage: false
};
await this.fetchNewsList(params);
this.$refs.scroll.forceUpdate();
}
},
... ...
... ... @@ -55,6 +55,7 @@ export default {
methods: {
...mapActions(['fetchNewsList']),
async onPullingUp() {
if (!this.newsDeatilList.isMoreData ) return false;
let params = {
type: this.type,
isPage: false
... ...
... ... @@ -11,6 +11,7 @@ export default function() {
page: 0,
limit: 10,
totalPage: 0,
isMoreData: true,
},
newsDeatilList: {
list: [],
... ... @@ -18,6 +19,7 @@ export default function() {
page: 0,
limit: 10,
totalPage: 0,
isMoreData: true,
}
},
mutations: {
... ... @@ -25,12 +27,14 @@ export default function() {
state.newsList.list = state.newsList.list.concat(list.list);
state.newsList.page = list.page;
state.newsList.totalPage = list.totalPage;
list.page < list.totalPage ? state.newsList.isMoreData = true : state.newsList.isMoreData = false;
},
[Types.FETCH_NEWSDETAIL_LIST](state, { list }) {
state.newsDeatilList.list = list.page > 1 ? state.newsDeatilList.list.concat(list.list) : list.list;
state.newsDeatilList.page = list.page;
state.newsDeatilList.totalPage = list.totalPage;
list.page < list.totalPage ? state.newsDeatilList.isMoreData = true : state.newsDeatilList.isMoreData = false;
},
[Types.FETCH_NEWS_TAB_LIST](state, { list }) {
... ... @@ -39,7 +43,6 @@ export default function() {
},
actions: {
async fetchNewsList({ commit, state }, obj) {
console.log(obj);
let page = state.newsList.page + 1;
let limit = state.newsList.limit;
let totalPage = state.newsList.totalPage;
... ... @@ -49,7 +52,7 @@ export default function() {
// 页面跳转重置page页码
isPage ? page = 1 : state.newsList.page + 1;
const result = await this.$api.post('/api/ufo/home/newsList', {
page, type, limit, uid: 500031928
page, type: type || '', limit, uid: 500031928
});
if (result.code === 200) {
... ...