浏览代码

搜索修改

xuchunyang 8 年之前
父节点
当前提交
4644e899ef
共有 3 个文件被更改,包括 48 次插入14 次删除
  1. 2 1
      app/css/app.css
  2. 3 3
      app/html/search-home.html
  3. 43 10
      app/js/searchhome.js

+ 2 - 1
app/css/app.css

261
.verified{ color: #FF9900;}
261
.verified{ color: #FF9900;}
262
.authword{ padding:2px 6px; margin-left:6px; background: #FF9900; border-radius:4px; color: #FFFFFF; font-size: 12px;}
262
.authword{ padding:2px 6px; margin-left:6px; background: #FF9900; border-radius:4px; color: #FFFFFF; font-size: 12px;}
263
/*我的关注*/
263
/*我的关注*/
264
.fixbox{ background: #FFFFFF;}
264
.fixbox{ background: #FFFFFF; position:fixed;top:45px;left:0;width:100%; z-index:1;}
265
.fixbox .fixbtn{ padding:0; margin: 0; overflow: hidden;}
265
.fixbox .fixbtn{ padding:0; margin: 0; overflow: hidden;}
266
.fixbox .fixbtn li{ list-style: none; float: left; padding:6px 10px; border-bottom:1px solid #F0F0F0;text-align: center;font-size: 14px;height: 32px;}
266
.fixbox .fixbtn li{ list-style: none; float: left; padding:6px 10px; border-bottom:1px solid #F0F0F0;text-align: center;font-size: 14px;height: 32px;}
267
.fixbox .fixbtn li:first-child{ border-right:1px solid #F0F0F0;}
267
.fixbox .fixbtn li:first-child{ border-right:1px solid #F0F0F0;}
268
.fixbox .fixbtn li.liactive{ color: #FF9900;border-bottom-color: #FF9900;}
268
.fixbox .fixbtn li.liactive{ color: #FF9900;border-bottom-color: #FF9900;}
269
.childlist{ display: none;}
269
.childlist{ display: none;}
270
.alllist{ margin-top: 45px;}
270
/*合作历史及评价*/
271
/*合作历史及评价*/
271
.lefthead{ margin-right: 10px; text-align:center;}
272
.lefthead{ margin-right: 10px; text-align:center;}
272
.contit{ position:relative;}
273
.contit{ position:relative;}

+ 3 - 3
app/html/search-home.html

29
	</header>
29
	</header>
30
	
30
	
31
    <!-- 主页面内容容器 -->
31
    <!-- 主页面内容容器 -->
32
    <div class="mui-content">
32
    <div class="mui-content" id="dd">
33
    	<!-- 主界面具体展示内容 -->
33
    	<!-- 主界面具体展示内容 -->
34
    	<div class="historybox" style=" position: absolute; top:45px;left:0; z-index:2; " id="historybox">
34
    	<div class="historybox" style=" position: absolute; top:45px;left:0; z-index:2; " id="historybox">
35
			<!--<ul class="hisrecord">
35
			<!--<ul class="hisrecord">
91
				url: '../html/search.html',
91
				url: '../html/search.html',
92
				id: '../html/search.html',
92
				id: '../html/search.html',
93
				show:{
93
				show:{
94
			      autoShow:true,
94
			      autoShow:false,
95
			      aniShow:"fade-in",
95
			      aniShow:"fade-in",
96
			    },
96
			    },
97
				extras:{
97
				extras:{
111
					url: '../html/search.html',
111
					url: '../html/search.html',
112
					id: '../html/search.html',
112
					id: '../html/search.html',
113
					show:{
113
					show:{
114
				      autoShow:true,
114
				      autoShow:false,
115
				      aniShow:"fade-in",
115
				      aniShow:"fade-in",
116
				    },
116
				    },
117
					extras:{
117
					extras:{

+ 43 - 10
app/js/searchhome.js

9
	address = "",
9
	address = "",
10
	authentication = "",
10
	authentication = "",
11
	pageSize = 0,
11
	pageSize = 0,
12
	pageNo = 1
12
	pageNo = 1;
13
var showblock = document.getElementById("li_show");
13
var showblock = document.getElementById("li_show");
14
var selectblock = document.getElementById("div_select");
14
var selectblock = document.getElementById("div_select");
15
var searchVal = document.getElementById("searchval");
15
var searchVal = document.getElementById("searchval");
25
			container: '#pullrefresh',
25
			container: '#pullrefresh',
26
			up: {
26
			up: {
27
				contentrefresh: '正在加载...',
27
				contentrefresh: '正在加载...',
28
				callback: pullupRefresh
28
				callback: pullupRefresh,
29
				auto:true
29
			}
30
			}
30
		}
31
		}
31
});
32
});
37
	setTimeout(function() {
38
	setTimeout(function() {
38
		expert2(key, subject, industry, province, address, authentication, 10, pageNo)
39
		expert2(key, subject, industry, province, address, authentication, 10, pageNo)
39
	}, 1000);
40
	}, 1000);
41
	mui('#pullrefresh').pullRefresh().refresh(true);
40
}
42
}
41

43

42
if(mui.os.plus) {
44
if(mui.os.plus) {
79
    }
81
    }
80
	//var perrid = plus.webview.getWebviewById('../html/search-home.html');
82
	//var perrid = plus.webview.getWebviewById('../html/search-home.html');
81
	//perrid.close();
83
	//perrid.close();
84
	
82
    expert(key, subject, industry, province, address, authentication, 10, 1);	
85
    expert(key, subject, industry, province, address, authentication, 10, 1);	
83
})
86
})
84

87

88
});
91
});
89

