Authored by 邱骏

update

<template>
<LayoutApp :show-back="false" :hideHeader="hideHeader" :no-safe-area="true">
<waterfall :listData="listData"></waterfall>
<waterfall :listData="articleList"></waterfall>
</LayoutApp>
</template>
... ... @@ -9,7 +9,7 @@ import LayoutApp from '../../components/layout/layout-app';
import {createNamespacedHelpers} from 'vuex';
import waterfall from './components/waterfall';
const {mapActions, mapState} = createNamespacedHelpers('article/list');
const {mapActions, mapState} = createNamespacedHelpers('article/articleList');
export default {
name: 'article.vue',
... ... @@ -30,10 +30,13 @@ export default {
},
computed: {
...mapState(['articleList'])
},
asyncData({store, router}) {
return store.dispatch('article/articleList/fetchArticleList', {productSkn: 10000100});
},
methods: {
...mapActions(['fetchArticleList'])
},
};
... ...
<!--瀑布流组件-->
<template>
<div class="water-fall-container">
<div class="water-fall-container" >
{{articleList.length}}
</div>
</template>
... ... @@ -13,6 +14,12 @@ export default {
default: []
}
},
computed: {
articleList() {
console.log(this.listData);
return this.listData;
}
}
};
</script>
... ...
import * as Types from './types';
export default {
async fetchArticleList({commit, state}, {productSkn}) {
let result = await this.$api.get('/api/grass/product/article', {
productSkn,
productType: 2,
fromXianYu: 'Y'
});
if (result.code === 200 && result.data.list && result.data.list.length) {
commit(Types.FETCH_ARTICLE_LIST, result.data.list);
}
}
};
... ...
import * as Types from './types';
export default {
[Types.FETCH_ARTICLE_LIST](state, result) {
console.log(result);
state.articleList = result;
}
};
... ...
module.exports = {
'/api/ufo/seller/entryGoodsSizeList': {
auth: true,
accessLog: true,
checkSign: true,
ufo: true,
api: 'ufo.seller.entryGoodsSizeList',
'/api/grass/product/article': {
ufo: false,
auth: false,
api: 'app.grass.simpleProductArticle',
params: {
productId: { type: Number },
limit: { type: Number },
page: { type: Number },
},
productSkn: {type: Number},
productType: {type: Number},// 1.有货商品 2.ufo商品
fromXianYu: {type: String}
}
},
};
... ...