luyanan 7 years ago
parent
commit
1d889e7565
2 changed files with 154 additions and 129 deletions
  1. 16 55
      app/html/discoverNew.html
  2. 138 74
      app/js/discoverNew.js

+ 16 - 55
app/html/discoverNew.html

9
		<link href="../css/app.css" rel="stylesheet" />
9
		<link href="../css/app.css" rel="stylesheet" />
10
		<link href="../css/iconfont.css" rel="stylesheet" />
10
		<link href="../css/iconfont.css" rel="stylesheet" />
11
		<style type="text/css">
11
		<style type="text/css">
12
			html,
13
			body {
14
				height: 100%;
15
				margin: 0;
16
				padding: 0px;
17
				overflow: hidden;
18
			}
19
			
20
			.mui-content {
21
				height: 100%;
22
				overflow: auto;
23
			}
12
			.mui-bar~.mui-content .mui-fullscreen {
24
			.mui-bar~.mui-content .mui-fullscreen {
13
				top: 44px;
25
				top: 44px;
14
				height: auto;
26
				height: auto;
51
			}
63
			}
52
			.mui-pull-bottom-tips {
64
			.mui-pull-bottom-tips {
53
				text-align: center;
65
				text-align: center;
54
				background-color: #efeff4;
66
				/*background-color: #efeff4;*/
55
				font-size: 15px;
67
				font-size: 15px;
56
				line-height: 40px;
68
				line-height: 40px;
57
				color: #777;
69
				color: #777;
58
			}
70
			}
59
			.mui-pull-top-canvas {
71
			.mui-pull-top-canvas {
60
				overflow: hidden;
72
				overflow: hidden;
61
				background-color: #fafafa;
73
				/*background-color: #fafafa;*/
62
				border-radius: 40px;
74
				border-radius: 40px;
63
				box-shadow: 0 4px 10px #bbb;
75
				box-shadow: 0 4px 10px #bbb;
64
				width: 40px;
76
				width: 40px;
69
				width: 40px;
81
				width: 40px;
70
			}
82
			}
71
			.mui-slider-indicator.mui-segmented-control {
83
			.mui-slider-indicator.mui-segmented-control {
72
				background-color: #efeff4;
84
				/*background-color: #efeff4;*/
73
			}
85
			}
74
			.sizefont{
86
			.sizefont{
75
				font-size:16px;
87
				font-size:16px;
116
						<div id="scroll1" class="mui-scroll-wrapper">
128
						<div id="scroll1" class="mui-scroll-wrapper">
117
							<div class="mui-scroll" id="dd">
129
							<div class="mui-scroll" id="dd">
118
							<div id="slider1" class="mui-slider">
130
							<div id="slider1" class="mui-slider">
119
								<div class="mui-slider-group mui-slider-loop" style="height:210px;">
120
					<!-- 额外增加的一个节点(循环轮播:第一个节点是最后一张轮播) -->
121
					
122
					<div class="mui-slider-item mui-slider-item-duplicate tem" data-id="">
123
						<a href="#"  class="bgImg photoTop" style="background-image:url(../images/yuantiao.jpg);top:135px;">
124
							<p class="mui-slider-title sizefont elipse he">静静看这世界</p>
125
						</a>
126
					</div>
127
					<!--第一张图片-->
128
					<div class="mui-slider-item" data-id="" style="height:210px;">
129
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/shuijiao.jpg);top:105px;height:210px;">
130
							<p class="mui-slider-title sizefont elipse he">幸福就是可以一起睡觉幸福就是可以一起睡觉幸福就是可以一起睡觉幸福就是可以一起睡觉</p>
131
						</a>
132
					</div>
133
					<!--第二张-->
134
					<div class="mui-slider-item" data-id="">
135
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/muwu.jpg);top:135px;">
136
							<p class="mui-slider-title sizefont elipse he">想要一间这样的木屋,静静的喝咖啡</p>
137
						</a>
138
					</div>
139
					<!--第三张-->
140
					<div class="mui-slider-item" data-id="">
141
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/cbd.jpg);top:135px;">
142
							<p class="mui-slider-title sizefont">Color of SIP CBD</p>
