|
|
<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();
|
|
|
});
|
|
|
}
|
|
|
};
|
...
|
...
|
|