...
|
...
|
@@ -24,7 +24,7 @@ export default function() { |
|
|
},
|
|
|
mutations: {
|
|
|
[Types.FETCH_NEWS_LIST](state, { list }) {
|
|
|
state.newsList.list = state.newsList.list.concat(list.list);
|
|
|
state.newsList.list = list.page > 1 ? state.newsList.list.concat(list.list) : list.list;
|
|
|
state.newsList.page = list.page;
|
|
|
state.newsList.totalPage = list.totalPage;
|
|
|
list.page < list.totalPage ? state.newsList.isMoreData = true : state.newsList.isMoreData = false;
|
...
|
...
|
@@ -45,23 +45,23 @@ export default function() { |
|
|
async fetchNewsList({ commit, state }, obj) {
|
|
|
let page = state.newsList.page + 1;
|
|
|
let limit = state.newsList.limit;
|
|
|
let totalPage = state.newsList.totalPage;
|
|
|
let type = obj && obj.type;
|
|
|
let isPage = obj && obj.isPage;
|
|
|
|
|
|
// 页面跳转重置page页码
|
|
|
isPage ? page = 1 : state.newsList.page + 1;
|
|
|
const result = await this.$api.post('/api/ufo/home/newsList', {
|
|
|
page, type: type || '', limit, uid: 500031928
|
|
|
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');
|
|
|
});
|
|
|
commit(Types.FETCH_NEWS_LIST, {list: result.data});
|
|
|
if (obj.type == 1 || obj.type == 2 || obj.type == 3) {
|
|
|
if (type) {
|
|
|
commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
|
|
|
} else {
|
|
|
commit(Types.FETCH_NEWS_LIST, {list: result.data});
|
|
|
}
|
|
|
}
|
|
|
},
|
...
|
...
|
|