-
Notifications
You must be signed in to change notification settings - Fork 0
/
index2.html
99 lines (93 loc) · 3.58 KB
/
index2.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
<!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" />
<script type="text/javascript" charset="utf-8">
mui.init();
mui.plusReady(function() {
//生成日期
var currentDate = new Date();
var currentDateObj = document.getElementById("currentDateStr");
var currentWeekObj = document.getElementById("currentWeekStr");
currentDateObj.innerHTML = currentDate.getFullYear() + "年" + (currentDate.getMonth() + 1) + "月" + (currentDate.getDate()) + "日";
currentWeekObj.innerHTML = "星期" + "日一二三四五六".charAt(currentDate.getDay());
var subPage = plus.webview.create(
"http://api.juheapi.com/japi/toh?key=1aaa05df71455499fa71f48ef7c514a3&v=1.0&month=" + (currentDate.getMonth() + 1) + "&day=" + (currentDate.getDate()),
"embed", {
top: "46px",
bottom: "0px"
}
);
plus.webview.currentWebview().append(subPage);
void subPage.setJsFile("_www/js/getJSON.js");
var str = plus.storage.getItem("content");
var json = eval("(" + str + ")");
// console.log(str);
// console.log("==============================");
var message = "";
mui.each(json.result, function(i, n) {
// console.log(json.result[i].des);
//message += "<li class=\"mui-table-view-cell\"><h4>" + json.result[i].title + "</h4><span>" + json.result[i].des + "</span></li>";
message += "<a href=\"javascript:;\"><img class=\"mui-media-object mui-pull-right\" src=\"" + json.result[i].pic + "\"><div class=\"mui-media-body\">" + json.result[i].title + "<p class='mui-ellipsis'>" + json.result[i].des + "</p></div></a>";
});
var currentMessageObj = document.getElementById("currentMessage");
currentMessageObj.innerHTML = message;
//首页返回键处理
//处理逻辑:1秒内,连续两次按返回键,则退出应用;
var first = null;
mui.back = function() {
//首次按键,提示‘再按一次退出应用’
if (!first) {
first = new Date().getTime();
mui.toast('再按一次退出应用');
setTimeout(function() {
first = null;
}, 1000);
} else {
if (new Date().getTime() - first < 1000) {
plus.runtime.quit();
}
}
};
})
</script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<h1 class="mui-title">历史上的今天</h1>
<a class="mui-icon mui-icon-info mui-pull-right"></a>
</header>
<div class="mui-content">
<ul class="mui-table-view">
<li class="mui-table-view-divider">
<span>今天是</span>
<span id="currentDateStr" class="mui-badge mui-badge-blue">
</span>
<span style="margin-left: 50px;"></span>
<span>星期:</span>
<span id="currentWeekStr" class="mui-badge mui-badge-red">
</span>
</li>
<ul class="mui-table-view-cell mui-medio" id="currentMessage">
<!--<a href="javascript:;">
<img class="mui-media-object mui-pull-left" src="../images/shuijiao.jpg">
<div class="mui-media-body">
幸福
<p class='mui-ellipsis'>能和心爱的人一起睡觉,是件幸福的事情;可是,打呼噜怎么办?</p>
</div>
</a>-->
</ul>
</ul>
</div>
<nav class="mui-bar mui-bar-tab">
<a class="mui-tab-item mui-active" href="#tabbar">
<span class="mui-icon mui-icon-reload"></span>
<span class="mui-tab-label">刷新</span>
</a>
</nav>
</body>
</html>