...
|
...
|
@@ -31,25 +31,35 @@ export default function() { |
|
|
},
|
|
|
|
|
|
[Types.FETCH_NEWSDETAIL_LIST](state, { list }) {
|
|
|
console.log(list.page);
|
|
|
console.log("list.page");
|
|
|
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;
|
|
|
},
|
|
|
|
|
|
resPages(state, {page, isMoreData}) {
|
|
|
state.newsDeatilList.page = page;
|
|
|
state.newsDeatilList.isMoreData = isMoreData;
|
|
|
},
|
|
|
|
|
|
[Types.FETCH_NEWS_TAB_LIST](state, { list }) {
|
|
|
state.newsList.tabList = list;
|
|
|
},
|
|
|
},
|
|
|
actions: {
|
|
|
async fetchNewsList({ commit, state }, obj) {
|
|
|
let page = state.newsList.page + 1;
|
|
|
let limit = state.newsList.limit;
|
|
|
console.log(obj)
|
|
|
console.log("objobj")
|
|
|
let type = obj && obj.type;
|
|
|
let page = type ? state.newsDeatilList.page + 1 : state.newsList.page + 1;
|
|
|
let limit = state.newsList.limit;
|
|
|
let isPage = obj && obj.isPage;
|
|
|
|
|
|
// 页面跳转重置page页码
|
|
|
isPage ? page = 1 : state.newsList.page + 1;
|
|
|
if (isPage) {
|
|
|
page = 1;
|
|
|
}
|
|
|
const result = await this.$api.post('/api/ufo/home/newsList', {
|
|
|
page, type: type || '', limit
|
|
|
});
|
...
|
...
|
@@ -59,8 +69,10 @@ export default function() { |
|
|
res.createTime = moment(new Date(res.createTime * 1000)).format('YYYY.MM.DD HH:mm');
|
|
|
});
|
|
|
if (type) {
|
|
|
console.log('1');
|
|
|
commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
|
|
|
} else {
|
|
|
console.log('2');
|
|
|
commit(Types.FETCH_NEWS_LIST, {list: result.data});
|
|
|
}
|
|
|
}
|
...
|
...
|
|