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,12 +261,13 @@ body{ color: #666666; font-size:14px;}
261 261
.verified{ color: #FF9900;}
262 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 265
.fixbox .fixbtn{ padding:0; margin: 0; overflow: hidden;}
266 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 267
.fixbox .fixbtn li:first-child{ border-right:1px solid #F0F0F0;}
268 268
.fixbox .fixbtn li.liactive{ color: #FF9900;border-bottom-color: #FF9900;}
269 269
.childlist{ display: none;}
270
.alllist{ margin-top: 45px;}
270 271
/*合作历史及评价*/
271 272
.lefthead{ margin-right: 10px; text-align:center;}
272 273
.contit{ position:relative;}

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

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

+ 43 - 10
app/js/searchhome.js

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

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

@ -88,6 +91,7 @@ selectblock.addEventListener('tap', function() {
88 91
});
89 92

90 93
mui("#li_show").on('tap', 'li', function() {
94
	pageNo = 1
91 95
	bigClass = this.getAttribute("data-num");
92 96
	selectblock.innerHTML = this.innerHTML;
93 97
	showblock.style.display = 'none';
@ -99,8 +103,16 @@ mui("#li_show").on('tap', 'li', function() {
99 103
searchval.addEventListener("keyup", function() {
100 104
	var e = event || window.event || arguments.caller.arguments[0];
101 105
	if(e.keyCode == 13) {
106
		pageNo = 1
102 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 114
		plus.nativeUI.showWaiting();
115

104 116
		expert(key, subject, industry, province, address, authentication, 10, 1);
105 117
	}
106 118
})
@ -165,6 +177,7 @@ mui("#addressval").on('tap', 'a', function() {
165 177

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

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

271 293
}
272 294

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

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

398
		
371 399
}
372 400

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

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