forked from maxliaops/Java_Web_Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.js
More file actions
101 lines (101 loc) · 2.5 KB
/
search.js
File metadata and controls
101 lines (101 loc) · 2.5 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// 文章分类
var articleType = {
action : 'articleAction_forum',
text : '问题分类'
};
// 论坛首页
var forum = {
action : 'articleAction_forum',
text : '论坛首页'
};
// 某个分类下的所有文章
var articlesOfType = {
action : 'articleAction_findArticlesByType',
text : '',
init : function(articleTypeName) {
this.action = this.action + '?articleType='
+ encodeURIComponent(articleTypeName);
this.text = articleTypeName;
return this;
}
};
// 某个类型下的一篇文章
var articleOfType = {
action : 'articleAction_querySingleArticle',
text : '',
init : function(articleName, articleId) {
this.action = this.action + '?article.articleId='
+ encodeURIComponent(articleId);
this.text = articleName;
return this;
}
};
// 我的文章列表
var myArticles = {
action : 'articleAction_queryAllMyArticles',
text : '我的文章列表'
};
// 添加文章
var addArticle = {
action : 'articleAction_toAddArticlePage',
text : '添加文章'
};
// 修改文章
var updateArticle = {
action : 'articleAction_querySingleArticleForUpdate',
text : ' 修改文章'
};
// 某个人的文章列表
var userArticles = {
action : 'articleAction_getArticlesByUserId',
text : '',
init : function(userName, userId) {
this.action = this.action + '?user.userId='
+ encodeURIComponent(userId) + '&user.userName='
+ encodeURIComponent(userName);
this.text = userName + '的文章列表';
return this;
}
};
//符合条件的文章列表
var article_search = {
action : 'articleAction_doSearch',
text : '符合条件的文章列表',
init : function(type, searchStr) {
this.action = this.action + '?searchStr='
+ encodeURIComponent(searchStr) + '&article.articleTypeName='
+ encodeURIComponent(type);
return this;
}
};
// 设置当前位置的类
var PathUtil = function(data) {
var path = $('#path');
var pathArray = [];
if (data) {
pathArray = data;
}
for ( var i = 0; i < pathArray.length; i++) {
var obj = pathArray[i];
path.append($('<span>').addClass('huise1').html('>>')).append(
$('<a>').attr('href', obj.action).addClass('hong').text(
obj.text));
}
}
/**
* 搜索文章
*
* @return
*/
function doSearch() {
var searchText = $.trim($('#searchStr').val());
if (!searchText) {
alert('请输入要搜素的内容');
return;
}
if (searchText.length > 255) {
alert('输入内容不能超过255个字符');
return;
}
doSearchForm.submit();
}