Showing
5 changed files
with
41 additions
and
4 deletions
apps/help/helper/index.js
0 → 100644
1 | +/** | ||
2 | + * Created by Gexuhui on 2017/0321. | ||
3 | + */ | ||
4 | + | ||
5 | +'use strict'; | ||
6 | + | ||
7 | +exports.if_cond = function(left, operator, right, options) { | ||
8 | + switch (operator) { | ||
9 | + case '==': | ||
10 | + return (left == right) ? options.fn(this) : options.inverse(this); // eslint-disable-line | ||
11 | + case '!=': | ||
12 | + return (left != right) ? options.fn(this) : options.inverse(this); // eslint-disable-line | ||
13 | + case '===': | ||
14 | + return (left === right) ? options.fn(this) : options.inverse(this); | ||
15 | + case '<': | ||
16 | + return (left < right) ? options.fn(this) : options.inverse(this); | ||
17 | + case '<=': | ||
18 | + return (left <= right) ? options.fn(this) : options.inverse(this); | ||
19 | + case '>': | ||
20 | + return (left > right) ? options.fn(this) : options.inverse(this); | ||
21 | + case '>=': | ||
22 | + return (left >= right) ? options.fn(this) : options.inverse(this); | ||
23 | + case '&&': | ||
24 | + return (left && right) ? options.fn(this) : options.inverse(this); | ||
25 | + case '||': | ||
26 | + return (left || right) ? options.fn(this) : options.inverse(this); | ||
27 | + default: | ||
28 | + return options.inverse(this); | ||
29 | + } | ||
30 | +}; | ||
31 | + |
@@ -24,7 +24,7 @@ | @@ -24,7 +24,7 @@ | ||
24 | layoutsDir: doraemon, | 24 | layoutsDir: doraemon, |
25 | partialsDir: [path.join(__dirname, 'views/partial')], | 25 | partialsDir: [path.join(__dirname, 'views/partial')], |
26 | views: path.join(__dirname, 'views/action'), | 26 | views: path.join(__dirname, 'views/action'), |
27 | - helpers: global.yoho.helpers | 27 | + helpers: Object.assign(require('./helper'), global.yoho.helpers) |
28 | })); | 28 | })); |
29 | 29 | ||
30 | // router | 30 | // router |
@@ -124,12 +124,15 @@ const _processHomeCategoryFaq = (list) => { | @@ -124,12 +124,15 @@ const _processHomeCategoryFaq = (list) => { | ||
124 | 124 | ||
125 | switch (item.categoryName) { | 125 | switch (item.categoryName) { |
126 | case '新手指南': | 126 | case '新手指南': |
127 | + | ||
127 | _.forEach(item.categoryItems, (ng, k) => { | 128 | _.forEach(item.categoryItems, (ng, k) => { |
128 | ng.index = k + 1; | 129 | ng.index = k + 1; |
129 | }); | 130 | }); |
130 | 131 | ||
131 | item.categoryItems = _.chunk(item.categoryItems, 6); | 132 | item.categoryItems = _.chunk(item.categoryItems, 6); |
133 | + item.num = _.flattenDeep(item.categoryItems).length; | ||
132 | result.newGuide = item; | 134 | result.newGuide = item; |
135 | + | ||
133 | break; | 136 | break; |
134 | case '公告': | 137 | case '公告': |
135 | _.forEach(item.contentItems, (c, k) => { | 138 | _.forEach(item.contentItems, (c, k) => { |
@@ -32,7 +32,9 @@ | @@ -32,7 +32,9 @@ | ||
32 | {{#each categoryItems}} | 32 | {{#each categoryItems}} |
33 | <li> | 33 | <li> |
34 | {{#each .}} | 34 | {{#each .}} |
35 | - <a href="{{jumpLink}}" target="_blank" {{#if @first}}style="margin-left: 0;"{{/if}} data-index={{index}}> | 35 | + <a href="{{jumpLink}}" target="_blank" {{#if @first}}style="margin-left: 0;"{{/if}} |
36 | + {{#if_cond ../../num '==' 4}}style="margin-left: 158px;"{{/if_cond}} | ||
37 | + {{#if_cond ../../num '==' 5}}style="margin-left: 104.5px;"{{/if_cond}} data-index={{index}}> | ||
36 | <img src="{{categoryIco}}" width="55" height="55"> | 38 | <img src="{{categoryIco}}" width="55" height="55"> |
37 | <p>{{categoryName}}</p> | 39 | <p>{{categoryName}}</p> |
38 | </a> | 40 | </a> |
@@ -40,6 +42,7 @@ | @@ -40,6 +42,7 @@ | ||
40 | </li> | 42 | </li> |
41 | {{/each}} | 43 | {{/each}} |
42 | </ul> | 44 | </ul> |
45 | + | ||
43 | {{/newGuide}} | 46 | {{/newGuide}} |
44 | 47 | ||
45 | {{#selfService}} | 48 | {{#selfService}} |
@@ -118,7 +118,7 @@ | @@ -118,7 +118,7 @@ | ||
118 | margin: 0 auto 30px; | 118 | margin: 0 auto 30px; |
119 | height: auto; | 119 | height: auto; |
120 | overflow: hidden; | 120 | overflow: hidden; |
121 | - padding: 0 15px; | 121 | + padding: 0 20px; |
122 | box-sizing: border-box; | 122 | box-sizing: border-box; |
123 | 123 | ||
124 | li { | 124 | li { |
@@ -144,7 +144,7 @@ | @@ -144,7 +144,7 @@ | ||
144 | } | 144 | } |
145 | 145 | ||
146 | .new-guide a { | 146 | .new-guide a { |
147 | - margin-left: 74px; | 147 | + margin-left: 72.4px; |
148 | } | 148 | } |
149 | 149 | ||
150 | .self-service { | 150 | .self-service { |
-
Please register or login to post a comment