SearchApe.js
1.7 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
//人员搜索
import Loger from "../Loger";
import Ape from "./Ape";
import ClassDataProxy from "proxy/ClassDataProxy";
import $ from "jquery";
let loger = Loger.getLoger('PC-SearchApe');
class SearchApe extends Ape {
constructor(){
super();
this.init();
this.isShowRoster=false;
}
init(){
$("#searchName").on('keyup',this._showSelectRosterChange.bind(this));
$("#rosterIcon").on('click',this._showSelectBox.bind(this));
$("#clearInput").on('click',this._clearInputInfo.bind(this));
}
_showSelectRosterChange(){
var txt=$("#searchName").val();
if($.trim(txt)!=""){
$(".nameDiv").each(function () {
var title = $(this).attr("title");
if (title.indexOf(txt) != -1) {
$(this).parent().parent().show();
} else {
$(this).parent().parent().hide();
}
});
}else{
$(".userListInfo").show();
}
}
_showSelectBox(){
if(ClassDataProxy.userRole==ClassDataProxy.USER_HOST||ClassDataProxy.userRole==ClassDataProxy.USER_INVISIBLE){
if(!this.isShowRoster){
$('#searchBox').show();
$('#searchName').focus();
this.isShowRoster=true;
$('.curClassUserList').css("top","42px");
}
else{
$('#searchBox').hide();
this.isShowRoster=false;
$('.curClassUserList').css("top","0px");
this._clearInputInfo();
}
}
}
_clearInputInfo(){
$("#searchName").val("");
this._showSelectRosterChange();
}
}
export default SearchApe;