Authored by 王水玲

Merge branch 'feature/help' into release/5.4

... ... @@ -9,11 +9,16 @@ var cutStr = function(params) {
var strCut = '';
var i, curStr, addTxt, strLen;
params.str = params.str.replace(/\s/g, '');
params.str = params.str.replace(/<[^>]*>/g, '');
params.str = params.str.replace(/&nbsp;/ig, '');
params.str = params.str.replace(/(?=[^>]*(?=<))\s+/g, '');
params.str = params.str.replace(/<(?!a|\/a).*?>/g, '');
strLen = params.str.length || 0;
if (!strLen) {
return '';
}
if (params.type === 2) {
addTxt = '';
} else {
... ... @@ -45,8 +50,12 @@ var cutStr = function(params) {
var keywordLabel = function(str, key) {
var reg = new RegExp(key, 'gm');
if (str === '') {
return str;
}
str = str.replace(reg, '<i class="keyword">' + key + '</i>');
return str.replace('www.yohobuy.com', '<a href="http://www.yohobuy.com" class="keyword">www.yohobuy.com</a>');
return str;
};
exports.cutStr = cutStr;
... ...
... ... @@ -36,11 +36,13 @@ if (keywords) {
s.problem = true;
}
if (s.secendCategoryId === '0') {
if (parseInt(s.secendCategoryId, 10) === 0) {
id = s.firstCategoryId;
} else {
id = s.secendCategoryId;
}
s.content = helper.cutStr({
str: s.content,
len: 290,
... ... @@ -48,8 +50,6 @@ if (keywords) {
url: '/help/detail?id=' + id + '&contId=' + s.id
});
// console.log(s.content)
s.content = helper.keywordLabel(s.content, keywords);
s.caption = helper.keywordLabel(s.caption, keywords);
});
... ...
... ... @@ -75,6 +75,8 @@
margin-top: 15px;
font-size: 14px;
line-height: 20px;
height: 60px;
overflow: hidden;
}
.show-all {
... ... @@ -94,7 +96,7 @@
line-height: 24px;
img {
width: 100%;
max-width: 100%;
}
}
}
... ...
... ... @@ -130,7 +130,7 @@
}
a {
widtsh: 56px;
width: 56px;
text-align: center;
display: block;
}
... ...