Authored by 李奇

Merge remote-tracking branch 'origin/release/4.0' into feature/new-category

# Conflicts:
#	src/components/resources/index.js
#	src/pages/channel/index.js
@@ -20,5 +20,13 @@ module.exports = { @@ -20,5 +20,13 @@ module.exports = {
20 id: {type: Number}, 20 id: {type: Number},
21 uid: {type: Number} 21 uid: {type: Number}
22 } 22 }
  23 + },
  24 + '/resource/get': {
  25 + api: 'operations/api/v5/resource/get',
  26 + cache: true,
  27 + service: true,
  28 + params: {
  29 + content_code: {type: String},
  30 + }
23 } 31 }
24 }; 32 };
1 const api = global.yoho.API; 1 const api = global.yoho.API;
  2 +const service = global.yoho.ServiceAPI;
2 const checkParams = require('../../utils/check-params'); 3 const checkParams = require('../../utils/check-params');
3 const apiMaps = require('../../config/api-map'); 4 const apiMaps = require('../../config/api-map');
4 5
@@ -9,22 +10,31 @@ module.exports = () => { @@ -9,22 +10,31 @@ module.exports = () => {
9 if (!apiInfo) { 10 if (!apiInfo) {
10 return next(); 11 return next();
11 } 12 }
12 - const baseParams = {  
13 - uid: req.yoho.uid || void 0,  
14 - method: apiInfo.api  
15 - }; 13 + let baseParams;
  14 +
  15 + if (!apiInfo.service) {
  16 + baseParams = {
  17 + uid: req.yoho.uid || void 0,
  18 + method: apiInfo.api
  19 + };
  20 + }
16 21
17 try { 22 try {
18 const reqParams = Object.assign({}, req.query, req.body, baseParams); 23 const reqParams = Object.assign({}, req.query, req.body, baseParams);
19 const params = checkParams.getParams(reqParams, apiInfo); 24 const params = checkParams.getParams(reqParams, apiInfo);
20 const cache = req.method.toLowerCase() !== 'get' ? false : apiInfo.cache; 25 const cache = req.method.toLowerCase() !== 'get' ? false : apiInfo.cache;
21 26
22 - return api[req.method]('', params, {  
23 - code: 200,  
24 - cache: cache  
25 - }).then(result => {  
26 - return result;  
27 - }); 27 + if (apiInfo.service) {
  28 + return service.get(apiInfo.api, params, {
  29 + cache: cache,
  30 + code: 200
  31 + });
  32 + } else {
  33 + return api[req.method]('', params, {
  34 + code: 200,
  35 + cache: cache
  36 + });
  37 + }
28 } catch (e) { 38 } catch (e) {
29 return res.json({ 39 return res.json({
30 code: 400, 40 code: 400,
@@ -113,7 +113,7 @@ @@ -113,7 +113,7 @@
113 "uglifyjs-webpack-plugin": "^0.4.6", 113 "uglifyjs-webpack-plugin": "^0.4.6",
114 "url-loader": "^0.5.9", 114 "url-loader": "^0.5.9",
115 "vue": "^2.5.13", 115 "vue": "^2.5.13",
116 - "vue-awesome-swiper": "^2.6.2", 116 + "vue-awesome-swiper": "^3.0.6",
117 "vue-hot-reload-api": "^1.2.0", 117 "vue-hot-reload-api": "^1.2.0",
118 "vue-html-loader": "^1.2.4", 118 "vue-html-loader": "^1.2.4",
119 "vue-infinite-scroll": "^2.0.1", 119 "vue-infinite-scroll": "^2.0.1",
1 const api = global.yoho.API; 1 const api = global.yoho.API;
  2 +const service = global.yoho.ServiceAPI;
2 const checkParams = require('../../utils/check-params'); 3 const checkParams = require('../../utils/check-params');
3 const apiMaps = require('../../config/api-map'); 4 const apiMaps = require('../../config/api-map');
4 const _ = require('lodash'); 5 const _ = require('lodash');
@@ -17,10 +18,12 @@ const request = ({url, method, reqParams, context}) => { @@ -17,10 +18,12 @@ const request = ({url, method, reqParams, context}) => {
17 return Promise.reject(NOT_FOUND_API_MAP); 18 return Promise.reject(NOT_FOUND_API_MAP);
18 } 19 }
19 try { 20 try {
20 - Object.assign(reqParams, {  
21 - uid: context.user.uid || 0,  
22 - method: apiInfo.api  
23 - }); 21 + if (!apiInfo.service) {
  22 + Object.assign(reqParams, {
  23 + uid: context.user.uid || 0,
  24 + method: apiInfo.api
  25 + });
  26 + }
24 if (_.has(apiInfo, 'params.uid') && 27 if (_.has(apiInfo, 'params.uid') &&
25 apiInfo.params.uid.require !== false && 28 apiInfo.params.uid.require !== false &&
26 reqParams.uid === 0) { // 如果接口uid是必须的但是有没有传入uid则直接返回空对象 29 reqParams.uid === 0) { // 如果接口uid是必须的但是有没有传入uid则直接返回空对象
@@ -29,10 +32,17 @@ const request = ({url, method, reqParams, context}) => { @@ -29,10 +32,17 @@ const request = ({url, method, reqParams, context}) => {
29 const params = checkParams.getParams(reqParams, apiInfo); 32 const params = checkParams.getParams(reqParams, apiInfo);
30 const cache = method.toLowerCase() !== 'get' ? false : apiInfo.cache; 33 const cache = method.toLowerCase() !== 'get' ? false : apiInfo.cache;
31 34
32 - return api[method]('', params, {  
33 - code: 200,  
34 - cache: cache  
35 - }); 35 + if (apiInfo.service) {
  36 + return service.get(apiInfo.api, params, {
  37 + cache: cache,
  38 + code: 200
  39 + });
  40 + } else {
  41 + return api[method]('', params, {
  42 + code: 200,
  43 + cache: cache
  44 + });
  45 + }
36 } catch (e) { 46 } catch (e) {
37 return Promise.reject({ 47 return Promise.reject({
38 code: 400, 48 code: 400,
1 import ResourceTwoImage from './resource-two-image'; 1 import ResourceTwoImage from './resource-two-image';
2 import ResourceFocusImage from './resource-focus-image'; 2 import ResourceFocusImage from './resource-focus-image';
3 import ResourceSingleImage from './resource-single-image'; 3 import ResourceSingleImage from './resource-single-image';
  4 +import ResourceProductList from './resource-product-list';
4 5
5 export default { 6 export default {
6 ResourceTwoImage, 7 ResourceTwoImage,
7 - ResourceFocusImage,  
8 - ResourceSingleImage 8 + ResourceSingleImage,
  9 + ResourceProductList,
  10 + ResourceFocusImage
9 }; 11 };
  1 +<template>
  2 + <resource>
  3 + <ul class="resource-products">
  4 + <li class="product-item" v-for="(item, index) in value" :key="index">
  5 + <img-format :src="item.src" :w="94" :h="125"></img-format>
  6 + <p class="title">{{item.title}}</p>
  7 + <p class="price">{{item.price}}</p>
  8 + </li>
  9 + </ul>
  10 + </resource>
  11 +</template>
  12 +
  13 +<script>
  14 +import Resource from './resource';
  15 +
  16 +export default {
  17 + name: 'ResourceSingleImage',
  18 + props: {
  19 + value: Array
  20 + },
  21 + computed: {
  22 + },
  23 + components: {Resource}
  24 +};
  25 +</script>
  26 +
  27 +<style lang="scss">
  28 +.resource-products {
  29 + width: 100%;
  30 + overflow-x: scroll;
  31 + -webkit-overflow-scrolling: touch;
  32 + white-space: nowrap;
  33 +
  34 + li.product-item {
  35 + display: inline-block;
  36 + padding-right: 20px;
  37 + text-align: center;
  38 + line-height: 40px;
  39 +
  40 + img {
  41 + width: 188px;
  42 + height: 250px;
  43 + }
  44 + }
  45 +}
  46 +</style>
1 <template> 1 <template>
2 - <resource class="single-image"> 2 + <resource class="resource-single-image">
3 <img-format :src="value.src" :w="250" :h="250"></img-format> 3 <img-format :src="value.src" :w="250" :h="250"></img-format>
4 </resource> 4 </resource>
5 </template> 5 </template>
@@ -17,7 +17,7 @@ export default { @@ -17,7 +17,7 @@ export default {
17 </script> 17 </script>
18 18
19 <style lang="scss"> 19 <style lang="scss">
20 -.single-image { 20 +.resource-single-image {
21 img { 21 img {
22 width: 100%; 22 width: 100%;
23 display: block; 23 display: block;
1 <template> 1 <template>
2 - <resource class="ti-image">  
3 - <div class="ti-image-item"> 2 + <resource class="resource-ti-image">
  3 + <div class="resource-ti-image-item">
4 <img-format :src="value[0].src" :w="250" :h="250"></img-format> 4 <img-format :src="value[0].src" :w="250" :h="250"></img-format>
5 </div> 5 </div>
6 <div class="split"></div> 6 <div class="split"></div>
7 - <div class="ti-image-item"> 7 + <div class="resource-ti-image-item">
8 <img-format :src="value[1].src" :w="250" :h="250"></img-format> 8 <img-format :src="value[1].src" :w="250" :h="250"></img-format>
9 </div> 9 </div>
10 </resource> 10 </resource>
@@ -23,12 +23,12 @@ export default { @@ -23,12 +23,12 @@ export default {
23 </script> 23 </script>
24 24
25 <style lang="scss"> 25 <style lang="scss">
26 -.ti-image { 26 +.resource-ti-image {
27 display: flex; 27 display: flex;
28 .split { 28 .split {
29 width: 20px; 29 width: 20px;
30 } 30 }
31 - .ti-image-item { 31 + .resource-ti-image-item {
32 width: 50%; 32 width: 50%;
33 33
34 img { 34 img {
@@ -14,18 +14,16 @@ @@ -14,18 +14,16 @@
14 <div class="resources"> 14 <div class="resources">
15 <resource-two-image v-if="twoImages" :value="twoImages"></resource-two-image> 15 <resource-two-image v-if="twoImages" :value="twoImages"></resource-two-image>
16 <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image> 16 <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
17 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>  
18 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>  
19 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>  
20 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>  
21 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>  
22 - <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image> 17 + <resource-product-list v-if="products" :value="products"></resource-product-list>
23 <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image> 18 <resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
24 </div> 19 </div>
25 </layout-body> 20 </layout-body>
26 </template> 21 </template>
27 22
28 <script> 23 <script>
  24 +import {
  25 + FETCH_HOME_REQUEST
  26 +} from 'store/channel/types';
29 import components from 'components/resources'; 27 import components from 'components/resources';
30 28
31 export default { 29 export default {
@@ -39,13 +37,59 @@ export default { @@ -39,13 +37,59 @@ export default {
39 }], 37 }],
40 singleImages: { 38 singleImages: {
41 src: '//img11.static.yhbimg.com/yhb-img01/2017/07/26/09/01496efd7e853c2aaa1e38035d788eaa8e.jpg?imageView2/2/w/750/h/364/interlace/1' 39 src: '//img11.static.yhbimg.com/yhb-img01/2017/07/26/09/01496efd7e853c2aaa1e38035d788eaa8e.jpg?imageView2/2/w/750/h/364/interlace/1'
42 - }  
43 - } 40 + },
  41 + products: [{
  42 + src: '//img11.static.yhbimg.com/goodsimg/2017/05/04/12/019698fcd41f21403a12e603ae64dc23f0.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  43 + title: 'HBA',
  44 + price: '¥1399'
  45 + }, {
  46 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  47 + title: 'HBA',
  48 + price: '¥1399'
  49 + }, {
  50 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  51 + title: 'HBA',
  52 + price: '¥1399'
  53 + }, {
  54 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  55 + title: 'HBA',
  56 + price: '¥1399'
  57 + }, {
  58 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  59 + title: 'HBA',
  60 + price: '¥1399'
  61 + }, {
  62 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  63 + title: 'HBA',
  64 + price: '¥1399'
  65 + }, {
  66 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  67 + title: 'HBA',
  68 + price: '¥1399'
  69 + }, {
  70 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  71 + title: 'HBA',
  72 + price: '¥1399'
  73 + }, {
  74 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  75 + title: 'HBA',
  76 + price: '¥1399'
  77 + }, {
  78 + src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
  79 + title: 'HBA',
  80 + price: '¥1399'
  81 + }]
  82 + };
  83 + },
  84 + asyncData({store}) {
  85 + return store.dispatch(FETCH_HOME_REQUEST);
44 }, 86 },
45 components: {...components} 87 components: {...components}
46 }; 88 };
47 </script> 89 </script>
48 90
49 -<style>  
50 - 91 +<style lang="scss">
  92 +.resources {
  93 + padding-bottom: 20px;
  94 +}
51 </style> 95 </style>
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <client> 25 <client>
26 import Vue from 'vue'; 26 import Vue from 'vue';
27 import('swiper/dist/css/swiper.css'); 27 import('swiper/dist/css/swiper.css');
28 -const VueAwesomeSwiper = require('vue-awesome-swiper/ssr'); 28 +const VueAwesomeSwiper = require('vue-awesome-swiper/dist/ssr');
29 29
30 Vue.use(VueAwesomeSwiper); 30 Vue.use(VueAwesomeSwiper);
31 </client> 31 </client>
1 -@font-face {  
2 - font-family: "iconfont";  
3 - src: url("../font/iconfont.eot?vqs6e2");  
4 - src: url("../font/iconfont.eot?vqs6e2#iefix") format("embedded-opentype"), url("../font/iconfont.ttf?vqs6e2") format("truetype"), url("../font/iconfont.woff?vqs6e2") format("woff"), url("../font/iconfont.svg?vqs6e2#iconfont") format("svg");  
5 - font-weight: normal;  
6 - font-style: normal;  
7 -}  
8 -  
9 -.icon {  
10 - /* use !important to prevent issues with browser extensions that change fonts */  
11 - font-family: "iconfont" !important;  
12 - speak: none;  
13 - font-style: normal;  
14 - font-weight: normal;  
15 - font-variant: normal;  
16 - text-transform: none;  
17 - line-height: 1;  
18 - background: url("../font/iconfont.svg");  
19 -  
20 - /* Better Font Rendering =========== */  
21 - -webkit-font-smoothing: antialiased;  
22 - -moz-osx-font-smoothing: grayscale;  
23 -}  
24 -  
25 -.icon-down:before {  
26 - content: "\e602";  
27 -}  
28 -.icon-check:before {  
29 - content: "\e603";  
30 -}  
31 -.icon-love:before {  
32 - content: "\e604";  
33 -}  
34 -.icon-close:before {  
35 - content: "\e605";  
36 -}  
37 -.icon-left:before {  
38 - content: "\e606";  
39 -}  
40 -.icon-right:before {  
41 - content: "\e607";  
42 -}  
43 -.icon-search:before {  
44 - content: "\e608";  
45 -}  
46 -.icon-love-solid:before {  
47 - content: "\e609";  
48 -}  
49 -.icon-focus:before {  
50 - content: "\e60c";  
51 -}  
52 -.icon-focused:before {  
53 - content: "\e60d";  
54 -}  
55 -.icon-share:before {  
56 - content: "\e60e";  
57 -}  
58 -.icon-blk:before {  
59 - content: "\e60f";  
60 -}  
61 -.icon-importedlayers:before {  
62 - content: "\e610";  
63 -}  
64 -.icon-up:before {  
65 - content: "\e617";  
66 -}  
67 -.icon-plus:before {  
68 - content: "\e900";  
69 -}  
70 -.icon-back:before {  
71 - content: "\e901";  
72 -}  
73 -.icon-choose:before {  
74 - content: "\e902";  
75 -}  
76 -.icon-minus:before {  
77 - content: "\e903";  
78 -}  
79 -.icon-brand:before {  
80 - content: "\e904";  
81 -}  
82 -.icon-shopping-bag:before {  
83 - content: "\e905";  
84 -}  
85 -.icon-time-o:before {  
86 - content: "\e906";  
87 -}  
88 -.icon-see2:before {  
89 - content: "\e907";  
90 -}  
91 -.icon-8:before {  
92 - content: "\e908";  
93 -}  
94 -.icon-filter:before {  
95 - content: "\e909";  
96 -}  
97 -.icon-share2:before {  
98 - content: "\e90a";  
99 -}  
100 -.icon-liked:before {  
101 - content: "\e90b";  
102 -}  
103 -.icon-like:before {  
104 - content: "\e90c";  
105 -}  
106 -.icon-82:before {  
107 - content: "\e90d";  
108 -}  
109 -.icon-0:before {  
110 - content: "\e90e";  
111 -}  
112 -.icon-5:before {  
113 - content: "\e90f";  
114 -}  
115 -.icon-kuaisu:before {  
116 - content: "\e910";  
117 -}  
118 -.icon-niandu:before {  
119 - content: "\e911";  
120 -}  
121 -.icon-vip:before {  
122 - content: "\e912";  
123 -}  
124 -.icon-youhui:before {  
125 - content: "\e913";  
126 -}  
127 -.icon-zazhi:before {  
128 - content: "\e914";  
129 -}  
130 -.icon-refund-exchange:before {  
131 - content: "\e915";  
132 -}  
133 -.icon-wait-cargo:before {  
134 - content: "\e916";  
135 -}  
136 -.icon-wait-pay:before {  
137 - content: "\e917";  
138 -}  
139 -.icon-send-cargo:before {  
140 - content: "\e918";  
141 -}  
142 -.icon-msg:before {  
143 - content: "\e919";  
144 -}  
145 -.icon-bold-shopbag:before {  
146 - content: "\e91a";  
147 -}  
148 -.icon-notdef:before {  
149 - content: "\e91b";  
150 -}  
151 -.icon-sort-asc:before {  
152 - content: "\e91c";  
153 -}  
154 -.icon-sort-desc:before {  
155 - content: "\e91d";  
156 -}  
157 -.icon-x:before {  
158 - content: "\e91e";  
159 -}  
160 -.icon-edit-del:before {  
161 - content: "\e91f";  
162 -}  
163 -.icon-close-round:before {  
164 - content: "\e920";  
165 -}  
166 -.icon-help:before {  
167 - content: "\e921";  
168 -}  
169 -.icon-read:before {  
170 - content: "\e922";  
171 -}  
172 -.icon-back2:before {  
173 - content: "\e923";  
174 -}  
175 -.icon-sort-up:before {  
176 - content: "\e924";  
177 -}  
178 -.icon-sort-down:before {  
179 - content: "\e925";  
180 -}  
181 -.icon-timeshare:before {  
182 - content: "\e926";  
183 -}  
184 -.icon-more:before {  
185 - content: "\e927";  
186 -}  
187 -.icon-noselect:before {  
188 - content: "\e928";  
189 -}  
190 -.icon-del:before {  
191 - content: "\e929";  
192 -}  
193 -.icon-message:before {  
194 - content: "\e92a";  
195 -}  
196 -.icon-delete:before {  
197 - content: "\e92b";  
198 -}  
199 -.icon-nav:before {  
200 - content: "\e92c";  
201 -}  
202 -.icon-setting:before {  
203 - content: "\e92d";  
204 -}  
205 -.icon-search2:before {  
206 - content: "\e92e";  
207 -}  
208 -.icon-email:before {  
209 - content: "\e92f";  
210 -}  
211 -.icon-battery:before {  
212 - content: "\e930";  
213 -}  
214 -.icon-key:before {  
215 - content: "\e931";  
216 -}  
217 -.icon-note:before {  
218 - content: "\e932";  
219 -}  
220 -.icon-question:before {  
221 - content: "\e933";  
222 -}  
223 -.icon-time2:before {  
224 - content: "\e934";  
225 -}  
226 -.icon-card:before {  
227 - content: "\e935";  
228 -}  
229 -.icon-bag2:before {  
230 - content: "\e936";  
231 -}  
232 -.icon-logistics:before {  
233 - content: "\e937";  
234 -}  
235 -.icon-money:before {  
236 - content: "\e938";  
237 -}  
238 -.icon-document:before {  
239 - content: "\e939";  
240 -}  
241 -.icon-wifi:before {  
242 - content: "\e93a";  
243 -}  
244 -.icon-email2:before {  
245 - content: "\e93b";  
246 -}  
247 -.icon-focus2:before {  
248 - content: "\e93c";  
249 -}  
250 -.icon-shopbag:before {  
251 - content: "\e93d";  
252 -}  
253 -.icon-search3:before {  
254 - content: "\e93e";  
255 -}  
256 -.icon-position:before {  
257 - content: "\e93f";  
258 -}  
259 -.icon-onlineservice:before {  
260 - content: "\e940";  
261 -}  
262 -.icon-seven:before {  
263 - content: "\e941";  
264 -}  
265 -.icon-real:before {  
266 - content: "\e942";  
267 -}  
268 -.icon-unsupport-seven:before {  
269 - content: "\e943";  
270 -}  
271 -.icon-back-top1:before {  
272 - content: "\e944";  
273 -}  
274 -.icon-see:before {  
275 - content: "\e945";  
276 -}  
277 -.icon-reduce:before {  
278 - content: "\e946";  
279 -}  
280 -.icon-add:before {  
281 - content: "\e947";  
282 -}  
283 -.icon-order:before {  
284 - content: "\e948";  
285 -}  
286 -.icon-store:before {  
287 - content: "\e949";  
288 -}  
289 -.icon-default-tip:before {  
290 - content: "\f35b";  
291 -}  
292 -.icon-error-tip:before {  
293 - content: "\f36e";  
294 -}  
295 -.icon-success-tip:before {  
296 - content: "\f3ff";  
297 -}  
298 -.icon-close-tip:before {  
299 - content: "\f404";  
300 -}  
  1 +import {
  2 + FETCH_HOME_REQUEST,
  3 + FETCH_HOME_FAILURE,
  4 + FETCH_HOME_SUCCESS
  5 +} from './types';
  6 +import {
  7 + HOME_CONTENT_CODE
  8 +} from '../content-code';
  9 +import _ from 'lodash';
  10 +
  11 +export default {
  12 + state: {
  13 + home: {},
  14 + fethingHome: false
  15 + },
  16 + mutations: {
  17 + [FETCH_HOME_REQUEST](state) {
  18 + state.fethingHome = true;
  19 + },
  20 + [FETCH_HOME_FAILURE](state) {
  21 + state.fethingHome = false;
  22 + },
  23 + [FETCH_HOME_SUCCESS](state, {data}) {
  24 + state.fethingHome = false;
  25 + state.home = data;
  26 + },
  27 + },
  28 + actions: {
  29 + async [FETCH_HOME_REQUEST]({commit, state}) {
  30 + // if (!_.isEmpty(state.home)) {
  31 + // return Promise.resolve(state.home);
  32 + // }
  33 + commit(FETCH_HOME_REQUEST);
  34 + try {
  35 + const result = await this.$api.get('/resource/get', {content_code: HOME_CONTENT_CODE});
  36 +
  37 + commit(FETCH_HOME_SUCCESS, result);
  38 + return result;
  39 + } catch (e) {
  40 + console.error(e);
  41 + commit(FETCH_HOME_FAILURE);
  42 + }
  43 + }
  44 + }
  45 +};
  1 +export const FETCH_HOME_REQUEST = 'FETCH_HOME_REQUEST';
  2 +export const FETCH_HOME_SUCCESS = 'FETCH_HOME_SUCCESS';
  3 +export const FETCH_HOME_FAILURE = 'FETCH_HOME_FAILURE';
  1 +export const HOME_CONTENT_CODE = 'd1d01d9f56067651cacf2d938a526747';
  2 +export const CHANNEL_MAN_CONTENT_CODE = '08b0662963ea75bf821bcf6b828f7c78';
  3 +export const CHANNEL_WOMEN_CONTENT_CODE = '085b349c0336373d7ea408960347e450';
  4 +export const ABOUT_CONTENT_CODE = 'f4a568a4ba170136c39122626bd6201c';
  5 +export const SLIDER_CONTENT_CODE = 'b433d62c8e0e2d9d903bcc4755ac88f7';
  6 +
  7 +
  8 +
@@ -3,6 +3,8 @@ import Vuex from 'vuex'; @@ -3,6 +3,8 @@ import Vuex from 'vuex';
3 3
4 import yoho from './yoho'; 4 import yoho from './yoho';
5 import product from './product'; 5 import product from './product';
  6 +import channel from './channel';
  7 +
6 import {createApi} from 'create-api'; 8 import {createApi} from 'create-api';
7 9
8 Vue.use(Vuex); 10 Vue.use(Vuex);
@@ -11,7 +13,8 @@ export function createStore(context) { @@ -11,7 +13,8 @@ export function createStore(context) {
11 const store = new Vuex.Store({ 13 const store = new Vuex.Store({
12 modules: { 14 modules: {
13 product, 15 product,
14 - yoho 16 + yoho,
  17 + channel
15 }, 18 },
16 strict: process.env.NODE_ENV !== 'production' 19 strict: process.env.NODE_ENV !== 'production'
17 }); 20 });
@@ -2457,6 +2457,10 @@ dom-walk@^0.1.0: @@ -2457,6 +2457,10 @@ dom-walk@^0.1.0:
2457 version "0.1.1" 2457 version "0.1.1"
2458 resolved "http://npm.yoho.cn/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018" 2458 resolved "http://npm.yoho.cn/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
2459 2459
  2460 +dom7@^2.0.1:
  2461 + version "2.0.1"
  2462 + resolved "http://npm.yoho.cn/dom7/-/dom7-2.0.1.tgz#a8a2c802cf17c20b051d9414143061472201a233"
  2463 +
2460 domain-browser@^1.1.1: 2464 domain-browser@^1.1.1:
2461 version "1.1.7" 2465 version "1.1.7"
2462 resolved "http://npm.yoho.cn/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc" 2466 resolved "http://npm.yoho.cn/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc"
@@ -5665,7 +5669,7 @@ object-assign@^3.0.0: @@ -5665,7 +5669,7 @@ object-assign@^3.0.0:
5665 version "3.0.0" 5669 version "3.0.0"
5666 resolved "http://npm.yoho.cn/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2" 5670 resolved "http://npm.yoho.cn/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"
5667 5671
5668 -object-assign@^4.0.1, object-assign@^4.1.0: 5672 +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
5669 version "4.1.1" 5673 version "4.1.1"
5670 resolved "http://npm.yoho.cn/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" 5674 resolved "http://npm.yoho.cn/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
5671 5675
@@ -8488,9 +8492,11 @@ swap-case@^1.1.0: @@ -8488,9 +8492,11 @@ swap-case@^1.1.0:
8488 lower-case "^1.1.1" 8492 lower-case "^1.1.1"
8489 upper-case "^1.1.1" 8493 upper-case "^1.1.1"
8490 8494
8491 -swiper@^3.4.2:  
8492 - version "3.4.2"  
8493 - resolved "http://npm.yoho.cn/swiper/-/swiper-3.4.2.tgz#39d6b410b1a39833e1f72d3b72999df5f5e38392" 8495 +swiper@^4.0.7:
  8496 + version "4.0.7"
  8497 + resolved "http://npm.yoho.cn/swiper/-/swiper-4.0.7.tgz#89175c2a23d86622eda8344740c24a3701a6b270"
  8498 + dependencies:
  8499 + dom7 "^2.0.1"
8494 8500
8495 synesthesia@^1.0.1: 8501 synesthesia@^1.0.1:
8496 version "1.0.1" 8502 version "1.0.1"
@@ -9040,11 +9046,12 @@ vm-browserify@0.0.4: @@ -9040,11 +9046,12 @@ vm-browserify@0.0.4:
9040 dependencies: 9046 dependencies:
9041 indexof "0.0.1" 9047 indexof "0.0.1"
9042 9048
9043 -vue-awesome-swiper@^2.6.2:  
9044 - version "2.6.7"  
9045 - resolved "http://npm.yoho.cn/vue-awesome-swiper/-/vue-awesome-swiper-2.6.7.tgz#23b12cf107503305c267df3c7c2903fb39896cd0" 9049 +vue-awesome-swiper@^3.0.6:
  9050 + version "3.0.6"
  9051 + resolved "http://npm.yoho.cn/vue-awesome-swiper/-/vue-awesome-swiper-3.0.6.tgz#546aa9a2775471e1dfa6ca9fd7e958aaa99ee1ea"
9046 dependencies: 9052 dependencies:
9047 - swiper "^3.4.2" 9053 + object-assign "^4.1.1"
  9054 + swiper "^4.0.7"
9048 9055
9049 vue-clickoutside@^0.2.0: 9056 vue-clickoutside@^0.2.0:
9050 version "0.2.0" 9057 version "0.2.0"