//搜索首页
var ifdiv = false;
var bigClass = 1,
allPages = 1; // 总页数;
var key = "",
subject = "",
industry = "",
province = "",
address = "",
authentication = "",
pageSize = 0,
pageNo = 1;
var showblock = document.getElementById("li_show");
var selectblock = document.getElementById("div_select");
var searchVal = document.getElementById("searchval");
var table = document.body.querySelector('.list');
var yyhy = document.getElementById("yyhy");
var xsly = document.getElementById("xsly");
var subjectid = document.getElementById("subjectid");
var industryid = document.getElementById("industryid");
var nodatabox = document.getElementById("nodatabox");
mui.init({
pullRefresh: {
container: '#pullrefresh3',
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh,
//auto:true
}
}
});
function pullupRefresh() {
pageNo = ++pageNo;
console.log(pageNo)
key = searchVal.value;
setTimeout(function() {
expert2(key, subject, industry, province, address, authentication, 10, pageNo)
}, 1000);
mui('#pullrefresh3').pullRefresh().refresh(true);
}
/*地区搜索*/
window.addEventListener('closesearch', function(event) {
province = event.detail.province;
address = event.detail.address;
if(address == "全省") {
address = "";
document.getElementById("addressid").innerText = province;
}else{
document.getElementById("addressid").innerText = address;
}
if(province == "全国") {
province = "";
address = "";
document.getElementById("addressid").innerText = "全国";
}
/*console.log(key);
console.log(subject);
console.log(industry);
console.log(address);
console.log(province);
console.log(authentication);*/
plus.nativeUI.showWaiting();
expert(key, subject, industry, province, address, authentication, 10, 1);
})
mui.plusReady(function(){
/*点击专家和资源列表*/
mui('.list').on('tap','a',function(){
var id=this.getAttribute("data-id");
plus.nativeUI.showWaiting();//显示原生等待框
if(bigClass==1){
plus.webview.create("../html/proinforbrow.html",'proinforbrow.html',{},{proid:id});
}else{
plus.webview.create("../html/resinforbrow.html",'resinforbrow.html',{},{resourceId:id});
}
})
var self = plus.webview.currentWebview();
if(self.key==undefined){
self.key="";
}else{
key=self.key;
searchVal.value=key;
}
if(self.subject==undefined){
self.subject="学术领域";
}else{
subject=self.subject;
subjectid.innerText = self.subject;
searchVal.setAttribute("placeholder","输入专家姓名、研究方向等关键字");
}
bigClass=self.bigClass;
if(bigClass==1){
selectblock.innerText='专家';
}else{
selectblock.innerText='资源';
}
expert(key, subject, industry, province, address, authentication, 10, 1);
})
/*搜专家搜资源的下拉选择框*/
selectblock.addEventListener('tap', function() {
showblock.style.display = 'block';
});
mui("#li_show").on('tap', 'li', function() {
pageNo = 1
bigClass = this.getAttribute("data-num");
if(bigClass==1){
searchVal.setAttribute("placeholder","输入专家姓名、研究方向等关键字");
}else{
searchVal.setAttribute("placeholder","输入资源名称、应用用途等关键字");
}
selectblock.innerHTML = this.innerHTML;
showblock.style.display = 'none';
plus.nativeUI.showWaiting();
expert(key, subject, industry, province, address, authentication, 10, 1);
});
/*按键字搜索*/
searchval.addEventListener("keyup", function() {
var e = event || window.event || arguments.caller.arguments[0];
if(e.keyCode == 13) {
pageNo = 1
key = searchVal.value;
plus.nativeUI.showWaiting();
expert(key, subject, industry, province, address, authentication, 10, 1);
}
})
/*应用行业*/
mui(".yyhy").on('tap', 'a', function() {
pageNo = 1
key = searchVal.value;
industry = this.innerText;
industryid.innerText = industry;
document.querySelector('#yyhy li a.active').classList.remove('active');
this.classList.add("active");
if(industry == "不限") {
industry = "";
industryid.innerText ="应用行业";
}
plus.nativeUI.showWaiting();
mui('.mui-popover').popover('hide');
/*console.log(key);
console.log(subject);
console.log(industry);
console.log(address);
console.log(province);
console.log(authentication);*/
expert(key, subject, industry, province, address, authentication, 10, 1);
});
/*学术领域*/
mui(".xsly").on('tap', 'a', function() {
pageNo = 1
key = searchVal.value;
subject = this.innerText;
subjectid.innerText = subject;
document.querySelector('#xsly li a.active').classList.remove('active');
this.classList.add("active");
if(subject == "不限") {
subject = "";
subjectid.innerText="学术领域";
}
/* console.log(key);
console.log(subject);
console.log(industry);
console.log(address);
console.log(province);
console.log(authentication);*/
plus.nativeUI.showWaiting();
mui('.mui-popover').popover('hide');
expert(key, subject, industry, province, address, authentication, 10, 1);
});
/*初始化数据*/
function expert(key, subject, industry, province, address, authentication, pageSize, pageNo) {
//console.log(bigClass)
if(bigClass == 1) {
mui.ajax(baseUrl + '/ajax/professor/pqAPP', {
data: {
"key": key,
"subject": subject,
"industry": industry,
"province": province,
"address": address,
"authType": authentication,
"pageSize": pageSize,
"pageNo": pageNo,
},
dataType: 'json', //数据格式类型
type: 'GET', //http请求类型
timeout: 10000,
success: function(data) {
table.innerHTML = '';
plus.webview.currentWebview().show("slide-in-right",150);
plus.nativeUI.closeWaiting();
var perrid = plus.webview.getWebviewById('../html/search-home.html');
if(perrid){
setTimeout(function() {
perrid.close();
}, 1000);
}
if(data.success && data.data.data != '') {
//mui('#pullup-container').pullRefresh().enablePullupToRefresh();//启用上拉刷新
nodatabox.style.display = 'none';
var datalist = data.data.data;
console.log(data.data.total)
datalistEach(datalist);
mui('#pullrefresh3').pullRefresh().refresh(true);
mui('#pullrefresh3').pullRefresh().scrollTo(0,0);
if(data.data.total
' + title + '' + office + '' + orgName + '' + address + '
' + '' + rlist + '
' + '' + zlist + '
' + '' + item.supportedServices + '
' + '' + item.editProfessor.name + icon + '' + '' + title + '' + office + '' + orgName + '' + address + '
' + '