help.page.js
2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
* [帮助中心]
* @author: wsl(shuiling.wang@yoho.cn)
* @date: 2016/07/25
*/
var helpSearch = require('./help-search');
var problemBox = require('./help-common');
var helper = require('./help-helper');
var searchTemplet = require('../../hbs/help/search-cont.hbs');
var parentID, qs, queryId, page, keywords, $cate;
require('../common');
qs = window.queryString();
queryId = qs.id;
page = qs.page || 1;
keywords = qs.helpQuery;
$cate = $('.cateId-' + queryId);// 当前分类
helpSearch.init();
problemBox();
// 获取搜索的结果
if (keywords) {
$.get('/help/search', {
page: page,
keywords: keywords
}, function(result) {
var id,
$detailCont = $('.detail-cont');
if (result.helper_list) {
$.each(result.helper_list, function(k, s) {
if (s.helperType === 2) {
s.problem = true;
}
if (s.secendCategoryId === '0') {
id = s.firstCategoryId;
} else {
id = s.secendCategoryId;
}
s.content = helper.cutStr({
str: s.content,
len: 290,
type: s.helperType,
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);
});
$detailCont.html(searchTemplet(result));
} else {
$.get('/help/onlineService', {}, function(url) {
result.jumpUrl = url;
$detailCont.html(searchTemplet(result));
});
}
});
}
if (!$cate.hasClass('big-category')) {
parentID = $cate.data('parentId');
$('.parentId-' + parentID).show();
$('.cateId-' + parentID).find('.icon').removeClass('plus').addClass('minus');
}
$('.center-content').css('border-top-color', '#fff');