Authored by 王水玲

文本编辑模版

@@ -272,6 +272,7 @@ class featureModel extends global.yoho.BaseModel { @@ -272,6 +272,7 @@ class featureModel extends global.yoho.BaseModel {
272 sknsArr = [], 272 sknsArr = [],
273 likeArr = []; 273 likeArr = [];
274 let shopGroups = []; 274 let shopGroups = [];
  275 + let showTimes = [];
275 276
276 if (params.type === 'preview') { // 开发/预览模式 277 if (params.type === 'preview') { // 开发/预览模式
277 data = yield api.get('', { 278 data = yield api.get('', {
@@ -291,6 +292,32 @@ class featureModel extends global.yoho.BaseModel { @@ -291,6 +292,32 @@ class featureModel extends global.yoho.BaseModel {
291 } 292 }
292 data = data.data; 293 data = data.data;
293 294
  295 + if (data && data.atlBo) {
  296 + let curTime = Math.round(new Date() / 1000);
  297 +
  298 + data.atlBo.forEach(t => {
  299 + if (t.showTime < curTime) {
  300 + showTimes.push(t);
  301 + }
  302 + });
  303 +
  304 + showTimes = _.sortBy(showTimes, t => {
  305 + return -t.showTime;
  306 + });
  307 +
  308 + if (showTimes && showTimes[0] && showTimes[0].templateId !== data.templateId) {
  309 + let newData = yield api.get('', {
  310 + method: 'app.activity.queryOneTemplate',
  311 + activity_id: showTimes[0].activityId,
  312 + template_id: showTimes[0].templateId
  313 + });
  314 +
  315 + if (newData) {
  316 + data = newData.data;
  317 + }
  318 + }
  319 + }
  320 +
294 if (data && data.floors) { 321 if (data && data.floors) {
295 data.floors.forEach(f => { 322 data.floors.forEach(f => {
296 let componentArr = []; 323 let componentArr = [];
@@ -360,6 +387,19 @@ class featureModel extends global.yoho.BaseModel { @@ -360,6 +387,19 @@ class featureModel extends global.yoho.BaseModel {
360 } 387 }
361 } 388 }
362 389
  390 + if (componentType === 'textEdit') {
  391 + f.component[0].bold = _.get(f, 'component[0].bold') === '1' ? 'bold' : 'none';
  392 + f.component[0].contentSpace = _.get(f, 'component[0].contentSpace') ? `${_.get(f, 'component[0].contentSpace') / 20}rem` : ''; // eslint-disable-line
  393 + f.component[0].lineHeight = _.get(f, 'component[0].lineHeight') ? `${_.get(f, 'component[0].lineHeight') / 20}rem` : ''; // eslint-disable-line
  394 + f.component[0].fontSize = _.get(f, 'component[0].fontSize') ? `${_.get(f, 'component[0].fontSize') / 20}rem` : ''; // eslint-disable-line
  395 + f.component[0].contentEdit = _.get(f, 'component[0].contentEdit').split('\n');
  396 +
  397 + if (f.param.bgimg) {
  398 + f.param._bgimgFill = f.param.bgimg;
  399 + f.param.bgimg = '';
  400 + }
  401 + }
  402 +
363 let set = new Set(); 403 let set = new Set();
364 404
365 _.forEach(f.component, component => { 405 _.forEach(f.component, component => {
@@ -159,8 +159,16 @@ @@ -159,8 +159,16 @@
159 {{! 点赞楼层}} 159 {{! 点赞楼层}}
160 {{> feature/liked-activity}} 160 {{> feature/liked-activity}}
161 {{/isEqualOr}} 161 {{/isEqualOr}}
162 - {{! 秒杀}}  
163 - {{> feature/seckill}} 162 +
  163 + {{#isEqualOr type 'textEdit'}}
  164 + {{! 文本}}
  165 + {{> feature/text-edit}}
  166 + {{/isEqualOr}}
  167 +
  168 + {{#isEqualOr type 'SecKill'}}
  169 + {{! 秒杀}}
  170 + {{> feature/seckill}}
  171 + {{/isEqualOr}}
164 {{/component}} 172 {{/component}}
165 </div> 173 </div>
166 {{/isEqualOr}} 174 {{/isEqualOr}}
  1 +<div class="text-edit" style="
  2 + {{#if fontColor}}color:{{fontColor}};{{/if}}
  3 + {{#if lineHeight}}line-height:{{lineHeight}};{{/if}}
  4 + {{#if fontSize}}font-size:{{fontSize}};{{/if}}
  5 + font-weight:{{bold}};">
  6 + {{# contentEdit}}
  7 + <p style="{{#if ../contentSpace}}margin-bottom:{{../contentSpace}};{{/if}}">{{.}}</p>
  8 + {{/ contentEdit}}
  9 +</div>
@@ -55,5 +55,16 @@ @@ -55,5 +55,16 @@
55 .single-item3:nth-of-type(3n+1) { 55 .single-item3:nth-of-type(3n+1) {
56 margin-left: 20px; 56 margin-left: 20px;
57 } 57 }
  58 +
  59 + .text-edit {
  60 + word-break: break-all;
  61 + text-indent: 2em;
  62 + margin: 0 20px;
  63 + box-sizing: border-box;
  64 +
  65 + p:last-child {
  66 + margin-bottom: 0 !important;
  67 + }
  68 + }
58 } 69 }
59 /* stylelint-enable */ 70 /* stylelint-enable */