Authored by 李靖

资源位

'use strict';
const _ = require('lodash');
const utils = '../../../utils';
const resourcesProcess = require(`${utils}/resources-process`);
class CouponList extends global.yoho.BaseModel {
constructor(ctx) {
... ... @@ -58,12 +60,64 @@ class CouponList extends global.yoho.BaseModel {
});
}
// 资源位
getResTop() {
let options = {
url: '/operations/api/v5/resource/home',
data: {
content_code: '865184f7d758e34a1c9d48cae86d86ae',
},
api: global.yoho.ServiceAPI
};
return this.get(options).then(result => {
if (result && result.code === 200 && result.data && result.data.list) {
for (let item of result.data.list) {
item.template_name === 'single_image' &&
item.data.length === 1 &&
(item.singleOne = true);
}
return resourcesProcess(result.data.list);
} else {
return result;
}
});
}
// 资源位
getResBottom() {
let options = {
url: '/operations/api/v5/resource/home',
data: {
content_code: 'a08f03ca0aece80920221e4d8b1e0312',
},
api: global.yoho.ServiceAPI
};
return this.get(options).then(result => {
if (result && result.code === 200 && result.data && result.data.list) {
for (let item of result.data.list) {
item.template_name === 'single_image' &&
item.data.length === 1 &&
(item.singleOne = true);
}
return resourcesProcess(result.data.list);
} else {
return result;
}
});
}
index(params) {
return Promise.all([
this.getCoupons(params)
this.getCoupons(params),
this.getResTop(),
this.getResBottom()
]).then(result => {
let resu = {
shopCoupons: []
shopCoupons: [],
contentTop: {},
contentBottom: {}
};
if (_.get(result, '[0].data')) {
... ... @@ -78,6 +132,15 @@ class CouponList extends global.yoho.BaseModel {
resu.shopCoupons.push(build);
});
}
if (_.get(result, '[1]')) {
resu.contentTop.content = result[1];
}
if (_.get(result, '[2]')) {
resu.contentBottom.content = result[2];
}
return resu;
});
}
... ...
<div class="coupon-list-page mobile-wrap yoho-page">
<div class="big-pic"></div>
<div class="resource-content">
{{# contentTop}}
{{> content}}
{{/ contentTop}}
</div>
<p class="big-title">全场券</p>
<div class="list-2">
<div class="list-item"></div>
... ... @@ -31,7 +35,11 @@
{{/ coupons}}
</div>
{{/ shopCoupons}}
<a class="foot-pic" href="http://url.cn/5PDFXp7"></a>
<div class="resource-content">
{{# contentBottom}}
{{> content}}
{{/ contentBottom}}
</div>
<div class="dia-c dia-bg hide"></div>
<div class="dia-c dia hide"></div>
</div>
\ No newline at end of file
... ...
@import "channel/divide-image";
@import "channel/banner-center";
.coupon-list-page {
position: relative;
width: 750px;
overflow: hidden;
.foot-pic {
width: 750px;
height: 460px;
background-image: resolve("activity/coupon-list/yoho-footer.jpg");
background-size: 100% 100%;
background-repeat: no-repeat;
display: block;
}
.dia-bg {
width: 100%;
height: 100%;
... ... @@ -52,12 +46,6 @@
}
}
.big-pic {
width: 750px;
height: 363px;
background-color: #f00;
}
.big-title {
font-size: 46px;
color: #f00;
... ...