Authored by yyq

Merge branch 'release/1.0' of git.yoho.cn:fe/yoho-blk into release/1.0

... ... @@ -17,6 +17,10 @@
<span class="iconfont">&#xe61f;</span>
</div>
<span class="img-up-tip">0/4</span>
<span class="warn hide">
<span class="iconfont blue">&#xe60d;</span>
<span class="blue">最多上传4张照片</span>
</span>
</div>
</div>
</div>
... ...
... ... @@ -16,7 +16,7 @@ const getImgHost = (url) => {
num = urlArr[urlArr.length - 1].substr(1, 1),
url1 = domain + url;
if (num === 1) {
if (num === '1') {
return 'http://img11.' + url1;
} else {
return 'http://img12.' + url1;
... ...
... ... @@ -8,12 +8,12 @@
// render pagination ellipse indicator
function _renderEllipse(templateStr) {
return templateStr + '<li><a>...</a></li>';
return templateStr + '<a>...</a>';
}
// render last page link
function _renderLastPage(templateStr, pageCount, queryParams) {
return templateStr + '<li><a href="?page=' + pageCount + queryParams + '">' + pageCount + '</a></li>';
return templateStr + '<a href="?page=' + pageCount + queryParams + '">' + pageCount + '</a>';
}
/*
... ... @@ -32,8 +32,8 @@ exports.createPagination = function(pagination, options) {
n, // page number ?page=n
queryParams = '', // paginate with query parameter
page = parseInt(pagination.page, 10), // current page number
leftText = '<i class="iconfont">&#xe607;</i>', // prev
rightText = '<i class="iconfont">&#xe61e;</i>', // next
leftText = '<i class="iconfont">&#xe62c;</i>', // prev
rightText = '<i class="iconfont">&#xe629;</i>', // next
paginationClass = 'blk-pagination'; // pagination <ul> default class
var pageCount,
... ... @@ -88,12 +88,12 @@ exports.createPagination = function(pagination, options) {
}
}
template = '<ul class="' + paginationClass + '">';
template = '<div class="' + paginationClass + '">';
// ========= Previous Button ===============
if (page - 1) {
n = page - 1;
template = template + '<li><a href="?page=' + n + queryParams + '">' + leftText + '</a></li>';
template = template + '<a href="?page=' + n + queryParams + '">' + leftText + '</a>';
}
// ========= Page Numbers Middle ===============
... ... @@ -117,13 +117,13 @@ exports.createPagination = function(pagination, options) {
n = start;
if (start === page) {
template = template + '<li class="active"><a href="?page=' + n + queryParams + '">' + n + '</a></li>';
template = template + '<a class="active" href="?page=' + n + queryParams + '">' + n + '</a>';
} else {
// generate left style
if (leftCount >= 4) {
if (i === 0) {
// first page
template = template + '<li><a href="?page=1' + queryParams + '">1</a></li>';
template = template + '<a href="?page=1' + queryParams + '">1</a>';
} else if (i === 1 || (i === 7 && start <= pageCount - 2)) {
// left and right ...
template = _renderEllipse(template);
... ... @@ -132,9 +132,9 @@ exports.createPagination = function(pagination, options) {
} else {
// other links is normal
template = template +
'<li><a href="?page=' + n + queryParams + '">' +
'<a href="?page=' + n + queryParams + '">' +
n +
'</a></li>';
'</a>';
}
} else {
if (i === 7 && start <= pageCount - 2) {
... ... @@ -144,9 +144,9 @@ exports.createPagination = function(pagination, options) {
template = _renderLastPage(template, pageCount, queryParams);
} else {
template = template +
'<li><a href="?page=' + n + queryParams + '">' +
'<a href="?page=' + n + queryParams + '">' +
n +
'</a></li>';
'</a>';
}
}
... ... @@ -159,10 +159,10 @@ exports.createPagination = function(pagination, options) {
// ========= Next page ===============
if (pageCount - page) {
n = page + 1;
template = template + '<li><a href="?page=' + n + queryParams + '">' + rightText + '</a></li>';
template = template + '<a href="?page=' + n + queryParams + '">' + rightText + '</a>';
}
template = template + '</ul>';
template = template + '</div>';
// html template
return template;
... ...
... ... @@ -4,6 +4,11 @@
* @date: 2017/7/5
*/
/**
* 获取cookie值
* @param name [string] cookie键名
* @return [string] cookie值
*/
function cookie(name) {
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
... ... @@ -11,6 +16,12 @@ function cookie(name) {
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
}
/**
* 设置cookie
* @param name [string] cookie键名
* @param value [string] cookie值
* @pamra options [object] cookie参数项
*/
function setCookie(name, value, options) {
var expires = '',
path,
... ... @@ -42,6 +53,10 @@ function setCookie(name, value, options) {
}
}
/**
* query参数解析
* @return [object] query key-value map
*/
function queryString() {
var vars = {},
hash,
... ... @@ -56,6 +71,11 @@ function queryString() {
return vars;
}
/**
* 获取字符串长度(一个中文=2个字符)
* @param str [string]
* @return [num] 字符串长度
*/
function getStrLength(str) {
var cArr = str.match(/[\u4e00-\u9fa5a]/ig);
... ... @@ -63,8 +83,8 @@ function getStrLength(str) {
}
module.exports = {
cookie: cookie, // 获取cookie
setCookie: setCookie, // 设置cookie
queryString: queryString, // query参数解析
getStrLength: getStrLength // 获取字符串长度(一个中文=2个字符)
cookie: cookie,
setCookie: setCookie,
queryString: queryString,
getStrLength: getStrLength
};
... ...
... ... @@ -8,6 +8,9 @@ var $ = require('yoho-jquery');
var $returnTop = $('.return-top');
/**
* 是否显示返回顶部按钮
*/
function showOrNot() {
if ($(window).height() >= $(document).height()) {
$returnTop.addClass('hide');
... ...
... ... @@ -430,6 +430,8 @@ function bindUploadEvent() {
}
}
});
} else {
$(that).siblings('.warn').removeClass('hide');
}
});
}
... ...
... ... @@ -139,7 +139,7 @@ function getCancelReason(code, onCancel) {
showDiaglog(tpl, code, onCancel);
}
}) .fail(function(err) {
}).fail(function(err) {
console.log(err);
});
}
... ...
ul.blk-pagination {
div.blk-pagination {
padding: 0;
li {
a {
display: inline-block;
width: 24px;
line-height: 24px;
height: 24px;
text-align: center;
a {
display: block;
}
font-size: 14px;
line-height: 22px;
padding: 0 9px;
&:first-child {
padding: 0 5px;
margin-right: 10px;
border: 1px solid #333;
&:hover {
background-color: #333;
cursor: pointer;
a {
color: #fff;
}
color: #fff;
}
}
&:last-child {
padding: 0 5px;
margin-left: 10px;
border: 1px solid #333;
&:hover {
background-color: #333;
cursor: pointer;
a {
color: #fff;
}
color: #fff;
}
}
}
.active {
background-color: #333;
a {
color: #fff;
}
color: #fff;
}
i {
font-size: 18px;
font-size: 14px;
line-height: 22px;
}
}
... ...
... ... @@ -31,6 +31,14 @@
}
}
.warn {
font-size: 12px;
.iconfont {
font-size: 18px;
}
}
.header {
.info {
width: 540px;
... ...