luyanan 7 年之前
父节点
当前提交
1d889e7565
共有 2 个文件被更改,包括 154 次插入129 次删除
  1. 16 55
      app/html/discoverNew.html
  2. 138 74
      app/js/discoverNew.js

+ 16 - 55
app/html/discoverNew.html

@ -9,6 +9,18 @@
9 9
		<link href="../css/app.css" rel="stylesheet" />
10 10
		<link href="../css/iconfont.css" rel="stylesheet" />
11 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 24
			.mui-bar~.mui-content .mui-fullscreen {
13 25
				top: 44px;
14 26
				height: auto;
@ -51,14 +63,14 @@
51 63
			}
52 64
			.mui-pull-bottom-tips {
53 65
				text-align: center;
54
				background-color: #efeff4;
66
				/*background-color: #efeff4;*/
55 67
				font-size: 15px;
56 68
				line-height: 40px;
57 69
				color: #777;
58 70
			}
59 71
			.mui-pull-top-canvas {
60 72
				overflow: hidden;
61
				background-color: #fafafa;
73
				/*background-color: #fafafa;*/
62 74
				border-radius: 40px;
63 75
				box-shadow: 0 4px 10px #bbb;
64 76
				width: 40px;
@ -69,7 +81,7 @@
69 81
				width: 40px;
70 82
			}
71 83
			.mui-slider-indicator.mui-segmented-control {
72
				background-color: #efeff4;
84
				/*background-color: #efeff4;*/
73 85
			}
74 86
			.sizefont{
75 87
				font-size:16px;
@ -116,58 +128,7 @@
116 128
						<div id="scroll1" class="mui-scroll-wrapper">
117 129
							<div class="mui-scroll" id="dd">
118 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 132
								<ul class="mui-table-view" id="list">
172 133
									<!--<li class="mui-table-view-cell">
173 134
							<div class="flexCenter OflexCenter mui-clearfix">

+ 138 - 74
app/js/discoverNew.js

@ -1,57 +1,54 @@
1 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 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 52
			var oWidth = getViewportSize().width;
56 53
57 54
			function getViewportSize() {
@ -102,7 +99,6 @@
102 99
						traditional: true,
103 100
						async: true,
104 101
						success: function(data) {
105
							console.log(JSON.stringify(data));
106 102
							if(obj.sele) {
107 103
								obj.fun.call(obj.sele, data);
108 104
							} else {
@ -182,6 +178,7 @@
182 178
							}
183 179
						});
184 180
					});
181
185 182
					mui("#slider").on("tap", "li", function() {
186 183
						var id = this.getAttribute("data-id");
187 184
						var datatype = this.getAttribute("data-type");
@ -201,6 +198,7 @@
201 198
							});
202 199
						}
203 200
					})
201
204 202
				},
205 203
				proName: function(data) {
206 204
					if(data.success) {
@ -218,6 +216,7 @@
218 216
					}
219 217
				},
220 218
				createFragment: function(data) {
219
					if(data.success) {
221 220
					if(!arguments[1]) {
222 221
						document.getElementsByClassName("nodatabox")[m].classList.add("displayNone");
223 222
						if(data.data.data.length == 0) {
@ -248,15 +247,15 @@
248 247
							arImg = baseUrl + "/data/article/" + $data[i].articleImg
249 248
						}
250 249
						var title = $data[i].articleTitle;
251
						var colSpan="";
252
						if(m==0) {
250
						var colSpan = "";
251
						if(m == 0) {
253 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 260
						var li = document.createElement("li");
262 261
						li.setAttribute("data-id", $data[i].articleId);
@ -266,7 +265,7 @@
266 265
							'<div class="madiaHead artHead" style="background-image:url(' + arImg + ')"></div>' +
267 266
							'<div class="madiaInfo OmadiaInfo">' +
268 267
							'<p class="mui-ellipsis-2 h1Font">' + title + '</p>' +
269
							'<p class="h2Font mui-ellipsis">' +colSpan+
268
							'<p class="h2Font mui-ellipsis">' + colSpan +
270 269
							'<span class="nameSpan" style="margin-right:10px"></span>' +
271 270
							'<span class="time">' + commenTime($data[i].publishTime) + '</span>' +
272 271
							'</p>' +
@ -302,6 +301,7 @@
302 301
						}
303 302
					}
304 303
				}
304
					}
305 305
			}
306 306
			Discover.prototype.Init.prototype = Discover.prototype;
307 307
			var $D = Discover;
@ -357,19 +357,83 @@
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 439
})(mui)