Authored by OF1706

helpAuto

/**
* Created by Gexuhui on 2017/0321.
*/
'use strict';
exports.if_cond = function(left, operator, right, options) {
switch (operator) {
case '==':
return (left == right) ? options.fn(this) : options.inverse(this); // eslint-disable-line
case '!=':
return (left != right) ? options.fn(this) : options.inverse(this); // eslint-disable-line
case '===':
return (left === right) ? options.fn(this) : options.inverse(this);
case '<':
return (left < right) ? options.fn(this) : options.inverse(this);
case '<=':
return (left <= right) ? options.fn(this) : options.inverse(this);
case '>':
return (left > right) ? options.fn(this) : options.inverse(this);
case '>=':
return (left >= right) ? options.fn(this) : options.inverse(this);
case '&&':
return (left && right) ? options.fn(this) : options.inverse(this);
case '||':
return (left || right) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
};
... ...
... ... @@ -24,7 +24,7 @@
layoutsDir: doraemon,
partialsDir: [path.join(__dirname, 'views/partial')],
views: path.join(__dirname, 'views/action'),
helpers: global.yoho.helpers
helpers: Object.assign(require('./helper'), global.yoho.helpers)
}));
// router
... ...
... ... @@ -124,12 +124,15 @@ const _processHomeCategoryFaq = (list) => {
switch (item.categoryName) {
case '新手指南':
_.forEach(item.categoryItems, (ng, k) => {
ng.index = k + 1;
});
item.categoryItems = _.chunk(item.categoryItems, 6);
item.num = _.flattenDeep(item.categoryItems).length;
result.newGuide = item;
break;
case '公告':
_.forEach(item.contentItems, (c, k) => {
... ...
... ... @@ -32,7 +32,9 @@
{{#each categoryItems}}
<li>
{{#each .}}
<a href="{{jumpLink}}" target="_blank" {{#if @first}}style="margin-left: 0;"{{/if}} data-index={{index}}>
<a href="{{jumpLink}}" target="_blank" {{#if @first}}style="margin-left: 0;"{{/if}}
{{#if_cond ../../num '==' 4}}style="margin-left: 158px;"{{/if_cond}}
{{#if_cond ../../num '==' 5}}style="margin-left: 104.5px;"{{/if_cond}} data-index={{index}}>
<img src="{{categoryIco}}" width="55" height="55">
<p>{{categoryName}}</p>
</a>
... ... @@ -40,6 +42,7 @@
</li>
{{/each}}
</ul>
{{/newGuide}}
{{#selfService}}
... ...
... ... @@ -118,7 +118,7 @@
margin: 0 auto 30px;
height: auto;
overflow: hidden;
padding: 0 15px;
padding: 0 20px;
box-sizing: border-box;
li {
... ... @@ -144,7 +144,7 @@
}
.new-guide a {
margin-left: 74px;
margin-left: 72.4px;
}
.self-service {
... ...