Authored by 邱骏

update

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