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 = {
id: {type: Number},
uid: {type: Number}
}
},
'/resource/get': {
api: 'operations/api/v5/resource/get',
cache: true,
service: true,
params: {
content_code: {type: String},
}
}
};
... ...
const api = global.yoho.API;
const service = global.yoho.ServiceAPI;
const checkParams = require('../../utils/check-params');
const apiMaps = require('../../config/api-map');
... ... @@ -9,22 +10,31 @@ module.exports = () => {
if (!apiInfo) {
return next();
}
const baseParams = {
uid: req.yoho.uid || void 0,
method: apiInfo.api
};
let baseParams;
if (!apiInfo.service) {
baseParams = {
uid: req.yoho.uid || void 0,
method: apiInfo.api
};
}
try {
const reqParams = Object.assign({}, req.query, req.body, baseParams);
const params = checkParams.getParams(reqParams, apiInfo);
const cache = req.method.toLowerCase() !== 'get' ? false : apiInfo.cache;
return api[req.method]('', params, {
code: 200,
cache: cache
}).then(result => {
return result;
});
if (apiInfo.service) {
return service.get(apiInfo.api, params, {
cache: cache,
code: 200
});
} else {
return api[req.method]('', params, {
code: 200,
cache: cache
});
}
} catch (e) {
return res.json({
code: 400,
... ...
... ... @@ -113,7 +113,7 @@
"uglifyjs-webpack-plugin": "^0.4.6",
"url-loader": "^0.5.9",
"vue": "^2.5.13",
"vue-awesome-swiper": "^2.6.2",
"vue-awesome-swiper": "^3.0.6",
"vue-hot-reload-api": "^1.2.0",
"vue-html-loader": "^1.2.4",
"vue-infinite-scroll": "^2.0.1",
... ...
const api = global.yoho.API;
const service = global.yoho.ServiceAPI;
const checkParams = require('../../utils/check-params');
const apiMaps = require('../../config/api-map');
const _ = require('lodash');
... ... @@ -17,10 +18,12 @@ const request = ({url, method, reqParams, context}) => {
return Promise.reject(NOT_FOUND_API_MAP);
}
try {
Object.assign(reqParams, {
uid: context.user.uid || 0,
method: apiInfo.api
});
if (!apiInfo.service) {
Object.assign(reqParams, {
uid: context.user.uid || 0,
method: apiInfo.api
});
}
if (_.has(apiInfo, 'params.uid') &&
apiInfo.params.uid.require !== false &&
reqParams.uid === 0) { // 如果接口uid是必须的但是有没有传入uid则直接返回空对象
... ... @@ -29,10 +32,17 @@ const request = ({url, method, reqParams, context}) => {
const params = checkParams.getParams(reqParams, apiInfo);
const cache = method.toLowerCase() !== 'get' ? false : apiInfo.cache;
return api[method]('', params, {
code: 200,
cache: cache
});
if (apiInfo.service) {
return service.get(apiInfo.api, params, {
cache: cache,
code: 200
});
} else {
return api[method]('', params, {
code: 200,
cache: cache
});
}
} catch (e) {
return Promise.reject({
code: 400,
... ...
import ResourceTwoImage from './resource-two-image';
import ResourceFocusImage from './resource-focus-image';
import ResourceSingleImage from './resource-single-image';
import ResourceProductList from './resource-product-list';
export default {
ResourceTwoImage,
ResourceFocusImage,
ResourceSingleImage
ResourceSingleImage,
ResourceProductList,
ResourceFocusImage
};
... ...
<template>
<resource>
<ul class="resource-products">
<li class="product-item" v-for="(item, index) in value" :key="index">
<img-format :src="item.src" :w="94" :h="125"></img-format>
<p class="title">{{item.title}}</p>
<p class="price">{{item.price}}</p>
</li>
</ul>
</resource>
</template>
<script>
import Resource from './resource';
export default {
name: 'ResourceSingleImage',
props: {
value: Array
},
computed: {
},
components: {Resource}
};
</script>
<style lang="scss">
.resource-products {
width: 100%;
overflow-x: scroll;
-webkit-overflow-scrolling: touch;
white-space: nowrap;
li.product-item {
display: inline-block;
padding-right: 20px;
text-align: center;
line-height: 40px;
img {
width: 188px;
height: 250px;
}
}
}
</style>
... ...
<template>
<resource class="single-image">
<resource class="resource-single-image">
<img-format :src="value.src" :w="250" :h="250"></img-format>
</resource>
</template>
... ... @@ -17,7 +17,7 @@ export default {
</script>
<style lang="scss">
.single-image {
.resource-single-image {
img {
width: 100%;
display: block;
... ...
<template>
<resource class="ti-image">
<div class="ti-image-item">
<resource class="resource-ti-image">
<div class="resource-ti-image-item">
<img-format :src="value[0].src" :w="250" :h="250"></img-format>
</div>
<div class="split"></div>
<div class="ti-image-item">
<div class="resource-ti-image-item">
<img-format :src="value[1].src" :w="250" :h="250"></img-format>
</div>
</resource>
... ... @@ -23,12 +23,12 @@ export default {
</script>
<style lang="scss">
.ti-image {
.resource-ti-image {
display: flex;
.split {
width: 20px;
}
.ti-image-item {
.resource-ti-image-item {
width: 50%;
img {
... ...
... ... @@ -14,18 +14,16 @@
<div class="resources">
<resource-two-image v-if="twoImages" :value="twoImages"></resource-two-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
<resource-product-list v-if="products" :value="products"></resource-product-list>
<resource-single-image v-if="singleImages" :value="singleImages"></resource-single-image>
</div>
</layout-body>
</template>
<script>
import {
FETCH_HOME_REQUEST
} from 'store/channel/types';
import components from 'components/resources';
export default {
... ... @@ -39,13 +37,59 @@ export default {
}],
singleImages: {
src: '//img11.static.yhbimg.com/yhb-img01/2017/07/26/09/01496efd7e853c2aaa1e38035d788eaa8e.jpg?imageView2/2/w/750/h/364/interlace/1'
}
}
},
products: [{
src: '//img11.static.yhbimg.com/goodsimg/2017/05/04/12/019698fcd41f21403a12e603ae64dc23f0.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}, {
src: '//img12.static.yhbimg.com/goodsimg/2017/05/21/13/0221fbe4559a7033058b84c898fa59d18a.jpg?imageMogr2/thumbnail/330x440/background/d2hpdGU=/position/center/quality/80/interlace/1',
title: 'HBA',
price: '¥1399'
}]
};
},
asyncData({store}) {
return store.dispatch(FETCH_HOME_REQUEST);
},
components: {...components}
};
</script>
<style>
<style lang="scss">
.resources {
padding-bottom: 20px;
}
</style>
... ...
... ... @@ -25,7 +25,7 @@
<client>
import Vue from 'vue';
import('swiper/dist/css/swiper.css');
const VueAwesomeSwiper = require('vue-awesome-swiper/ssr');
const VueAwesomeSwiper = require('vue-awesome-swiper/dist/ssr');
Vue.use(VueAwesomeSwiper);
</client>
... ...
@font-face {
font-family: "iconfont";
src: url("../font/iconfont.eot?vqs6e2");
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");
font-weight: normal;
font-style: normal;
}
.icon {
/* use !important to prevent issues with browser extensions that change fonts */
font-family: "iconfont" !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
background: url("../font/iconfont.svg");
/* Better Font Rendering =========== */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-down:before {
content: "\e602";
}
.icon-check:before {
content: "\e603";
}
.icon-love:before {
content: "\e604";
}
.icon-close:before {
content: "\e605";
}
.icon-left:before {
content: "\e606";
}
.icon-right:before {
content: "\e607";
}
.icon-search:before {
content: "\e608";
}
.icon-love-solid:before {
content: "\e609";
}
.icon-focus:before {
content: "\e60c";
}
.icon-focused:before {
content: "\e60d";
}
.icon-share:before {
content: "\e60e";
}
.icon-blk:before {
content: "\e60f";
}
.icon-importedlayers:before {
content: "\e610";
}
.icon-up:before {
content: "\e617";
}
.icon-plus:before {
content: "\e900";
}
.icon-back:before {
content: "\e901";
}
.icon-choose:before {
content: "\e902";
}
.icon-minus:before {
content: "\e903";
}
.icon-brand:before {
content: "\e904";
}
.icon-shopping-bag:before {
content: "\e905";
}
.icon-time-o:before {
content: "\e906";
}
.icon-see2:before {
content: "\e907";
}
.icon-8:before {
content: "\e908";
}
.icon-filter:before {
content: "\e909";
}
.icon-share2:before {
content: "\e90a";
}
.icon-liked:before {
content: "\e90b";
}
.icon-like:before {
content: "\e90c";
}
.icon-82:before {
content: "\e90d";
}
.icon-0:before {
content: "\e90e";
}
.icon-5:before {
content: "\e90f";
}
.icon-kuaisu:before {
content: "\e910";
}
.icon-niandu:before {
content: "\e911";
}
.icon-vip:before {
content: "\e912";
}
.icon-youhui:before {
content: "\e913";
}
.icon-zazhi:before {
content: "\e914";
}
.icon-refund-exchange:before {
content: "\e915";
}
.icon-wait-cargo:before {
content: "\e916";
}
.icon-wait-pay:before {
content: "\e917";
}
.icon-send-cargo:before {
content: "\e918";
}
.icon-msg:before {
content: "\e919";
}
.icon-bold-shopbag:before {
content: "\e91a";
}
.icon-notdef:before {
content: "\e91b";
}
.icon-sort-asc:before {
content: "\e91c";
}
.icon-sort-desc:before {
content: "\e91d";
}
.icon-x:before {
content: "\e91e";
}
.icon-edit-del:before {
content: "\e91f";
}
.icon-close-round:before {
content: "\e920";
}
.icon-help:before {
content: "\e921";
}
.icon-read:before {
content: "\e922";
}
.icon-back2:before {
content: "\e923";
}
.icon-sort-up:before {
content: "\e924";
}
.icon-sort-down:before {
content: "\e925";
}
.icon-timeshare:before {
content: "\e926";
}
.icon-more:before {
content: "\e927";
}
.icon-noselect:before {
content: "\e928";
}
.icon-del:before {
content: "\e929";
}
.icon-message:before {
content: "\e92a";
}
.icon-delete:before {
content: "\e92b";
}
.icon-nav:before {
content: "\e92c";
}
.icon-setting:before {
content: "\e92d";
}
.icon-search2:before {
content: "\e92e";
}
.icon-email:before {
content: "\e92f";
}
.icon-battery:before {
content: "\e930";
}
.icon-key:before {
content: "\e931";
}
.icon-note:before {
content: "\e932";
}
.icon-question:before {
content: "\e933";
}
.icon-time2:before {
content: "\e934";
}
.icon-card:before {
content: "\e935";
}
.icon-bag2:before {
content: "\e936";
}
.icon-logistics:before {
content: "\e937";
}
.icon-money:before {
content: "\e938";
}
.icon-document:before {
content: "\e939";
}
.icon-wifi:before {
content: "\e93a";
}
.icon-email2:before {
content: "\e93b";
}
.icon-focus2:before {
content: "\e93c";
}
.icon-shopbag:before {
content: "\e93d";
}
.icon-search3:before {
content: "\e93e";
}
.icon-position:before {
content: "\e93f";
}
.icon-onlineservice:before {
content: "\e940";
}
.icon-seven:before {
content: "\e941";
}
.icon-real:before {
content: "\e942";
}
.icon-unsupport-seven:before {
content: "\e943";
}
.icon-back-top1:before {
content: "\e944";
}
.icon-see:before {
content: "\e945";
}
.icon-reduce:before {
content: "\e946";
}
.icon-add:before {
content: "\e947";
}
.icon-order:before {
content: "\e948";
}
.icon-store:before {
content: "\e949";
}
.icon-default-tip:before {
content: "\f35b";
}
.icon-error-tip:before {
content: "\f36e";
}
.icon-success-tip:before {
content: "\f3ff";
}
.icon-close-tip:before {
content: "\f404";
}
import {
FETCH_HOME_REQUEST,
FETCH_HOME_FAILURE,
FETCH_HOME_SUCCESS
} from './types';
import {
HOME_CONTENT_CODE
} from '../content-code';
import _ from 'lodash';
export default {
state: {
home: {},
fethingHome: false
},
mutations: {
[FETCH_HOME_REQUEST](state) {
state.fethingHome = true;
},
[FETCH_HOME_FAILURE](state) {
state.fethingHome = false;
},
[FETCH_HOME_SUCCESS](state, {data}) {
state.fethingHome = false;
state.home = data;
},
},
actions: {
async [FETCH_HOME_REQUEST]({commit, state}) {
// if (!_.isEmpty(state.home)) {
// return Promise.resolve(state.home);
// }
commit(FETCH_HOME_REQUEST);
try {
const result = await this.$api.get('/resource/get', {content_code: HOME_CONTENT_CODE});
commit(FETCH_HOME_SUCCESS, result);
return result;
} catch (e) {
console.error(e);
commit(FETCH_HOME_FAILURE);
}
}
}
};
... ...
export const FETCH_HOME_REQUEST = 'FETCH_HOME_REQUEST';
export const FETCH_HOME_SUCCESS = 'FETCH_HOME_SUCCESS';
export const FETCH_HOME_FAILURE = 'FETCH_HOME_FAILURE';
\ No newline at end of file
... ...
export const HOME_CONTENT_CODE = 'd1d01d9f56067651cacf2d938a526747';
export const CHANNEL_MAN_CONTENT_CODE = '08b0662963ea75bf821bcf6b828f7c78';
export const CHANNEL_WOMEN_CONTENT_CODE = '085b349c0336373d7ea408960347e450';
export const ABOUT_CONTENT_CODE = 'f4a568a4ba170136c39122626bd6201c';
export const SLIDER_CONTENT_CODE = 'b433d62c8e0e2d9d903bcc4755ac88f7';
... ...
... ... @@ -3,6 +3,8 @@ import Vuex from 'vuex';
import yoho from './yoho';
import product from './product';
import channel from './channel';
import {createApi} from 'create-api';
Vue.use(Vuex);
... ... @@ -11,7 +13,8 @@ export function createStore(context) {
const store = new Vuex.Store({
modules: {
product,
yoho
yoho,
channel
},
strict: process.env.NODE_ENV !== 'production'
});
... ...
... ... @@ -2457,6 +2457,10 @@ dom-walk@^0.1.0:
version "0.1.1"
resolved "http://npm.yoho.cn/dom-walk/-/dom-walk-0.1.1.tgz#672226dc74c8f799ad35307df936aba11acd6018"
dom7@^2.0.1:
version "2.0.1"
resolved "http://npm.yoho.cn/dom7/-/dom7-2.0.1.tgz#a8a2c802cf17c20b051d9414143061472201a233"
domain-browser@^1.1.1:
version "1.1.7"
resolved "http://npm.yoho.cn/domain-browser/-/domain-browser-1.1.7.tgz#867aa4b093faa05f1de08c06f4d7b21fdf8698bc"
... ... @@ -5665,7 +5669,7 @@ object-assign@^3.0.0:
version "3.0.0"
resolved "http://npm.yoho.cn/object-assign/-/object-assign-3.0.0.tgz#9bedd5ca0897949bca47e7ff408062d549f587f2"
object-assign@^4.0.1, object-assign@^4.1.0:
object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1:
version "4.1.1"
resolved "http://npm.yoho.cn/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863"
... ... @@ -8488,9 +8492,11 @@ swap-case@^1.1.0:
lower-case "^1.1.1"
upper-case "^1.1.1"
swiper@^3.4.2:
version "3.4.2"
resolved "http://npm.yoho.cn/swiper/-/swiper-3.4.2.tgz#39d6b410b1a39833e1f72d3b72999df5f5e38392"
swiper@^4.0.7:
version "4.0.7"
resolved "http://npm.yoho.cn/swiper/-/swiper-4.0.7.tgz#89175c2a23d86622eda8344740c24a3701a6b270"
dependencies:
dom7 "^2.0.1"
synesthesia@^1.0.1:
version "1.0.1"
... ... @@ -9040,11 +9046,12 @@ vm-browserify@0.0.4:
dependencies:
indexof "0.0.1"
vue-awesome-swiper@^2.6.2:
version "2.6.7"
resolved "http://npm.yoho.cn/vue-awesome-swiper/-/vue-awesome-swiper-2.6.7.tgz#23b12cf107503305c267df3c7c2903fb39896cd0"
vue-awesome-swiper@^3.0.6:
version "3.0.6"
resolved "http://npm.yoho.cn/vue-awesome-swiper/-/vue-awesome-swiper-3.0.6.tgz#546aa9a2775471e1dfa6ca9fd7e958aaa99ee1ea"
dependencies:
swiper "^3.4.2"
object-assign "^4.1.1"
swiper "^4.0.7"
vue-clickoutside@^0.2.0:
version "0.2.0"
... ...