143
						</a>
144
					</div>
145
					<!--第四张-->
146
					<div class="mui-slider-item" data-id="">
147
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/yuantiao.jpg);top:135px;">
148
							<p class="mui-slider-title sizefont elipse">去外面看看</p>
149
						</a>
150
					</div>
151
					<!--最后一张-->
152
					<div class="mui-slider-item "data-id="">
153
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/yuantiao.jpg);top:135px;">
154
							<p class="mui-slider-title sizefont elipse">静静看这世界</p>
155
						</a>
156
					</div>
157
					<!--第一张-->
158
					<div class="mui-slider-item mui-slider-item-duplicate" data-id="">
159
						<a href="#" class="bgImg photoTop" style="background-image:url(../images/shuijiao.jpg);top:135px;">
160
							<p class="mui-slider-title sizefont elipse">幸福就是可以一起睡觉幸福就是可以一起睡觉幸福就是可以一起睡觉幸福就是可以一起睡觉</p>
161
						</a>
162
					</div>
163
				</div>
164
				<div class="mui-slider-indicator mui-text-right" style="bottom:30px;">
165
					<div class="mui-indicator mui-active"></div>
166
					<div class="mui-indicator"></div>
167
					<div class="mui-indicator"></div>
168
					<div class="mui-indicator"></div>
169
					<div class="mui-indicator"></div>
170
				</div></div>
131
								</div>
171
								<ul class="mui-table-view" id="list">
132
								<ul class="mui-table-view" id="list">
172
									<!--<li class="mui-table-view-cell">
133
									<!--<li class="mui-table-view-cell">
173
							<div class="flexCenter OflexCenter mui-clearfix">
134
							<div class="flexCenter OflexCenter mui-clearfix">

+ 138 - 74
app/js/discoverNew.js

1
(function($) {
1
(function($) {
2
	//阻尼系数
3
	var key1 = [];
4
	var m = 0;
5
	var deceleration = mui.os.ios ? 0.003 : 0.0009;
6
	$('.mui-scroll-wrapper').scroll({
7
		bounce: false,
8
		indicators: true, //是否显示滚动条
9
		deceleration: deceleration
10
	});
11
	$.ready(function() {
12
		$.plusReady(function() {
2
//阻尼系数
3
var key1 = [];
4
var m = 0;
5
var deceleration = mui.os.ios ? 0.003 : 0.0009;
6
$('.mui-scroll-wrapper').scroll({
7
	bounce: false,
8
	indicators: true, //是否显示滚动条
9
	deceleration: deceleration
10
});
11
$.ready(function() {
12
	$.plusReady(function() {
13
			var columnType = {
13
			var columnType = {
14
	"1":{
15
		fullName:"个人原创",
16
		shortName:"原创"
17
	},
18
	"2":{
19
		fullName:"企业原创",
20
		shortName:"原创"
21
	},
22
	"3":{
23
		fullName:"前沿动态",
24
		shortName:"前沿"
25
	},
26
	"4":{
27
		fullName:"学术经验",
28
		shortName:"经验"
29
	},
30
	"5":{
31
		fullName:"分析检测",
32
		shortName:"检测"
33
	},
34
	"6":{
35
		fullName:"会议培训",
36
		shortName:"会议"
37
	},
38
	"7":{
39
		fullName:"科袖访谈",
40
		shortName:"访谈"
41
	},
42
	"8":{
43
		fullName:"招聘招生",
44
		shortName:"招聘"
45
	},
46
	"9":{
47
		fullName:"重大新闻",
48
		shortName:"新闻"
49
	}	
50
}
51
			var slider = mui("#slider1");
52
			slider.slider({
53
				interval: 5000
54
			});
14
				"1": {
15
					fullName: "个人原创",
16
					shortName: "原创"
17
				},
18
				"2": {
19
					fullName: "企业原创",
20
					shortName: "原创"
21
				},
22
				"3": {
23
					fullName: "前沿动态",
24
					shortName: "前沿"
25
				},
26
				"4": {
27
					fullName: "学术经验",
28
					shortName: "经验"
29
				},
30
				"5": {
31
					fullName: "分析检测",
32
					shortName: "检测"
33
				},
34
				"6": {
35
					fullName: "会议培训",
36
					shortName: "会议"
37
				},
38
				"7": {
39
					fullName: "科袖访谈",
40
					shortName: "访谈"
41
				},
42
				"8": {
43
					fullName: "招聘招生",
44
					shortName: "招聘"
45
				},
46
				"9": {
47
					fullName: "重大新闻",
48
					shortName: "新闻"
49
				}
50
			}
51
55
			var oWidth = getViewportSize().width;
52
			var oWidth = getViewportSize().width;
56
53
57
			function getViewportSize() {
54
			function getViewportSize() {
102
						traditional: true,
99
						traditional: true,
103
						async: true,
100
						async: true,
104
						success: function(data) {
101
						success: function(data) {
105
							console.log(JSON.stringify(data));
106
							if(obj.sele) {
102
							if(obj.sele) {
107
								obj.fun.call(obj.sele, data);
103
								obj.fun.call(obj.sele, data);
108
							} else {
104
							} else {
182
							}
178
							}
183
						});
179
						});
184
					});
180
					});
181
185
					mui("#slider").on("tap", "li", function() {
182
					mui("#slider").on("tap", "li", function() {
186
						var id = this.getAttribute("data-id");
183
						var id = this.getAttribute("data-id");
187
						var datatype = this.getAttribute("data-type");
184
						var datatype = this.getAttribute("data-type");
201
							});
198
							});
202
						}
199
						}
203
					})
200
					})
201
204
				},
202
				},
