Authored by TaoHuang

Merge remote-tracking branch 'origin/develop' into develop

... ... @@ -2,7 +2,7 @@
<LayoutApp :show-back="true" :hide-header="hideHeader">
<div class="scroll-list-wrap">
<template v-if="isShow">
<div v-for="(item, index) in channelList.list" v-if="item.template_name == 'guessLike'">
<div v-for="(item, index) in channelList.list" :key="index" v-if="item.template_name == 'guessLike'">
<ScrollNav :list="item.data" :current="active"></ScrollNav>
</div>
</template>
... ...
... ... @@ -7,6 +7,6 @@ export default [
{
name: 'newsDetail',
path: '/xianyu/newsDetail',
component: () => import(/* webpackChunkName: "newsDetail" */ './newsDetail')
component: () => import(/* webpackChunkName: "newsDetail" */ './newsDetail'),
}
];
\ No newline at end of file
... ...
... ... @@ -5,10 +5,10 @@
ref="scroll"
:options="options"
@pulling-up="onPullingUp"
:data="newsList.list">
:data="newsDeatilList.list">
<div class="news-content">
<Title :title="title"></Title>
<List :list="newsList && newsList.list || []" :isTitle="false"></List>
<List :list="newsDeatilList && newsDeatilList.list || []" :isTitle="false"></List>
</div>
</Scroll>
</div>
... ... @@ -36,7 +36,7 @@ export default {
}
},
computed: {
...mapState(['newsList']),
...mapState(['newsList','newsDeatilList']),
},
mounted() {
let params = {
... ...
... ... @@ -13,6 +13,14 @@ export default function() {
totalPage: 0,
uid: '500031170',
},
newsDeatilList: {
list: [],
tabList: [],
page: 0,
limit: 10,
totalPage: 0,
uid: '500031170',
}
},
mutations: {
[Types.FETCH_NEWS_LIST](state, { list }) {
... ... @@ -21,12 +29,19 @@ export default function() {
state.newsList.totalPage = list.totalPage;
},
[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;
},
[Types.FETCH_NEWS_TAB_LIST](state, { list }) {
state.newsList.tabList = list;
},
},
actions: {
async fetchNewsList({ commit, state }, obj) {
console.log(obj);
let page = state.newsList.page + 1;
let uid = state.newsList.uid;
let limit = state.newsList.limit;
... ... @@ -40,19 +55,22 @@ export default function() {
if (page === totalPage) {
return false;
}
const result = await this.$api.post('/api/ufo/home/newsList', {
page, uid, type, limit
});
if (result.code === 200) {
// 时间戳转换 moment
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) {
commit(Types.FETCH_NEWSDETAIL_LIST, {list: result.data});
}
}
},
async fetchNewsTabList({ commit, state }) {
async fetchNewsTabList({ commit }) {
let uid = '500031170';
const result = await this.$api.post('/api/ufo/home/newsListTab', { uid });
if (result.code === 200) {
... ...
... ... @@ -6,6 +6,7 @@ export const FETCH_CHANNEL = 'FETCH_CHANNEL';
export const FETCH_PRODUCT = 'FETCH_PRODUCT';
export const FETCH_NEWS_LIST = 'FETCH_NEWS_LIST';
export const FETCH_NEWS_TAB_LIST = 'FETCH_NEWS_TAB_LIST';
export const FETCH_NEWSDETAIL_LIST = 'FETCH_NEWSDETAIL_LIST';
export const FETCH_FAVORITE_LIST_REQUEST = 'FETCH_FAVORITE_LIST_REQUEST';
export const FETCH_FAVORITE_LIST_FAILD = 'FETCH_FAVORITE_LIST_FAILD';
... ...