...
|
...
|
@@ -31,18 +31,16 @@ 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;
|
|
|
},
|
|
|
// resPages(state, {page, isMoreData}) {
|
|
|
// state.newsDeatilList.page = page;
|
|
|
// state.newsDeatilList.isMoreData = isMoreData;
|
|
|
// },
|
|
|
|
|
|
[Types.FETCH_NEWS_TAB_LIST](state, { list }) {
|
|
|
state.newsList.tabList = list;
|
...
|
...
|
@@ -50,16 +48,8 @@ export default function() { |
|
|
},
|
|
|
actions: {
|
|
|
async fetchNewsList({ commit, state }, obj) {
|
|
|
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;
|
|
|
|
|
|
if (isPage) {
|
|
|
page = 1;
|
|
|
}
|
|
|
console.log(obj);
|
|
|
let { isResetPage, limit, page, totalPage, type } = obj;
|
|
|
const result = await this.$api.post('/api/ufo/home/newsList', {
|
|
|
page, type: type || '', limit
|
|
|
});
|
...
|
...
|
@@ -68,19 +58,19 @@ export default function() { |
|
|
result.data.list && result.data.list.map((res) => {
|
|
|
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});
|
|
|
}
|
|
|
// if (type) {
|
|
|
// commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
|
|
|
// } else {
|
|
|
// commit(Types.FETCH_NEWS_LIST, {list: result.data});
|
|
|
// }
|
|
|
return result;
|
|
|
}
|
|
|
},
|
|
|
async fetchNewsTabList({ commit }) {
|
|
|
const result = await this.$api.post('/api/ufo/home/newsListTab', {});
|
|
|
if (result.code === 200) {
|
|
|
commit(Types.FETCH_NEWS_TAB_LIST, {list: result.data});
|
|
|
return result;
|
|
|
}
|
|
|
},
|
|
|
},
|
...
|
...
|
|