205
				proName: function(data) {
203
				proName: function(data) {
206
					if(data.success) {
204
					if(data.success) {
218
					}
216
					}
219
				},
217
				},
220
				createFragment: function(data) {
218
				createFragment: function(data) {
219
					if(data.success) {
221
					if(!arguments[1]) {
220
					if(!arguments[1]) {
222
						document.getElementsByClassName("nodatabox")[m].classList.add("displayNone");
221
						document.getElementsByClassName("nodatabox")[m].classList.add("displayNone");
223
						if(data.data.data.length == 0) {
222
						if(data.data.data.length == 0) {
248
							arImg = baseUrl + "/data/article/" + $data[i].articleImg
247
							arImg = baseUrl + "/data/article/" + $data[i].articleImg
249
						}
248
						}
250
						var title = $data[i].articleTitle;
249
						var title = $data[i].articleTitle;
251
						var colSpan="";
252
						if(m==0) {
250
						var colSpan = "";
251
						if(m == 0) {
253
							if(arguments[1]) {
252
							if(arguments[1]) {
254
								colSpan="<span style='border:1px solid red;border-radius:3px;padding:0px 1px;margin-right:5px;color:red;'>置顶</span>"
255
							}else{
256
								if($data[i].colNum!=0)
257
							colSpan="<span style='border:1px solid green;border-radius:3px;padding:0px 1px;margin-right:5px;color:green;'>"+columnType[$data[i].colNum].shortName+"</span>"
253
								colSpan = "<span style='border:1px solid red;border-radius:3px;padding:0px 1px;margin-right:5px;color:red;'>置顶</span>"
254
							} else {
255
								if($data[i].colNum != 0)
256
									colSpan = "<span style='border:1px solid green;border-radius:3px;padding:0px 1px;margin-right:5px;color:green;'>" + columnType[$data[i].colNum].shortName + "</span>"
258
							}
257
							}
259
							
258
260
						}
259
						}
261
						var li = document.createElement("li");
260
						var li = document.createElement("li");
262
						li.setAttribute("data-id", $data[i].articleId);
261
						li.setAttribute("data-id", $data[i].articleId);
266
							'<div class="madiaHead artHead" style="background-image:url(' + arImg + ')"></div>' +
265
							'<div class="madiaHead artHead" style="background-image:url(' + arImg + ')"></div>' +
267
							'<div class="madiaInfo OmadiaInfo">' +
266
							'<div class="madiaInfo OmadiaInfo">' +
268
							'<p class="mui-ellipsis-2 h1Font">' + title + '</p>' +
267
							'<p class="mui-ellipsis-2 h1Font">' + title + '</p>' +
269
							'<p class="h2Font mui-ellipsis">' +colSpan+
268
							'<p class="h2Font mui-ellipsis">' + colSpan +
270
							'<span class="nameSpan" style="margin-right:10px"></span>' +
269
							'<span class="nameSpan" style="margin-right:10px"></span>' +
271
							'<span class="time">' + commenTime($data[i].publishTime) + '</span>' +
270
							'<span class="time">' + commenTime($data[i].publishTime) + '</span>' +
272
							'</p>' +
271
							'</p>' +
302
						}
301
						}
303
					}
302
					}
304
				}
