Authored by 郭成尧

Merge remote-tracking branch 'remotes/origin/develop' into feature/brand

<div id="app">
<tab></tab>
<resources v-bind:channel="'{{channel}}'" v-ref:resources></resources>
<resources v-bind:channel="'{{channel}}' || 'men'"></resources>
</div>
... ...
... ... @@ -16,7 +16,7 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
domains: {
api: 'http://devapi.yoho.cn:58078/',
service: 'http://123.206.1.104:28077/'
service: 'http://172.16.6.247:8085/gateway/'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -7,9 +7,9 @@
'use strict';
const channel = {
men: '9ee58aadd9559d07207fe4a98843eaac', // 男 9ee58aadd9559d07207fe4a98843eaac
women: '9ee58aadd9559d07207fe4a98843eaac',
lifestyle: '9ee58aadd9559d07207fe4a98843eaac'
men: '9ee58aadd9559d07207fe4a98843eaac',
women: 'aa8d34c85934c2ccc16e2babd3eb5e47',
lifestyle: '3ad8826fc89fb0d023a4cd06a6991219'
};
module.exports = {
... ...
... ... @@ -7,6 +7,7 @@
'use strict';
const $ = require('yoho-jquery');
const Overlay = require('./overlay');
const template = require('components/loading.hbs');
... ... @@ -28,7 +29,7 @@ class Loading {
* 显示
*/
show() {
this.overlay = $.overlay({
this.overlay = new Overlay({
animation: 'fade',
clickToClose: false
});
... ... @@ -44,10 +45,4 @@ class Loading {
}
}
((function($) {
$.loading = opts => {
return new Loading(opts);
};
})(jQuery));
module.exports = Loading;
module.exports = new Loading();
... ...
<template>
<div class="resources">
<template v-for="floor in resources">
<focus v-if="floor.focus" v-bind:floor="floor.data" v-bind:style="{height: '182px'}"></focus>
<title-image v-if="floor.titleImage" v-bind:floor="floor.data"></title-image>
<goods v-if="floor.goods" v-bind:floor="floor.data"></goods>
<focus v-if="floor.focus && floor.focusType === '1'" v-bind:floor="floor.data" v-bind:style="{height: '182px'}">
<!-- 轮播图,通栏 -->
</focus>
<focus-left-right v-if="floor.focus && floor.focusType === '2'" v-bind:floor="floor.data">
<!-- 轮播图,左右滑动 -->
</focus-left-right>
<title-image v-if="floor.titleImage" v-bind:floor="floor.data">
<!-- 标题图片 -->
</title-image>
<title-floor v-if="floor.titleFloor" v-bind:title="floor.data.title">
<!-- 楼层标题 -->
</title-floor>
<recommend-content-five v-if="floor.recommendContentFive" v-bind:floor="floor.data.list">
<!-- 带标题的12个小图推荐 -->
</recommend-content-five>
<goods v-if="floor.goods" v-bind:floor="floor.data">
<!-- 商品 -->
</goods>
</template>
</div>
</template>
... ... @@ -12,10 +27,16 @@
const $ = require('yoho-jquery');
const tip = require('common/tip');
const bus = require('common/vue-bus');
const focus = require('component/resources/focus.vue');
const focusLeftRight = require('component/resources/focus-left-right.vue');
const titleImage = require('component/resources/title-image.vue');
const titleFloor = require('component/resources/title-floor.vue');
const recommendContentFive = require('component/resources/recommend-content-five.vue');
const goods = require('component/resources/goods.vue');
const dataCache = {};
module.exports = {
props: ['channel', 'contentCode'],
data() {
... ... @@ -24,9 +45,12 @@
};
},
components: {
focus: focus,
titleImage: titleImage,
goods: goods
focus,
focusLeftRight,
titleImage,
titleFloor,
recommendContentFive,
goods
},
watch: {
channel() {
... ... @@ -46,11 +70,22 @@
data.channel = this.channel;
}
let param = $.param(data);
if (dataCache[param]) {
this.resources = dataCache[param];
return;
}
$.ajax({
url: '/resources',
data: data
}).then(result => {
this.resources = result;
if (result.length) {
dataCache[param] = result;
}
}).fail(() => {
tip('网络错误');
});
... ... @@ -60,7 +95,6 @@
this.getResourcesData();
bus.$on('changeChannel', channel => {
this.channel = channel;
this.getResourcesData();
});
}
};
... ...
<template>
<div class="focus-left-right">
<a v-for="item in floor" href="{{item.url}}" title="{{item.title}}">
<img v-bind:src="item.src | resize 250 250">
</a>
</div>
</template>
<script>
module.exports = {
props: ['floor']
};
</script>
<style>
.focus-left-right {
padding: 30px 15px;
width: 100%;
overflow-x: auto;
white-space: nowrap;
font-size: 0;
background: #fff;
border-bottom: 1px solid #eee;
-webkit-overflow-scrolling: touch;
/* stylelint-disable */
&::-webkit-scrollbar {
display:none;
}
/* stylelint-enable */
a {
display: inline-block;
padding: 0 15px;
width: 250px;
height: 250px;
}
img {
width: 100%;
height: 100%;
}
}
</style>
... ...
... ... @@ -5,12 +5,15 @@
</template>
<script>
const floorHeader = require('component/resources/floor-header.vue');
const titleFloor = require('component/resources/title-floor.vue');
module.exports = {
props: ['floor'],
components: {
floorHeader: floorHeader
titleFloor: titleFloor
},
created() {
// console.log(this.floor)
}
};
</script>
... ...
<template>
<div class="recommend-content-five">
<a v-for="item in floor" href="{{item.url}}" title="{{item.title}}">
<img v-bind:src="item.src | resize 375 375">
</a>
</div>
</template>
<script>
module.exports = {
props: ['floor']
};
</script>
<style>
.recommend-content-five {
width: 100%;
font-size: 0;
a {
display: inline-block;
width: 50%;
height: 375px;
}
img {
width: 100%;
height: 100%;
}
}
</style>
... ...
<template>
<div class="floor-header">
{{title.title}}
{{title.name}}
<a class="more" href="{{title.moreUrl}}">
{{title.moreName}}
... ...
<template>
<div class="title-image">
<floor-header v-bind:title="floor.title"></floor-header>
<title-floor v-bind:title="{name: floor.title, moreName: floor.moreName, moreUrl: floor.moreUrl}"></title-floor>
<a class="image" v-bind:href="floor.image.url">
<img v-bind:src="floor.image.src | resize 750 364">
</a>
... ... @@ -8,12 +8,12 @@
</template>
<script>
const floorHeader = require('component/resources/floor-header.vue');
const titleFloor = require('component/resources/title-floor.vue');
module.exports = {
props: ['floor'],
components: {
floorHeader: floorHeader
titleFloor: titleFloor
}
};
</script>
... ...
const _ = require('lodash');
const processTime = require('./time-process');
const camelCase = global.yoho.camelCase;
/**
... ... @@ -17,58 +16,6 @@ module.exports = (list) => {
floor[_.camelCase(floor.templateName)] = true;
// 特殊资源位处理
// PLUS
if (floor.singleNameImage && floor.data) {
floor.data.title = {
title: floor.data.title
};
}
// 潮流时装/经典裤裙/时尚靴履/潮人配饰/潮流上装
if (floor.recommendContentOne && floor.data) {
if (floor.data.bigImage && floor.data.bigImage.length > 1) {
floor.data.bigImage = {
bigList: floor.data.bigImage
};
}
}
// OUTLETS
if (floor.titleImage && floor.data) {
if (floor.data.image) {
floor.data.bigImage = {
bigList: [floor.data.image]
};
}
floor.data.title = {
moreName: floor.data.moreName,
moreUrl: floor.data.moreUrl,
title: floor.data.title
};
}
// 折扣专场
if (floor.discountActivity && floor.data && floor.data.list.length) {
_.map(floor.data.list, (item) => {
Object.assign(item, processTime(item.leftTime));
});
}
// 断码区 , 此资源位数据结构比较坑
if (floor.offCodeArea && floor.data && floor.data.list.length) {
floor.data = {
title: floor.data.title,
data: [floor.data.list[0]],
left: [floor.data.list[1]],
right: floor.data.list.slice(2)
};
}
// 会员专享
if (floor.vipFloor && floor.data) {
floor.data.data = floor.data.image;
}
formatData.push(floor);
});
... ...