luyanan 7 ans auparavant
Parent
commit
6b6de1be2e
4 fichiers modifiés avec 174 ajouts et 139 suppressions
  1. 4 4
      app/html/discoverNew.html
  2. 152 128
      app/js/discoverNew.js
  3. 17 6
      app/js/public/mui.pullToRefresh1.js
  4. 1 1
      app/js/setup.js

+ 4 - 4
app/html/discoverNew.html

@ -34,13 +34,13 @@
34 34
				overflow: hidden;
35 35
			}
36 36
			.mui-pull-top-tips.mui-transitioning {
37
				-webkit-transition-duration: 2000ms;
38
				transition-duration: 2000ms;
37
				-webkit-transition-duration: 800ms;
38
				transition-duration: 800ms;
39 39
			}
40 40
			.mui-pull-top-tips .mui-pull-loading {
41 41
				-webkit-backface-visibility: hidden;
42
				/*-webkit-transition-duration: 100ms;
43
				transition-duration: 100ms;*/
42
				-webkit-transition-duration: 600ms;
43
				transition-duration: 600ms;
44 44
				margin: 0;
45 45
			}
46 46
			.mui-pull-top-wrapper .mui-icon.mui-reverse {

+ 152 - 128
app/js/discoverNew.js

@ -1,22 +1,22 @@
1 1
(function($) {
2 2
	//阻尼系数
3
	var arr=[];
3
	var arr = [];
4 4
	var key1 = [];
5 5
	var m = 0;
6
	var deceleration = mui.os.ios ? 0.003 : 0.0009;
7
	$('.mui-scroll-wrapper').scroll({
8
		bounce: false,
9
		indicators: true, //是否显示滚动条
10
		deceleration: deceleration
11
	});
12
	var pullObj={
13
		"0":0,
14
		"1":0,
15
		"2":0,
16
		"3":0,
17
		"4":0,
18
		"5":0,
19
		"6":0
6
		var deceleration = mui.os.ios ? 0.003 : 0.0009;
7
		$('.mui-scroll-wrapper').scroll({
8
			bounce: false,
9
			indicators: true, //是否显示滚动条
10
			deceleration: deceleration
11
		});
12
	var pullObj = {
13
		"0": 0,
14
		"1": 0,
15
		"2": 0,
16
		"3": 0,
17
		"4": 0,
18
		"5": 0,
19
		"6": 0
20 20
	}
21 21
	$.ready(function() {
22 22
		$.plusReady(function() {
@ -127,7 +127,7 @@
127 127
						key1[index] = $(pullRefreshEl).pullToRefresh({
128 128
							down: {
129 129
								callback: function() {
130
									console.log(new Date().getTime() +"a")
130
									console.log(new Date().getTime() + "a")
131 131
									var self = this;
132 132
									//self.refresh(true);
133 133
									setTimeout(function() {
@ -135,64 +135,76 @@
135 135
										ul.innerHTML = "";
136 136
										key1[m].endPullUpToRefresh(true);
137 137
										if(index == 0) {
138
											pullObj["0"]=1;
138
											pullObj["0"] = 1;
139 139
											_this.pageNo.a = 1;
140 140
											_this.colum.a = "";
141 141
											$.ajax(baseUrl + "/data/inc/col_bannerApp.html?ttt=" + new Date().getTime(), {
142
				dataType: 'html', //服务器返回json格式数据
143
				type: "get", //HTTP请求类型
144
				timeout: 10000, //超时时间设置为10秒;
145
				traditional: true,
146
				async: false,
147
				success: function(data) {
148
					document.getElementById("slider1").innerHTML = data;
149
					for(var i=1;i<6;i++) {
150
						arr=[];
151
						arr.push(document.getElementById("slider1").getElementsByClassName("mui-slider-item")[i].getAttribute("data-id"));
152
					var slider = $("#slider1");
153
					slider.slider({
154
						interval: 5000
155
					});
156
					}
157
					
158
				},
159
				error: function(xhr, type, errorThrown) {
160
					//plus.nativeUI.toast("服务器链接超时", toastStyle);
161
				}
162
			});
163
											$D({
164
												"fun": ob.createFragment,
165
												data: {
166
													col: 9,
167
													pageNo: 1
142
												dataType: 'html', //服务器返回json格式数据
143
												type: "get", //HTTP请求类型
144
												timeout: 10000, //超时时间设置为10秒;
145
												traditional: true,
146
												async: true,
147
												success: function(data) {
148
													document.getElementById("slider1").parentNode.removeChild(document.getElementById("slider1"));
149
													var odiv = document.createElement("div");
150
													odiv.id = "slider1";
151
													odiv.className = "mui-slider columnImg";
152
													document.getElementById("dd").insertBefore(odiv, document.getElementById("list"))
153
													document.getElementById("slider1").innerHTML = data;
154
													arr = [];
155
													for(var i = 0; i < 5; i++) {
156
														arr.push(document.getElementById("slider1").getElementsByClassName("mui-slider-item")[i].getAttribute("data-id"));
157
													}
158
													var slider = $("#slider1");
159
													slider.slider({
160
														interval: 5000
161
													});
162
													$("#slider1").on("tap", "a", function() {
163
														plus.nativeUI.showWaiting();
164
														var id = this.parentNode.getAttribute("data-id");
165
														var col = this.parentNode.getAttribute("col-id");
166
														aiticl(id)
167
														addClick1(col);
168
													})
169
													$D({
170
														"fun": ob.createFragment,
171
														data: {
172
															col: 9,
173
															pageNo: 1
174
														},
175
														flag: 1,
176
														url: "/ajax/article/find"
177
													});
168 178
												},
169
												flag: 1,
170
												url: "/ajax/article/find"
179
												error: function(xhr, type, errorThrown) {
180
													//plus.nativeUI.toast("服务器链接超时", toastStyle);
181
												}
171 182
											});
183
172 184
										} else {
173
											pullObj[index]=1;
185
											pullObj[index] = 1;
174 186
											_this.pageNo[index] = 1;
175 187
											_this.colum[index + 2] = index + 2;
188
189
											console.log(new Date().getTime() + "b")
190
											$D({
191
												"fun": _this.createFragment,
192
												data: {
193
													col: index ? _this.colum[index + 2] : _this.colum.a,
194
													pageNo: 1,
195
													exclude: arr,
196
												},
197
												url: "/ajax/article/find"
198
											});
176 199
										}
177
									console.log(new Date().getTime() +"b")
178
										$D({
179
											"fun": _this.createFragment,
180
											data: {
181
												col: index ? _this.colum[index + 2] : _this.colum.a,
182
												pageNo: 1,
183
												exclude:arr,
184
											},
185
											url: "/ajax/article/find"
186
										});
187 200
									}, 1000);
188
									
189 201
190
									console.log(new Date().getTime() +"c")
202
									console.log(new Date().getTime() + "c")
191 203
								}
192 204
193 205
							},
194 206
							up: {
195
								
207
196 208
								callback: function() {
197 209
									var self = this;
198 210
									setTimeout(function() {
@ -210,7 +222,7 @@
210 222
											data: {
211 223
												col: index ? _this.colum[index + 2] : _this.colum.a,
212 224
												pageNo: pa,
213
												exclude:arr
225
												exclude: arr
214 226
											},
215 227
											url: "/ajax/article/find"
216 228
										});
@ -264,36 +276,39 @@
264 276
								$data.length = 1;
265 277
							}
266 278
						}
279
267 280
						for(var i = 0; i < $data.length; i++) {
268 281
							var of ;
269 282
							if($data[i].articleType == 1) { of = 1;
270 283
							} else { of = 2;
271 284
							}
272 285
							var arImg = "../images/default-artical.jpg";
273
							
286
274 287
							if($data[i].articleImg) {
275
								arImg = baseUrl + "/data/article/" + $data[i].articleImg.replace(".","_s.")
288
								arImg = baseUrl + "/data/article/" + $data[i].articleImg.replace(".", "_s.")
276 289
							}
277 290
							var title = $data[i].articleTitle;
278 291
							var colSpan = "";
279 292
							if(m == 0) {
280 293
								if(arguments[1]) {
294
281 295
									colSpan = '<span class="column">置顶</span>'
282 296
								} else {
283
									if(pullObj["0"]==1) {
284
										
297
298
									if(pullObj["0"] == 1) {
299
285 300
										key1[m].endPullDownToRefresh();
286
										pullObj[m]=0;
287
									} 									
288
									if($data[i].colNum != 0){	
289
											colSpan = "<span class='column columnOther'>" + columnType[$data[i].colNum].shortName + "</span>"
301
										pullObj[m] = 0;
302
									}
303
									if($data[i].colNum != 0) {
304
										colSpan = "<span class='column columnOther'>" + columnType[$data[i].colNum].shortName + "</span>"
290 305
									}
291 306
								}
292
							}else{
293
								if(pullObj[m]==1) {
294
										key1[m].endPullDownToRefresh();
295
										pullObj[m]=0;
296
									} 
307
							} else {
308
								if(pullObj[m] == 1) {
309
									key1[m].endPullDownToRefresh();
310
									pullObj[m] = 0;
311
								}
297 312
							}
298 313
							var li = document.createElement("li");
299 314
							li.setAttribute("data-id", $data[i].articleId);
@ -311,17 +326,12 @@
311 326
								if(document.getElementsByTagName("ul")[m].children[0]) {
312 327
									document.getElementsByTagName("ul")[m].insertBefore(li, document.getElementsByTagName("ul")[m].children[0])
313 328
								} else {
314
									if(arr.length==6) {
315
										arr[5]=$data[i].articleId;
316
									}else{
317
										arr.push($data[i].articleId);
318
									}
319
									
320 329
									document.getElementsByTagName("ul")[m].appendChild(li);
321 330
								}
322 331
							} else {
323 332
								document.getElementsByTagName("ul")[m].appendChild(li);
324 333
							}
334
325 335
							if( of == 1) {
326 336
								li.setAttribute("owner-id", $data[i].professorId);
327 337
								li.setAttribute("data-type", 1);
@ -342,6 +352,21 @@
342 352
								});
343 353
							}
344 354
						}
355
356
						if(arguments[1]) {
357
							arr.push($data[0].articleId);
358
							console.log(arr + "   273");
359
							$D({
360
								"fun": ob.createFragment,
361
								data: {
362
									col: "",
363
									pageNo: 1,
364
									exclude: arr
365
								},
366
								url: "/ajax/article/find"
367
							});
368
369
						}
345 370
						if(!arguments[1]) {
346 371
							document.getElementsByClassName("nodatabox")[m].classList.add("displayNone");
347 372
							if(data.data.data.length == 0) {
@ -364,7 +389,7 @@
364 389
			$D().bindEvent();
365 390
			var ob = $D();
366 391
			//alert(ob.createFragment)
367
			
392
368 393
			document.querySelector('#slider').addEventListener('slide', function(event) {
369 394
370 395
				var $this = document.querySelector(".mui-scroll .mui-active");
@ -397,54 +422,53 @@
397 422
					});
398 423
				}
399 424
			})
400
			$.ajax(baseUrl + "/data/inc/col_bannerApp.html?ttt=" + new Date().getTime(), {
401
				dataType: 'html', //服务器返回json格式数据
402
				type: "get", //HTTP请求类型
403
				timeout: 10000, //超时时间设置为10秒;
404
				traditional: true,
405
				async: false,
406
				success: function(data) {
407
					//alert(JSON.stringify(data))
408
					document.getElementById("slider1").innerHTML = data;
409
					for(var i=1;i<6;i++) {
410
						arr.push(document.getElementById("slider1").getElementsByClassName("mui-slider-item")[i].getAttribute("data-id"));
411
					}
412
					var slider = $("#slider1");
413
					slider.slider({
414
						interval: 5000
415
					});
416
					$("#slider1").on("tap", "a", function() {
417
						plus.nativeUI.showWaiting();
418
						var id = this.parentNode.getAttribute("data-id");
419
						var col = this.parentNode.getAttribute("col-id");
420
						aiticl(id)
421
						addClick1(col);
422
					})
423
				},
424
				error: function(xhr, type, errorThrown) {
425
					//plus.nativeUI.toast("服务器链接超时", toastStyle);
426
				}
427
			});
428
			
429
			$D({
430
				"fun": ob.createFragment,
431
				data: {
432
					col: 9,
433
					pageNo: 1
434
				},
435
				flag: 1,
436
				url: "/ajax/article/find"
437
			});
438
			console.log(arr)
439
			$D({
440
				"fun": ob.createFragment,
441
				data: {
442
					col: "",
443
					pageNo: ob.pageNo.a,
444
					exclude:arr
425
			$.ajax(baseUrl + "/data/inc/col_bannerApp.html?ttt=" + new Date().getTime(), {
426
				dataType: 'html', //服务器返回json格式数据
427
				type: "get", //HTTP请求类型
428
				timeout: 10000, //超时时间设置为10秒;
429
				traditional: true,
430
				async: true,
431
				success: function(data) {
432
					//alert(JSON.stringify(data))
433
					document.getElementById("slider1").innerHTML = data;
434
					for(var i = 0; i < 5; i++) {
435
						arr.push(document.getElementById("slider1").getElementsByClassName("mui-slider-item")[i].getAttribute("data-id"));
436
					}
437
					$D({
438
						"fun": ob.createFragment,
439
						data: {
440
							col: 9,
441
							pageNo: 1
442
						},
443
						flag: 1,
444
						url: "/ajax/article/find",
445
					});
446
					var slider = $("#slider1");
447
					slider.slider({
448
						interval: 5000
449
					});
450
					$("#slider1").on("tap", "a", function() {
451
						plus.nativeUI.showWaiting();
452
						var id = this.parentNode.getAttribute("data-id");
453
						var col = this.parentNode.getAttribute("col-id");
454
						aiticl(id)
455
						addClick1(col);
456
					})
445 457
				},
446
				url: "/ajax/article/find"
458
				error: function(xhr, type, errorThrown) {
459
					//plus.nativeUI.toast("服务器链接超时", toastStyle);
460
				}
447 461
			});
462
463
			//			$D({
464
			//				"fun": ob.createFragment,
465
			//				data: {
466
			//					col: "",
467
			//					pageNo: ob.pageNo.a,
468
			//					exclude:arr
469
			//				},
470
			//				url: "/ajax/article/find"
471
			//			});
448 472
			function addClick1(colId) {
449 473
				$.ajax(baseUrl + "/ajax/operation/statist/bannerClick", {
450 474
					dataType: 'json', //服务器返回json格式数据
@ -461,7 +485,7 @@
461 485
				});
462 486
			}
463 487
464
			function aiticl(id) { 
488
			function aiticl(id) {
465 489
				$.ajax(baseUrl + "/ajax/article/query", {
466 490
					dataType: 'json', //服务器返回json格式数据
467 491
					type: "get", //HTTP请求类型
@ -498,4 +522,4 @@
498 522
			}
499 523
		})
500 524
	})
501
})(mui)
525
})(mui)

+ 17 - 6
app/js/public/mui.pullToRefresh1.js

@ -350,18 +350,29 @@
350 350
			this.options.up.callback.apply(this);
351 351
		},
352 352
		endPullDownToRefresh: function() {
353
			var self=this;
353 354
			this.loading = false;
354 355
			this.pullUpTips && this.pullUpTips.classList.remove(CLASS_HIDDEN);
355 356
			this.pullDownTips.classList.add(CLASS_TRANSITIONING);
356
			this.pullDownTips.style.webkitTransform = 'translate3d(0,0,0)';
357
			if (this.deltaY <= 0) {
358
				this.removePullDownTips();
357
			//alert( this.pullDownTips.innerHTML)
358
			
359
			//this.pullDownTips.scrollTo(-50px, 500);
360
				//this.pullDownTips.style.webkitTransform = 'translate3d(0,0,0)';
361
			
362
			this.pullDownTips.style.webkitTransition = "height 300ms ease";
363
			this.pullDownTips.style.height=0+"px";
364
			//this.pullDownTips.style.webkitTransition="all 0 ease 0";
365
			setTimeout(function(){
366
				if (self.deltaY <= 0) {
367
				self.removePullDownTips();
359 368
			} else {
360
				this.removing = true;
369
				self.removing = true;
361 370
			}
362
			if (this.isInScroll) {
363
				$(this.element.parentNode).scroll().refresh();
371
			if (self.isInScroll) {
372
				$(self.element.parentNode).scroll().refresh();
364 373
			}
374
			},30)
375
			
365 376
		},
366 377
		endPullUpToRefresh: function(finished) {
367 378
			if (finished) {

+ 1 - 1
app/js/setup.js

@ -112,7 +112,7 @@ mui.ready(function() {
112 112
										return;
113 113
									}
114 114
								try {
115
									     plus.nativeUI.showWaiting("检测更新...");
115
									     plus.nativeUI.showWaiting("正在下载...");
116 116
									     //var d="http://192.168.3.233/download/app1.0.6.apk";
117 117
										 plus.downloader.createDownload( data.wgt, {filename:"_doc/update/"}, function(d,status){
118 118
									        if ( status == 200 ) {