92

90
mui("#li_show").on('tap', 'li', function() {
93
mui("#li_show").on('tap', 'li', function() {
94
	pageNo = 1
91
	bigClass = this.getAttribute("data-num");
95
	bigClass = this.getAttribute("data-num");
92
	selectblock.innerHTML = this.innerHTML;
96
	selectblock.innerHTML = this.innerHTML;
93
	showblock.style.display = 'none';
97
	showblock.style.display = 'none';
99
searchval.addEventListener("keyup", function() {
103
searchval.addEventListener("keyup", function() {
100
	var e = event || window.event || arguments.caller.arguments[0];
104
	var e = event || window.event || arguments.caller.arguments[0];
101
	if(e.keyCode == 13) {
105
	if(e.keyCode == 13) {
106
		pageNo = 1
102
		key = searchVal.value;
107
		key = searchVal.value;
108
		console.log(key);
109
	console.log(subject);
110
	console.log(industry);
111
	console.log(address);
112
	console.log(province);
113
	console.log(authentication);
103
		plus.nativeUI.showWaiting();
114
		plus.nativeUI.showWaiting();
115

104
		expert(key, subject, industry, province, address, authentication, 10, 1);
116
		expert(key, subject, industry, province, address, authentication, 10, 1);
105
	}
117
	}
106
})
118
})
165

177

166
/*应用行业*/
178
/*应用行业*/
167
mui(".yyhy").on('tap', 'a', function() {
179
mui(".yyhy").on('tap', 'a', function() {
180
	pageNo = 1
168
	key = searchVal.value;
181
	key = searchVal.value;
169
	industry = this.innerText;
182
	industry = this.innerText;
170
	document.getElementById("industryid").innerText = industry;
183
	document.getElementById("industryid").innerText = industry;
186

199

187
/*学术领域*/
200
/*学术领域*/
188
mui(".xsly").on('tap', 'a', function() {
201
mui(".xsly").on('tap', 'a', function() {
202
	pageNo = 1
189
	key = searchVal.value;
203
	key = searchVal.value;
190
	subject = this.innerText;
204
	subject = this.innerText;
191
	document.getElementById("subjectid").innerText = subject;
205
	document.getElementById("subjectid").innerText = subject;
226
			success: function(data) {
240
			success: function(data) {
227
				table.innerHTML = '';
241
				table.innerHTML = '';
228
				plus.nativeUI.closeWaiting();
242
				plus.nativeUI.closeWaiting();
243
				plus.webview.currentWebview().show();
229
				if(data.success && data.data.data != '') {
244
				if(data.success && data.data.data != '') {
230
					var datalist = data.data.data;
245
					var datalist = data.data.data;
246
					console.log(data.data.total)
231
					datalistEach(datalist);
247
					datalistEach(datalist);
248
					mui('#pullrefresh').pullRefresh().refresh(true);
249
	                mui('#pullrefresh').pullRefresh().scrollTo(0,0,0);
232
				} else {
250
				} else {
233
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
251
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
234
				}
252
				}
258
				if(data.success && data.data.data != '') {
276
				if(data.success && data.data.data != '') {
259
					var datalist = data.data.data;
277
					var datalist = data.data.data;
260
					resourcesEach(datalist);
278
					resourcesEach(datalist);
279
					mui('#pullrefresh').pullRefresh().refresh(true);
280
	                mui('#pullrefresh').pullRefresh().scrollTo(0,0,0);
261
				} else {
281
				} else {
262
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
282
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
263
				}
283
				}
267
			}
287
			}
268
		});
288
		});
269
	}
289
	}
290
	
291
	
270

292

271
}
293
}
272

294

274
function expert2(key, subject, industry, province, address, authentication, pageSize, pageNo) {
296
function expert2(key, subject, industry, province, address, authentication, pageSize, pageNo) {
275
	//console.log(pageNo)
297
	//console.log(pageNo)
276
	//console.log(bigClass);
298
	//console.log(bigClass);
299
	console.log(pageNo);
277
	if(bigClass == 1) {
300
	if(bigClass == 1) {
278
		mui.ajax(baseUrl + '/ajax/professor/pqAPP', {
301
		mui.ajax(baseUrl + '/ajax/professor/pqAPP', {
279
			data: {
302
			data: {
289
			dataType: 'json', //数据格式类型
312
			dataType: 'json', //数据格式类型
290
			type: 'GET', //http请求类型
313
			type: 'GET', //http请求类型
291
			timeout: 10000,
314
			timeout: 10000,
292
			async: false,
293
			success: function(data) {
315
			success: function(data) {
294
				plus.nativeUI.closeWaiting();
316
				plus.nativeUI.closeWaiting();
295
				if(data.success && data.data.data != '') {
317
				if(data.success && data.data.data != '') {
297
					var datalist = data.data.data;
319
					var datalist = data.data.data;
298
					var dice1 = data.data.total; //总条数
320
					var dice1 = data.data.total; //总条数
299
					var dice2 = data.data.pageSize; //每页条数
321
					var dice2 = data.data.pageSize; //每页条数
300
					if(pageNo == 1) { //下拉刷新需要先清空数据
322
					console.log(dice1);
323
					console.log(dice2);
324
					allPages = Math.ceil(dice1 / dice2);
325
					if(allPages == 1) { //下拉刷新需要先清空数据
301
						table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
326
						table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
302
					}
327
					}
303
					allPages = dice1 / dice2;
328
					console.log(allPages);
304
					var datalist = data.data.data;
329
					var datalist = data.data.data;
305
					datalistEach(datalist);
330
					datalistEach(datalist);
331
					mui('#pullrefresh').pullRefresh().refresh(true);//重置上拉加载
306
					if(pageNo < allPages) {
332
					if(pageNo < allPages) {
307
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
333
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
308
					} else {
334
					} else {
311

337

312
				} else {
338
				} else {
313
					mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新
339
					mui('#pullrefresh').pullRefresh().disablePullupToRefresh(); //没有数据禁止上拉刷新
340
					
314
					table.innerHTML = '';
341
					table.innerHTML = '';
315
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
342
					plus.nativeUI.toast("抱歉,没有找到对应的搜索", toastStyle);
316
				}
343
				}
335
			dataType: 'json', //数据格式类型
362
			dataType: 'json', //数据格式类型
336
			type: 'GET', //http请求类型
363
			type: 'GET', //http请求类型
337
			timeout: 10000,
364
			timeout: 10000,
338
			async: false,
365
			
339
			success: function(data) {
366
			success: function(data) {
340
				plus.nativeUI.closeWaiting();
367
				plus.nativeUI.closeWaiting();
341
				if(data.success && data.data.data != '') {
368
				if(data.success && data.data.data != '') {
343
					var datalist = data.data.data;
370
					var datalist = data.data.data;
344
					var dice1 = data.data.total; //总条数
371
					var dice1 = data.data.total; //总条数
345
					var dice2 = data.data.pageSize; //每页条数
372
					var dice2 = data.data.pageSize; //每页条数
346
					if(pageNo == 1) { //下拉刷新需要先清空数据
373
					allPages = Math.ceil(dice1 / dice2);
374
					if(allPages == 1) { //下拉刷新需要先清空数据
347
						table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
375
						table.innerHTML = ''; // 在这里清空可以防止刷新时白屏
348
					}
376
					}
349
					allPages = dice1 / dice2;
350
					var datalist = data.data.data;
377
					var datalist = data.data.data;
351
					resourcesEach(datalist);
378
					resourcesEach(datalist);
379
					mui('#pullrefresh').pullRefresh().refresh(true);
352
					if(pageNo < allPages) {
380
					if(pageNo < allPages) {
353
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
381
						mui('#pullrefresh').pullRefresh().endPullupToRefresh(false); //能上拉
354
					} else {
382
					} else {
367
			}
395
			}
368
		});
396
		});
369
	}
397
	}
370

398
		
371
}
399
}
372

400

373
/*专家数据遍历*/
401
/*专家数据遍历*/
374
function datalistEach(datalist) {
402
function datalistEach(datalist) {
375
	mui.each(datalist, function(index, item) {
403
	mui.each(datalist, function(index, item) {
404
		
405
		
376
		/*获取头像*/
406
		/*获取头像*/
377
		if(item.hasHeadImage == 1) {
407
		if(item.hasHeadImage == 1) {
378
			var img = baseUrl + "/images/head/" + item.id + "_m.jpg";
408
			var img = baseUrl + "/images/head/" + item.id + "_m.jpg";
401
		for(var m = 0; m < resources.length; m++) {
431
		for(var m = 0; m < resources.length; m++) {
402
			zlist = '<span>' + resources[m].resourceName + '</span>、';
432
			zlist = '<span>' + resources[m].resourceName + '</span>、';
403
		}
433
		}
404

434
		
435
		//var title;
436
		//(item.title != '') ? title = item.title + " , " : title = '';
437
		
405
		var title = item.title || "";
438
		var title = item.title || "";
406
		var office = item.office || "";
439
		var office = item.office || "";
407
		var orgName = item.orgName || "";
440
		var orgName = item.orgName || "";