-
Notifications
You must be signed in to change notification settings - Fork 2
/
sub3.html
114 lines (111 loc) · 3.37 KB
/
sub3.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
<!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>
<link href="css/mui.css" rel="stylesheet"/>
</head>
<body>
<div class="mui-content mui-scroll-wrapper" id="refreshContainer">
<div class="mui-scroll newsList">
<ul class="mui-table-view" id="newsListUl"></ul>
</div>
</div>
<script src="js/mui.min.js"></script>
<script src="js/h.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
mui.init({
pullRefresh : {
container : "#refreshContainer",
down: {
height:50,
auto: true,
contentdown : "下拉可以刷新",
contentover : "释放立即刷新",
contentrefresh : "正在刷新...",
callback : getNewsList
},
up : {
height:100,
auto:false,
contentrefresh : "正在加载...",
contentnomore:'没有更多数据了',
callback : getListByPage
}
}
});
var page = 1;
function getListByPage(){
var _self = this;
mui.get(
'http://hoa.hcoder.net/index.php?user=hcoder&pwd=hcoder&m=mediaList&page='+page,
function(res){
if(res == 'null'){
_self.endPullupToRefresh(true);
return false;
}
var newsLists = res.split('--hcSplitor--');
for(var i = 0; i < newsLists.length; i++){
var li = document.createElement('li');
var newsItem = newsLists[i].split('--hcListSplitor--');
li.innerHTML = '<a href="javascript:openInfo('+newsItem[0]+');"><div class="imgs"><img src="'+newsItem[1]+'" /></div><div class="title">'+newsItem[2]+'</div></a>';
h(li).addClass('mui-table-view-cell mui-media');
h(li).appendTo('#newsListUl');
}
page++;
_self.endPullupToRefresh(false);
}
);
}
function getNewsList(){
page = 1;
//新闻列表
mui.get(
'http://hoa.hcoder.net/index.php?user=hcoder&pwd=hcoder&m=mediaList&page='+page,
function(res){
var newsLists = res.split('--hcSplitor--');
var html = '';
for(var i = 0; i < newsLists.length; i++){
var newsItem = newsLists[i].split('--hcListSplitor--');
html += '<li class="mui-table-view-cell mui-media"> <a href="javascript:openInfo('+newsItem[0]+');"> <img class="mui-media-object mui-pull-left" src="'+newsItem[1]+'"> <div class="mui-media-body">' +newsItem[0]+' <p class="mui-ellipsis">'+newsItem[2]+'</p></div></a></li>';
}
h('#newsListUl').html(html);
mui('#refreshContainer').pullRefresh().endPulldownToRefresh();
page++;
//重置上拉
mui('#refreshContainer').pullRefresh().refresh(true);
}
);
}
var _index, _self, _next,_prev;
mui.plusReady(function(){
_self = plus.webview.currentWebview();
_next = plus.webview.getWebviewById('sub4.html');
_prev = plus.webview.getWebviewById('sub2.html');
_index = plus.webview.getLaunchWebview();
//向左滑动
_self.drag({
direction : "right",
moveMode : "followFinger"
},{
view : _prev,
moveMode : "follow"
},function(e){
if(e.type == 'end' && e.result){
_index.evalJS('h("#navFooter").find("a").removeClass("mui-active"); h("#nav2").addClass("mui-active")')
}
});
});
function openInfo(id){
mui.openWindow({
url : 'info.html',
id : 'info.html',
extras : {
newId : id
}
});
}
</script>
</body>
</html>