-
Notifications
You must be signed in to change notification settings - Fork 0
/
daily_content_sub.html
385 lines (363 loc) · 12.1 KB
/
daily_content_sub.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
<title></title>
<script src="js/mui.min.js"></script>
<link href="css/mui.min.css" rel="stylesheet" />
<link href="css/app.css" rel="stylesheet" />
</head>
<body>
<!--每日一练-->
<div class="daily_box">
<div class="daily_title_p">
<div class="daily_title">
<img src="images/daily_title.jpg" />
</div>
</div>
<div class="daily_banner_box">
<div class="daily_banner_p">
<a id="daily_detaileurl" data-id="" href="daily_detaile.html">
<div class="daily_banner">
<img id="daily_yimg" src="" />
</div>
<div id="daily_title" class="daily_title_name">
<!--第二十期:书法练习书法练习书法-->
</div>
<div class="daily_time">
<span id="daily_time"></span>
<!--2017年5月10日-->
<div class="daily_detaile">
浏览/ <span id="daily_browse"></span> 跟帖/ <span id="daily_comments"></span>
</div>
</div>
<div id="daily_zhuozhe" class="daily_time">
作者:良雨
<!--<a href="#">原文链接</a> -->
</div>
</a>
<div class="daily_banner">
<a id="daily_list" href="daily_list.html">
<img src="images/daily_list.jpg" />
</a>
</div>
</div>
</div>
</div>
<!--每日精选-->
<div class="big_box">
<div class="big_box_p">
<div class="jx_title_p">
<div class="jx_title">
<img src="images/jx_title.jpg" />
</div>
</div>
</div>
</div>
<!--下拉刷新容器-->
<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
<div class="mui-scroll">
<div class="recommended_box">
<div class="recommended_box_p">
<div id="hot" class="recommended_list_box">
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" charset="utf-8">
var contentimg = '';
mui('.daily_banner_box').on('tap', 'a', function() {
var href = this.getAttribute('href');
var detaileid = this.getAttribute('data-id');
mui.openWindow({
url: href,
id: href,
extras: {
detaileid: detaileid,
contentimg :contentimg
}
});
});
mui.plusReady(function() {
mui.init({
pullRefresh: {
container: '#pullrefresh',
down: {
callback: pulldownRefresh
},
up: {
contentrefresh: '正在加载...',
callback: pullupRefresh
}
}
});
// 每日一练
var self = plus.webview.currentWebview();
var contentid = self.contentid;
var url = "http://www.zjliang.com/index.php/Gapi/daily/detaile/";
mui.ajax(url, {
data: {
id: contentid
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
var cid = obo[0].id;
// var cdaily_yimg = obo[0].yimg;
var cdaily_cimg = obo[0].cimg;
var cdaily_title = obo[0].title;
var cdaily_time = obo[0].time;
var cdaily_browse = obo[0].browse;
var cdaily_comments = obo[0].comments;
// var cdaily_detaileurl = obo[0].detaileurl;
var cdaily_zhuozhe = obo[0].zhuozhe;
var yimg_url = '?x-oss-process=image/rotate,270/resize,m_fill,h_361,w_688,limit_0';
var cdaily_yimg = cdaily_cimg + yimg_url;
contentimg = cdaily_cimg;
var odaily_yimg = document.getElementById("daily_yimg");
var odaily_title = document.getElementById("daily_title");
var odaily_time = document.getElementById("daily_time");
var odaily_browse = document.getElementById("daily_browse");
var odaily_comments = document.getElementById("daily_comments");
var odaily_detaileurl = document.getElementById("daily_detaileurl");
var odaily_zhuozhe = document.getElementById("daily_zhuozhe");
odaily_yimg.src = cdaily_yimg;
odaily_title.innerHTML = cdaily_title;
odaily_time.innerHTML = cdaily_time;
odaily_browse.innerHTML = cdaily_browse;
odaily_comments.innerHTML = cdaily_comments;
// odaily_detaileurl.href = cdaily_detaileurl;
odaily_detaileurl.dataset.id = cid;
odaily_zhuozhe.innerHTML = cdaily_zhuozhe;
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
// 跟帖数据
var ifirst = 0;
var ilast = 10;
var maxid = 0;
var url = "http://www.zjliang.com/index.php/Gapi/Article/olist.html/";
mui.ajax(url, {
data: {
dailyid: contentid, //获取文章id
first: ifirst,
last: ilast
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
maxid = obo[0].id;
var list = document.getElementById("hot");
mui.each(obo, function(index, item) {
var cid = item.id,
carticle_inid = item.inid,
carticle_title = item.title,
carticle_time = item.time,
carticle_browse = item.browse,
carticle_comments = item.comments,
carticle_yimg = item.yimg,
carticle_user_name = item.user_name,
carticle_user_img = item.user_img,
carticle_zan = item.zan;
odiv = document.createElement('div');
odiv.className = 'recommended_list';
odiv.innerHTML =
'<div class="recommended_list_p">' +
'<a data-id=' + cid + ' href="content.html">' +
'<div class="recommended_preview">' +
'<img src=' + carticle_yimg + '>' +
'</div>' +
'<div class="recommended_text">' +
'<div class="recommended_text_p">' +
'<div class="recommended_title">' +
carticle_title +
'</div>' +
'<div class="recommended_time">' +
carticle_time +
'</div>' +
'<div class="recommended_detalie">' +
'浏览/<span>' + carticle_browse + '</span> 评论/<span>' + carticle_comments + '</span> 赞/<span>' + carticle_zan + '</span>' +
'</div>' +
'<div class="recommended_user_name">' +
carticle_user_name +
'<div class="recommended_user_img">' +
'<img src=' + carticle_user_img + ' />' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</a>' +
'</div>';
list.appendChild(odiv);
});
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
function pulldownRefresh() {
setTimeout(function() {
// 代码位置
var url = "http://www.zjliang.com/index.php/Gapi/Article/two.html/";
mui.ajax(url, {
data: {
dailyid: contentid, //获取文章id
maxid: maxid,
// first: cells.length
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
var list = document.getElementById("hot");
// var macidl = obo.length;
mui.each(obo, function(index, item) {
var cid = item.id,
carticle_inid = item.inid,
carticle_title = item.title,
carticle_time = item.time,
carticle_browse = item.browse,
carticle_comments = item.comments,
carticle_yimg = item.yimg,
carticle_user_name = item.user_name,
carticle_user_img = item.user_img,
carticle_zan = item.zan;
console.log(cid);
maxid = cid;
odiv = document.createElement('div');
odiv.className = 'recommended_list';
odiv.innerHTML =
'<div class="recommended_list_p">' +
'<a data-id=' + cid + ' href="content.html">' +
'<div class="recommended_preview">' +
'<img src=' + carticle_yimg + '>' +
'</div>' +
'<div class="recommended_text">' +
'<div class="recommended_text_p">' +
'<div class="recommended_title">' +
carticle_title +
'</div>' +
'<div class="recommended_time">' +
carticle_time +
'</div>' +
'<div class="recommended_detalie">' +
'浏览/<span>' + carticle_browse + '</span> 评论/<span>' + carticle_comments + '</span> 赞/<span>' + carticle_zan + '</span>' +
'</div>' +
'<div class="recommended_user_name">' +
carticle_user_name +
'<div class="recommended_user_img">' +
'<img src=' + carticle_user_img + ' />' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</a>' +
'</div>';
list.insertBefore(odiv, list.firstChild);
});
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
mui('#pullrefresh').pullRefresh().endPulldownToRefresh(); //refresh completed
}, 1500);
}
var count = 0;
/**
* 上拉加载具体业务实现
*/
function pullupRefresh() {
setTimeout(function() {
mui('#pullrefresh').pullRefresh().endPullupToRefresh((++count > 2)); //参数为true代表没有更多数据了。
var cells = document.body.querySelectorAll('.recommended_list');
var url = "http://www.zjliang.com/index.php/Gapi/Article/olist.html";
mui.ajax(url, {
data: {
dailyid: contentid, //获取文章id
first: cells.length,
last: cells.length + 10
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
var list = document.getElementById("hot");
mui.each(obo, function(index, item) {
var cid = item.id,
carticle_inid = item.inid,
carticle_title = item.title,
carticle_time = item.time,
carticle_browse = item.browse,
carticle_comments = item.comments,
carticle_yimg = item.yimg,
carticle_user_name = item.user_name,
carticle_user_img = item.user_img,
carticle_zan = item.zan;
odiv = document.createElement('div');
odiv.className = 'recommended_list';
odiv.innerHTML =
'<div class="recommended_list_p">' +
'<a data-id=' + cid + ' href="content.html">' +
'<div class="recommended_preview">' +
'<img src=' + carticle_yimg + '>' +
'</div>' +
'<div class="recommended_text">' +
'<div class="recommended_text_p">' +
'<div class="recommended_title">' +
carticle_title +
'</div>' +
'<div class="recommended_time">' +
carticle_time +
'</div>' +
'<div class="recommended_detalie">' +
'浏览/<span>' + carticle_browse + '</span> 评论/<span>' + carticle_comments + '</span> 赞/<span>' + carticle_zan + '</span>' +
'</div>' +
'<div class="recommended_user_name">' +
carticle_user_name +
'<div class="recommended_user_img">' +
'<img src=' + carticle_user_img + ' />' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</a>' +
'</div>';
list.appendChild(odiv);
});
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
}, 1500);
}
mui('#hot').on('tap', 'a', function() {
var contentid = this.getAttribute("data-id");
var id = this.getAttribute("href");
var href = this.getAttribute('href');
mui.openWindow({
url: href,
extras: {
contentid: contentid //扩展参数
}
});
});
});
</script>
</html>