303
				}
304
					}
305
			}
305
			}
306
			Discover.prototype.Init.prototype = Discover.prototype;
306
			Discover.prototype.Init.prototype = Discover.prototype;
307
			var $D = Discover;
307
			var $D = Discover;
357
					});
357
					});
358
				}
358
				}
359
			})
359
			})
360
			$.ajax(baseUrl + "/inc/col_bannerApp.html", {
361
						dataType: 'html', //服务器返回json格式数据
362
						type: "get", //HTTP请求类型
363
						timeout: 10000, //超时时间设置为10秒;
364
						traditional: true,
365
						async: true,
366
						success: function(data) {
367
								document.getElementById("slider1").innerHTML=data;
368
						},
369
						error: function(xhr, type, errorThrown) {
370
							//plus.nativeUI.toast("服务器链接超时", toastStyle);
360
			$.ajax(baseUrl + "/data/inc/col_bannerApp.html?ttt=" +new Date().getTime(), {
361
				dataType: 'html', //服务器返回json格式数据
362
				type: "get", //HTTP请求类型
363
				timeout: 10000, //超时时间设置为10秒;
364
				traditional: true,
365
				async: true,
366
				success: function(data) {
367
					document.getElementById("slider1").innerHTML = data;
368
					var slider = $("#slider1");
369
					slider.slider({
370
						interval: 5000
371
					});
372
					$("#slider1").on("tap", "a", function() {
373
						plus.nativeUI.showWaiting();
374
						var id = this.parentNode.getAttribute("data-id");
375
						var col=this.parentNode.getAttribute("col-id");
376
						aiticl(id)
377
						addClick1(col);
378
					})
379
				},
380
				error: function(xhr, type, errorThrown) {
381
					//plus.nativeUI.toast("服务器链接超时", toastStyle);
382
				}
383
			});
384
385
			function addClick1(colId) {
386
				$.ajax(baseUrl + "/ajax/operation/statist/bannerClick", {
387
					dataType: 'json', //服务器返回json格式数据
388
					type: "post", //HTTP请求类型
389
					timeout: 10000, //超时时间设置为10秒;
390
					data: {
391
						"id": colId
392
					},
393
					traditional: true,
394
					async: true,
395
					success: function(data) {
396
						if(data.success) {
371
						}
397
						}
398
					}
372
					});
399
					});
373
		})
374
	})
400
			}
401
402
			function aiticl(id) {
403
				$.ajax("http://www.ekexiu.com" + "/ajax/article/query", {
404
					dataType: 'json', //服务器返回json格式数据
405
					type: "get", //HTTP请求类型
406
					timeout: 10000, //超时时间设置为10秒;
407
					data: {
408
						"articleId": id
409
					},
410
					traditional: true,
411
					async: true,
412
					success: function(data) {
413
						if(data.success) {
414
							var ownerid;
415
							if(data.data.articleType == 1) {
416
								ownerid = data.data.professorId;
417
								plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
418
									articleId: id,
419
									ownerid: ownerid,
420
								});
421
							} else {
422
								ownerid = data.data.orgId
423
								plus.webview.create("../html/professorArticle.html", '../html/professorArticle.html', {}, {
424
									articleId: id,
425
									ownerid: ownerid,
426
									oFlag: 1
427
								});
428
							}
429
						}
430
431
					},
432
					error: function(xhr, type, errorThrown) {
433
						plus.nativeUI.toast("服务器链接超时", toastStyle);
434
					}
435
				});
436
	}
437
})
438
})
375
})(mui)
439
})(mui)