-
Notifications
You must be signed in to change notification settings - Fork 0
/
pindaolist.html
357 lines (327 loc) · 18.4 KB
/
pindaolist.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
<!DOCTYPE html>
<html class="android">
<head>
<title></title>
<meta charset="utf-8">
<meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link rel="stylesheet" href="css/ui-input.css">
<link rel="stylesheet" href="css/ui-base.css">
<link rel="stylesheet" href="css/ui-box.css">
<link rel="stylesheet" href="css/ui-color.css">
<link rel="stylesheet" href="css/ui-365.css">
<style>
html, body {
overflow-x: hidden;
}
</style>
<script src="js/zy_control.js"></script>
<script src="js/beihai365_comman.js"></script>
<script src="js/beihai365_global.js"></script>
<script src="js/zepto.min.js"></script>
</head>
<body class="um-vp m2-homeNewbg">
<div id="page_0" class="up ub ub-ver" tabindex="0">
<div id="modelView"></div>
<div id="listView"></div>
<div id="index_content"></div>
</div>
</body>
<script>
window.uexOnload = function(type) {
if (!type) {
uexWindow.setBounce(0);
uexWindow.hiddenBounceView(0);
uexWindow.hiddenBounceView(1)
localStorage.returnType = "pindao"
init();
getData();
var $winName = ("pindao" + localStorage.pindaoWindowId);
if (localStorage.urlType != 15) {
//监听侧滑
uexWindow.onSwipeRight = function() {
//uexWindow.evaluateScript($winName, 0, "closeWin();");
}
}
//启用统计
isMTA("pindao-" + localStorage.urlType);
}
}
function init() {
//设置标题
lodding.show();
}
//获取数据
function getData() {
console.log(reLink('/index.php?c=threads&m=channel&cid=' + parseInt(localStorage.urlType)))
AJAX.get(reLink('/index.php?c=threads&m=channel&cid=' + parseInt(localStorage.urlType)), function(res) {
localStorage.setItem("reClassListData", res);
console.log('返回的数据'+res);
//console.log(localStorage.getItem("reClassListData"))
getView();
});
}
//加载整个模块
function getView() {
//转换JSON
var data = JSON.parse(localStorage.getItem("reClassListData"));
console.log(data);
//加载列表数据
for (var j in data.forums) {
console.log(data.forums[j])
//1、加载标题
var re = data.forums[j];
//其他所有模型
if (re.contentlist) {
mode.view(re);
}
}
//数据列表
if (data.result) {
mode.listView(data);
}
lodding.hide();
}
function reViewbgc(s) {
if (parseInt(s) <= 50) {
s = 'youbgc'
} else if (parseInt(s) <= 100) {
s = 'liangbgc'
} else {
s = 'chabgc'
}
return s;
}
function reViewText(s) {
if (parseInt(s) <= 50) {
s = '优'
} else if (parseInt(s) <= 100) {
s = '良'
} else {
s = '差'
}
return s;
}
function reWeather(s) {
return s;
}
/*模块类型(重构)*/
var $modelView = $("#modelView");
var mode = {
view : function(d) {
var data = d.contentlist;
var tpl = d.fname;
//var weatherData = d.data;
switch(tpl) {
case "ModelA":
if (data.length > 0) {
var maHtml = '';
maHtml += '<div class="ModelNode">' + '<div class="Model">' + '<div class="Modelbox ModelA">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
maHtml += '<div class="Pane" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + reSec(re.sec_url) + '\')">' + '<div class="Paneborder">' + retoubuIcon(re.defaulticon, re.icon) + '<span class="PaneText">' + re.name + '</span>' + '</div>' + '</div>';
};
maHtml += '</div>' + '<div class="c"></div>' + '<div class="Panehr"></div>' + '<div class="PanehrTop"></div>' + '</div>' + '</div>';
$modelView.append(maHtml);
}
break;
case "ModelZ":
//为A的变形金刚
if (data.length > 0) {
var maHtml = '';
maHtml += '<div class="ModelNode">' + '<div class="Model">' + '<div class="Modelbox ModelZ">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
maHtml += '<div class="Pane" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + reSec(re.sec_url) + '\')">' + '<div class="Paneborder">' + retoubuIcon(re.defaulticon, re.icon) + '<span class="PaneText">' + re.name + '</span>' + '</div>' + '</div>';
};
maHtml += '</div>' + '<div class="c"></div>' + '<div class="Panehr"></div>' + '<div class="PanehrTop"></div>' + '</div>' + '</div>';
$modelView.append(maHtml);
}
break;
case "ModelB":
if (data.length > 0) {
var mbHtml = '';
mbHtml += '<div class="ModelNode">' + '<div class="Model">' + '<div class="Modelbox ModelB">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
mbHtml += '<div class="Pane" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + re.sec_url + '\')">' + '<div class="Paneborder">' + retoubuIcon(re.defaulticon, re.icon) + '<span class="PaneText">' + re.name + '</span>' + '</div>' + '</div>';
};
mbHtml += '</div>' + '<div class="c"></div>' + '<div class="Panehr"></div>' + '<div class="PanehrTop"></div>' + '</div>' + '</div>';
$modelView.append(mbHtml);
}
break;
case "ModelC":
if (data.length > 0) {
var mcHtml = '';
mcHtml += '<div class="ModelNode">' + '<div class="Model">' + '<div class="Modelbox ModelC">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
mcHtml += '<div class="Pane" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + re.sec_url + '\')">' + '<div class="Paneborder">' + retoubuIcon(re.defaulticon, re.icon) + '<span class="PaneText">' + re.name + '</span>' + '</div>' + '</div>';
};
mcHtml += '</div>' + '<div class="c"></div>' + '<div class="Panehr"></div>' + '<div class="PanehrTop"></div>' + '</div>' + '</div>';
$modelView.append(mcHtml);
}
break;
case "ModelD":
if (data.length > 0) {
var mdHtml = '';
mdHtml += '<div class="ModelNode">' + '<div class="Model">' + '<div class="Modelbox ModelD">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
mdHtml += '<div class="Pane" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + re.sec_url + '\')">' + '<div class="Paneborder">' + retoubuIcon(re.defaulticon, re.icon) + '<span class="PaneText">' + re.name + '<em>' + re.descript + '</em></span>' + '</div>' + '</div>';
};
mdHtml += '</div>' + '<div class="c"></div>' + '<div class="Panehr"></div>' + '<div class="PanehrTop"></div>' + '</div>' + '</div>';
$modelView.append(mdHtml);
}
break;
case "ModelMyThead":
var data = d.data;
console.log(data);
if (data && data.length > 0) {
var meHtml = '';
meHtml += '<div class="m2-listView ModelMyThead"><p class="model_h1">'+ d.forum_name +'</p>';
for (var i = 0; i < data.length; i++) {
var re = data[i];
meHtml += '<div class="ListViewItem" onclick="openWindow.select(\'3\',\'' + re.tid + '\',\'' + re.tid + '\')">' + '<h1>' + re.subject + '</h1>' + '<p><span>' + re.forumname + '</span><span>' + re.postdate + '</span></p>' + '<span class="imgBox">' + retoubuIcon(re.defaulticon, re.icon) + '</span>' + '</div>';
}
meHtml += '</div>';
$modelView.append(meHtml);
}
break;
case "ModelE":
if (data.length > 0) {
var meHtml = '';
meHtml += '<div class="m2-listView ModelE"><p class="model_h1">'+ d.forum_name +'</p>';
for (var i = 0; i < data.length; i++) {
var re = data[i];
meHtml += '<div class="ListViewItem" onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + re.sec_url + '\')">' + '<h1>' + re.name + '</h1>' + '<p><span>' + re.descript + '</span><span>' + re.publishdate + '</span></p>' + '<span class="imgBox">' + retoubuIcon(re.defaulticon, re.icon) + '</span>' + '</div>';
}
meHtml += '</div>';
$modelView.append(meHtml);
}
break;
case "ModelF":
if (data.length > 0) {
var meHtml = '';
meHtml += '<div class="listViewImg ModelF">';
for (var i = 0; i < data.length; i++) {
var re = data[i];
meHtml += '<div onclick="openWindow.select(\'' + re.urltype + '\',\'' + re.url + '\',\'' + re.sec_url + '\')">' + '<span class="MFimgBox">' + retoubuIcon(re.defaulticon, re.icon) + '</span>' + '</div>';
}
meHtml += '</div>';
$modelView.append(meHtml);
}
break;
case "ModelG":
localStorage.weatherData = JSON.stringify(d.data);
if (d.data) {
var pdata = d.data['pm2.5'];
var wdata = d.data['weather'];
var mgHtml = "";
if (wdata.resultcode == 200 && pdata.resultcode == 200) {
mgHtml += '<div class="m2-tianqi">' + '<div class="fl" onclick="newOpenWin(\'weather\', \'weather.html\');">' + '<span class="m2t-a"> ' + wdata.result.sk.temp + '° </span>' + '<span class="m2t-b"> 北海 ' + wdata.result.today.temperature + ' </span>' + '<span class="m2t-c m2t-icon-1"> ' + reWeather(wdata.result.today.weather) + ' </span>' + '</div>' + '<div onclick="newOpenWin(\'pm25\', \'pm25.html\');">' + '<span class="m2t-pm2 ' + reViewbgc(pdata.result[0].citynow.AQI) + '">空气质量:' + pdata.result[0].citynow.AQI + '<span>' + reViewText(pdata.result[0].citynow.AQI) + '</span></span>' + '</div>' + '</div>'
}
$modelView.append(mgHtml)
}
break;
case "ModelTitle":
if (localStorage.urlType != 15) {
var loadTitie = d.forum_name;
if (loadTitie) {
var reName = ("pindao" + localStorage.pindaoWindowId);
uexWindow.evaluateScript(reName, "0", "setTitleName('" + loadTitie + "');");
}
}
default:
}
},
listView : function(data) {
var resultView = '<div class="mcListView ub-f1 tx-l t-bla ub-img6 kantie" id="mcListView"></div>';
$("#index_content").html(resultView);
Thread.onload_threads(data);
}
}
/*帖子列表类*/
//帖子类
var Thread = {
__load_treads : function(data, success_call) {
Thread.onload_view(data, 0, success_call);
},
onload_view : function(data, viewItem, success_call) {
var thread_list_tpl = "";
//console.log(data.result)
for (var i = 0; i < data.result.length; i++) {
var re = data.result[i];
if (re.imgshowtype == 0) {
thread_list_tpl += Thread.showHTMLone(re);
} else if (re.imgshowtype == 2 || re.imgshowtype == 1) {
thread_list_tpl += Thread.showHTMLtwo(re);
} else if (re.imgshowtype == 3) {
thread_list_tpl += Thread.showHTMLthree(re);
;
}
};
if (thread_list_tpl == "")
thread_list_tpl = "";
//如果没有记录
success_call(thread_list_tpl);
},
//加载帖子列表
onload_threads : function(data) {
this.__load_treads(data, function(thread_tpl_data) {
var d = document.createElement("DIV");
d.innerHTML = thread_tpl_data;
$id("mcListView").appendChild(d);
});
},
showHTMLone : function(data) {
var rekey = data;
var reHTML = "";
var isNew = rekey.is_new == 1 ? ' newIcon' : '',
isHot = rekey.digest == 1 ? ' jingIcon' : '',
isJing = rekey.hot == 1 ? ' hotIcon' : '';
reHTML += '<section class="has_action' + isNew + isHot + isJing + '">' + '<a href="javascript:zy_touch(\'click_opacity\')" onclick="openWindow.select(3,' + rekey.tid + ')" class="article_link clearfix"> <h3>' + rekey.subject + '</h3>' + '<div class="item_info"> ' + '<span class="src space">' + rekey.form_name + '</span> ' + '<span class="cmt">' + rekey.hits + '/' + rekey.replies + '</span> ' + '<span class="author">' + rekey.author + '</span> ' + '<span class="time fr canhide">' + rekey.postdate + '</span> ' + '</div> </a> ' + '<!--<i class="icon_hot"></i>--> ' + '</section>';
return reHTML;
},
showHTMLtwo : function(data) {
var rekey = data;
var reHTML = "";
var isNew = rekey.is_new == 1 ? ' newIcon' : '',
isHot = rekey.digest == 1 ? ' jingIcon' : '',
isJing = rekey.hot == 1 ? ' hotIcon' : '';
reHTML += '<section class="middle_mode has_action' + isNew + isHot + isJing + '"> ' + '<a href="javascript:zy_touch(\'click_opacity\')" onclick="openWindow.select(3,' + rekey.tid + ')" class="article_link clearfix" > <h3>' + rekey.subject + '</h3> ' + '<div class="list_img_holder" style="background-image:url(' + rekey.imgurls[0] + '?imageView/2/w/200)"> ' + '</div> ' + '<div class="item_info"> ' + '<span class="src space">' + rekey.form_name + '</span> ' + '<span class="cmt">' + rekey.hits + '/' + rekey.replies + '</span> ' + '<span class="author">' + rekey.author + '</span> ' + '<span class="time fr canhide">' + rekey.postdate + '</span> ' + '</div> </a> ' + '<!--<i class="icon_hot"></i>--> ' + '</section>';
return reHTML;
},
showHTMLthree : function(data) {
var rekey = data;
var reHTML = "";
var k;
var isNew = rekey.is_new == 1 ? ' newIcon' : '',
isHot = rekey.digest == 1 ? ' jingIcon' : '',
isJing = rekey.hot == 1 ? ' hotIcon' : '';
reHTML += '<section class=" has_action' + isNew + isHot + isJing + '"> ' + ' <a href="javascript:zy_touch(\'click_opacity\')" onclick="openWindow.select(3,' + rekey.tid + ')" class="article_link clearfix"> <h3>' + rekey.subject + '</h3> ' + '<div class="list_image "> ' + '<ul class="clearfix"> ';
//for (var i=0; i < rekey.imgurls.length; i++) {
for (var k = 0; k < rekey.imgurls.length; k++) {
var imgre = rekey.imgurls[k];
reHTML += '<li>' + '<div class="list_img_holder_large" style="background-image:url(' + imgre + '?imageView/2/w/200)"></div>' + '</li> ';
};
reHTML += '</ul> ' + '</div> ' + '<div class="item_info"> ' + '<span class="src space">' + rekey.form_name + '</span> ' + '<span class="cmt">' + rekey.hits + '/' + rekey.replies + '</span> ' + '<span class="author">' + rekey.author + '</span> ' + '<span class="time fr canhide" title="2014-12-12 11:24">' + rekey.postdate + '</span> ' + '</div> </a> ' + '</section>';
return reHTML;
}
}
function retoubuIcon(s, ss) {
var sIMG = "";
if (s) {
sIMG += '<img src="' + s + '">';
} else {
sIMG += '<img src="' + ss + '">';
}
return sIMG;
}
function reSec(s) {
if (s) {
return s;
}
return "";
}
</script>
</html>