Authored by 王水玲

文本编辑模版

... ... @@ -272,6 +272,7 @@ class featureModel extends global.yoho.BaseModel {
sknsArr = [],
likeArr = [];
let shopGroups = [];
let showTimes = [];
if (params.type === 'preview') { // 开发/预览模式
data = yield api.get('', {
... ... @@ -291,6 +292,32 @@ class featureModel extends global.yoho.BaseModel {
}
data = data.data;
if (data && data.atlBo) {
let curTime = Math.round(new Date() / 1000);
data.atlBo.forEach(t => {
if (t.showTime < curTime) {
showTimes.push(t);
}
});
showTimes = _.sortBy(showTimes, t => {
return -t.showTime;
});
if (showTimes && showTimes[0] && showTimes[0].templateId !== data.templateId) {
let newData = yield api.get('', {
method: 'app.activity.queryOneTemplate',
activity_id: showTimes[0].activityId,
template_id: showTimes[0].templateId
});
if (newData) {
data = newData.data;
}
}
}
if (data && data.floors) {
data.floors.forEach(f => {
let componentArr = [];
... ... @@ -360,6 +387,19 @@ class featureModel extends global.yoho.BaseModel {
}
}
if (componentType === 'textEdit') {
f.component[0].bold = _.get(f, 'component[0].bold') === '1' ? 'bold' : 'none';
f.component[0].contentSpace = _.get(f, 'component[0].contentSpace') ? `${_.get(f, 'component[0].contentSpace') / 20}rem` : ''; // eslint-disable-line
f.component[0].lineHeight = _.get(f, 'component[0].lineHeight') ? `${_.get(f, 'component[0].lineHeight') / 20}rem` : ''; // eslint-disable-line
f.component[0].fontSize = _.get(f, 'component[0].fontSize') ? `${_.get(f, 'component[0].fontSize') / 20}rem` : ''; // eslint-disable-line
f.component[0].contentEdit = _.get(f, 'component[0].contentEdit').split('\n');
if (f.param.bgimg) {
f.param._bgimgFill = f.param.bgimg;
f.param.bgimg = '';
}
}
let set = new Set();
_.forEach(f.component, component => {
... ...
... ... @@ -159,8 +159,16 @@
{{! 点赞楼层}}
{{> feature/liked-activity}}
{{/isEqualOr}}
{{! 秒杀}}
{{> feature/seckill}}
{{#isEqualOr type 'textEdit'}}
{{! 文本}}
{{> feature/text-edit}}
{{/isEqualOr}}
{{#isEqualOr type 'SecKill'}}
{{! 秒杀}}
{{> feature/seckill}}
{{/isEqualOr}}
{{/component}}
</div>
{{/isEqualOr}}
... ...
<div class="text-edit" style="
{{#if fontColor}}color:{{fontColor}};{{/if}}
{{#if lineHeight}}line-height:{{lineHeight}};{{/if}}
{{#if fontSize}}font-size:{{fontSize}};{{/if}}
font-weight:{{bold}};">
{{# contentEdit}}
<p style="{{#if ../contentSpace}}margin-bottom:{{../contentSpace}};{{/if}}">{{.}}</p>
{{/ contentEdit}}
</div>
\ No newline at end of file
... ...
... ... @@ -55,5 +55,16 @@
.single-item3:nth-of-type(3n+1) {
margin-left: 20px;
}
.text-edit {
word-break: break-all;
text-indent: 2em;
margin: 0 20px;
box-sizing: border-box;
p:last-child {
margin-bottom: 0 !important;
}
}
}
/* stylelint-enable */
... ...