Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0
Showing
9 changed files
with
69 additions
and
42 deletions
@@ -17,6 +17,10 @@ | @@ -17,6 +17,10 @@ | ||
17 | <span class="iconfont"></span> | 17 | <span class="iconfont"></span> |
18 | </div> | 18 | </div> |
19 | <span class="img-up-tip">0/4</span> | 19 | <span class="img-up-tip">0/4</span> |
20 | + <span class="warn hide"> | ||
21 | + <span class="iconfont blue"></span> | ||
22 | + <span class="blue">最多上传4张照片</span> | ||
23 | + </span> | ||
20 | </div> | 24 | </div> |
21 | </div> | 25 | </div> |
22 | </div> | 26 | </div> |
@@ -16,7 +16,7 @@ const getImgHost = (url) => { | @@ -16,7 +16,7 @@ const getImgHost = (url) => { | ||
16 | num = urlArr[urlArr.length - 1].substr(1, 1), | 16 | num = urlArr[urlArr.length - 1].substr(1, 1), |
17 | url1 = domain + url; | 17 | url1 = domain + url; |
18 | 18 | ||
19 | - if (num === 1) { | 19 | + if (num === '1') { |
20 | return 'http://img11.' + url1; | 20 | return 'http://img11.' + url1; |
21 | } else { | 21 | } else { |
22 | return 'http://img12.' + url1; | 22 | return 'http://img12.' + url1; |
@@ -8,12 +8,12 @@ | @@ -8,12 +8,12 @@ | ||
8 | 8 | ||
9 | // render pagination ellipse indicator | 9 | // render pagination ellipse indicator |
10 | function _renderEllipse(templateStr) { | 10 | function _renderEllipse(templateStr) { |
11 | - return templateStr + '<li><a>...</a></li>'; | 11 | + return templateStr + '<a>...</a>'; |
12 | } | 12 | } |
13 | 13 | ||
14 | // render last page link | 14 | // render last page link |
15 | function _renderLastPage(templateStr, pageCount, queryParams) { | 15 | function _renderLastPage(templateStr, pageCount, queryParams) { |
16 | - return templateStr + '<li><a href="?page=' + pageCount + queryParams + '">' + pageCount + '</a></li>'; | 16 | + return templateStr + '<a href="?page=' + pageCount + queryParams + '">' + pageCount + '</a>'; |
17 | } | 17 | } |
18 | 18 | ||
19 | /* | 19 | /* |
@@ -32,8 +32,8 @@ exports.createPagination = function(pagination, options) { | @@ -32,8 +32,8 @@ exports.createPagination = function(pagination, options) { | ||
32 | n, // page number ?page=n | 32 | n, // page number ?page=n |
33 | queryParams = '', // paginate with query parameter | 33 | queryParams = '', // paginate with query parameter |
34 | page = parseInt(pagination.page, 10), // current page number | 34 | page = parseInt(pagination.page, 10), // current page number |
35 | - leftText = '<i class="iconfont"></i>', // prev | ||
36 | - rightText = '<i class="iconfont"></i>', // next | 35 | + leftText = '<i class="iconfont"></i>', // prev |
36 | + rightText = '<i class="iconfont"></i>', // next | ||
37 | paginationClass = 'blk-pagination'; // pagination <ul> default class | 37 | paginationClass = 'blk-pagination'; // pagination <ul> default class |
38 | 38 | ||
39 | var pageCount, | 39 | var pageCount, |
@@ -88,12 +88,12 @@ exports.createPagination = function(pagination, options) { | @@ -88,12 +88,12 @@ exports.createPagination = function(pagination, options) { | ||
88 | } | 88 | } |
89 | } | 89 | } |
90 | 90 | ||
91 | - template = '<ul class="' + paginationClass + '">'; | 91 | + template = '<div class="' + paginationClass + '">'; |
92 | 92 | ||
93 | // ========= Previous Button =============== | 93 | // ========= Previous Button =============== |
94 | if (page - 1) { | 94 | if (page - 1) { |
95 | n = page - 1; | 95 | n = page - 1; |
96 | - template = template + '<li><a href="?page=' + n + queryParams + '">' + leftText + '</a></li>'; | 96 | + template = template + '<a href="?page=' + n + queryParams + '">' + leftText + '</a>'; |
97 | } | 97 | } |
98 | 98 | ||
99 | // ========= Page Numbers Middle =============== | 99 | // ========= Page Numbers Middle =============== |
@@ -117,13 +117,13 @@ exports.createPagination = function(pagination, options) { | @@ -117,13 +117,13 @@ exports.createPagination = function(pagination, options) { | ||
117 | n = start; | 117 | n = start; |
118 | 118 | ||
119 | if (start === page) { | 119 | if (start === page) { |
120 | - template = template + '<li class="active"><a href="?page=' + n + queryParams + '">' + n + '</a></li>'; | 120 | + template = template + '<a class="active" href="?page=' + n + queryParams + '">' + n + '</a>'; |
121 | } else { | 121 | } else { |
122 | // generate left style | 122 | // generate left style |
123 | if (leftCount >= 4) { | 123 | if (leftCount >= 4) { |
124 | if (i === 0) { | 124 | if (i === 0) { |
125 | // first page | 125 | // first page |
126 | - template = template + '<li><a href="?page=1' + queryParams + '">1</a></li>'; | 126 | + template = template + '<a href="?page=1' + queryParams + '">1</a>'; |
127 | } else if (i === 1 || (i === 7 && start <= pageCount - 2)) { | 127 | } else if (i === 1 || (i === 7 && start <= pageCount - 2)) { |
128 | // left and right ... | 128 | // left and right ... |
129 | template = _renderEllipse(template); | 129 | template = _renderEllipse(template); |
@@ -132,9 +132,9 @@ exports.createPagination = function(pagination, options) { | @@ -132,9 +132,9 @@ exports.createPagination = function(pagination, options) { | ||
132 | } else { | 132 | } else { |
133 | // other links is normal | 133 | // other links is normal |
134 | template = template + | 134 | template = template + |
135 | - '<li><a href="?page=' + n + queryParams + '">' + | 135 | + '<a href="?page=' + n + queryParams + '">' + |
136 | n + | 136 | n + |
137 | - '</a></li>'; | 137 | + '</a>'; |
138 | } | 138 | } |
139 | } else { | 139 | } else { |
140 | if (i === 7 && start <= pageCount - 2) { | 140 | if (i === 7 && start <= pageCount - 2) { |
@@ -144,9 +144,9 @@ exports.createPagination = function(pagination, options) { | @@ -144,9 +144,9 @@ exports.createPagination = function(pagination, options) { | ||
144 | template = _renderLastPage(template, pageCount, queryParams); | 144 | template = _renderLastPage(template, pageCount, queryParams); |
145 | } else { | 145 | } else { |
146 | template = template + | 146 | template = template + |
147 | - '<li><a href="?page=' + n + queryParams + '">' + | 147 | + '<a href="?page=' + n + queryParams + '">' + |
148 | n + | 148 | n + |
149 | - '</a></li>'; | 149 | + '</a>'; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
@@ -159,10 +159,10 @@ exports.createPagination = function(pagination, options) { | @@ -159,10 +159,10 @@ exports.createPagination = function(pagination, options) { | ||
159 | // ========= Next page =============== | 159 | // ========= Next page =============== |
160 | if (pageCount - page) { | 160 | if (pageCount - page) { |
161 | n = page + 1; | 161 | n = page + 1; |
162 | - template = template + '<li><a href="?page=' + n + queryParams + '">' + rightText + '</a></li>'; | 162 | + template = template + '<a href="?page=' + n + queryParams + '">' + rightText + '</a>'; |
163 | } | 163 | } |
164 | 164 | ||
165 | - template = template + '</ul>'; | 165 | + template = template + '</div>'; |
166 | 166 | ||
167 | // html template | 167 | // html template |
168 | return template; | 168 | return template; |
@@ -4,6 +4,11 @@ | @@ -4,6 +4,11 @@ | ||
4 | * @date: 2017/7/5 | 4 | * @date: 2017/7/5 |
5 | */ | 5 | */ |
6 | 6 | ||
7 | +/** | ||
8 | + * 获取cookie值 | ||
9 | + * @param name [string] cookie键名 | ||
10 | + * @return [string] cookie值 | ||
11 | + */ | ||
7 | function cookie(name) { | 12 | function cookie(name) { |
8 | var re = new RegExp(name + '=([^;$]*)', 'i'), | 13 | var re = new RegExp(name + '=([^;$]*)', 'i'), |
9 | matchPattern = '$1'; | 14 | matchPattern = '$1'; |
@@ -11,6 +16,12 @@ function cookie(name) { | @@ -11,6 +16,12 @@ function cookie(name) { | ||
11 | return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : ''; | 16 | return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : ''; |
12 | } | 17 | } |
13 | 18 | ||
19 | +/** | ||
20 | + * 设置cookie | ||
21 | + * @param name [string] cookie键名 | ||
22 | + * @param value [string] cookie值 | ||
23 | + * @pamra options [object] cookie参数项 | ||
24 | + */ | ||
14 | function setCookie(name, value, options) { | 25 | function setCookie(name, value, options) { |
15 | var expires = '', | 26 | var expires = '', |
16 | path, | 27 | path, |
@@ -42,6 +53,10 @@ function setCookie(name, value, options) { | @@ -42,6 +53,10 @@ function setCookie(name, value, options) { | ||
42 | } | 53 | } |
43 | } | 54 | } |
44 | 55 | ||
56 | +/** | ||
57 | + * query参数解析 | ||
58 | + * @return [object] query key-value map | ||
59 | + */ | ||
45 | function queryString() { | 60 | function queryString() { |
46 | var vars = {}, | 61 | var vars = {}, |
47 | hash, | 62 | hash, |
@@ -56,6 +71,11 @@ function queryString() { | @@ -56,6 +71,11 @@ function queryString() { | ||
56 | return vars; | 71 | return vars; |
57 | } | 72 | } |
58 | 73 | ||
74 | +/** | ||
75 | + * 获取字符串长度(一个中文=2个字符) | ||
76 | + * @param str [string] | ||
77 | + * @return [num] 字符串长度 | ||
78 | + */ | ||
59 | function getStrLength(str) { | 79 | function getStrLength(str) { |
60 | var cArr = str.match(/[\u4e00-\u9fa5a]/ig); | 80 | var cArr = str.match(/[\u4e00-\u9fa5a]/ig); |
61 | 81 | ||
@@ -63,8 +83,8 @@ function getStrLength(str) { | @@ -63,8 +83,8 @@ function getStrLength(str) { | ||
63 | } | 83 | } |
64 | 84 | ||
65 | module.exports = { | 85 | module.exports = { |
66 | - cookie: cookie, // 获取cookie | ||
67 | - setCookie: setCookie, // 设置cookie | ||
68 | - queryString: queryString, // query参数解析 | ||
69 | - getStrLength: getStrLength // 获取字符串长度(一个中文=2个字符) | 86 | + cookie: cookie, |
87 | + setCookie: setCookie, | ||
88 | + queryString: queryString, | ||
89 | + getStrLength: getStrLength | ||
70 | }; | 90 | }; |
@@ -8,6 +8,9 @@ var $ = require('yoho-jquery'); | @@ -8,6 +8,9 @@ var $ = require('yoho-jquery'); | ||
8 | 8 | ||
9 | var $returnTop = $('.return-top'); | 9 | var $returnTop = $('.return-top'); |
10 | 10 | ||
11 | +/** | ||
12 | + * 是否显示返回顶部按钮 | ||
13 | + */ | ||
11 | function showOrNot() { | 14 | function showOrNot() { |
12 | if ($(window).height() >= $(document).height()) { | 15 | if ($(window).height() >= $(document).height()) { |
13 | $returnTop.addClass('hide'); | 16 | $returnTop.addClass('hide'); |
@@ -139,7 +139,7 @@ function getCancelReason(code, onCancel) { | @@ -139,7 +139,7 @@ function getCancelReason(code, onCancel) { | ||
139 | 139 | ||
140 | showDiaglog(tpl, code, onCancel); | 140 | showDiaglog(tpl, code, onCancel); |
141 | } | 141 | } |
142 | - }) .fail(function(err) { | 142 | + }).fail(function(err) { |
143 | console.log(err); | 143 | console.log(err); |
144 | }); | 144 | }); |
145 | } | 145 | } |
1 | -ul.blk-pagination { | 1 | +div.blk-pagination { |
2 | padding: 0; | 2 | padding: 0; |
3 | 3 | ||
4 | - li { | 4 | + a { |
5 | display: inline-block; | 5 | display: inline-block; |
6 | - width: 24px; | ||
7 | - line-height: 24px; | ||
8 | - height: 24px; | ||
9 | - text-align: center; | ||
10 | - | ||
11 | - a { | ||
12 | - display: block; | ||
13 | - } | 6 | + font-size: 14px; |
7 | + line-height: 22px; | ||
8 | + padding: 0 9px; | ||
14 | 9 | ||
15 | &:first-child { | 10 | &:first-child { |
11 | + padding: 0 5px; | ||
16 | margin-right: 10px; | 12 | margin-right: 10px; |
17 | border: 1px solid #333; | 13 | border: 1px solid #333; |
18 | 14 | ||
19 | &:hover { | 15 | &:hover { |
20 | background-color: #333; | 16 | background-color: #333; |
21 | cursor: pointer; | 17 | cursor: pointer; |
22 | - | ||
23 | - a { | ||
24 | - color: #fff; | ||
25 | - } | 18 | + color: #fff; |
26 | } | 19 | } |
27 | } | 20 | } |
28 | 21 | ||
29 | &:last-child { | 22 | &:last-child { |
23 | + padding: 0 5px; | ||
30 | margin-left: 10px; | 24 | margin-left: 10px; |
31 | border: 1px solid #333; | 25 | border: 1px solid #333; |
32 | 26 | ||
33 | &:hover { | 27 | &:hover { |
34 | background-color: #333; | 28 | background-color: #333; |
35 | cursor: pointer; | 29 | cursor: pointer; |
36 | - | ||
37 | - a { | ||
38 | - color: #fff; | ||
39 | - } | 30 | + color: #fff; |
40 | } | 31 | } |
41 | } | 32 | } |
42 | } | 33 | } |
43 | 34 | ||
44 | .active { | 35 | .active { |
45 | background-color: #333; | 36 | background-color: #333; |
46 | - a { | ||
47 | - color: #fff; | ||
48 | - } | 37 | + color: #fff; |
49 | } | 38 | } |
50 | 39 | ||
51 | i { | 40 | i { |
52 | - font-size: 18px; | 41 | + font-size: 14px; |
42 | + line-height: 22px; | ||
53 | } | 43 | } |
54 | } | 44 | } |
-
Please register or login to post a comment