-
Notifications
You must be signed in to change notification settings - Fork 0
/
database_content.html
164 lines (151 loc) · 4.91 KB
/
database_content.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
<!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" />
<script type="text/javascript" src="js/mui.zoom.js"></script>
<script type="text/javascript" src="js/mui.previewimage.js"></script>
</head>
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 id="ccontent_title" class="mui-title"></h1>
<button id="collection_log" class="mui-btn mui-btn-outlined mui-pull-right" style="height:32px;padding-top:6px"></button>
</header>
<div class="mui-content mui-slider-group">
<div class="">
<div class="big_box">
<div class="big_box_p">
<!--文章内容-->
<div class="article_box">
<div id="ccontent_content" class="article_img">
</div>
</div>
<div class="copyright">
版权声明:本APP的资料内容均来自网络,目的是为了让大家更好的学习与交流,请不要用于商业用户,如有版权问题请联系客服管理,会为您尽快删除,谢谢。
</div>
</div>
</div>
</div>
</div>
</body>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript">
mui.previewImage();
</script>
<script type="text/javascript">
mui.plusReady(function() {
mui.init();
var self = plus.webview.currentWebview();
var contentid = self.contentid;
// 开启一直保持程序唤醒状态
plus.device.setWakelock(true);
var url = "http://www.zjliang.com/index.php/Gapi/Database/content.html";
mui.ajax(url, {
data: {
id: contentid
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
var ccontent_title = obo[0].title,
ccontent_content = obo[0].content;
var ocontent_title = document.getElementById("ccontent_title");
var ocontent_content = document.getElementById("ccontent_content");
ocontent_title.innerHTML = ccontent_title;
ocontent_content.innerHTML = ccontent_content;
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
var state = app.getState();
var user_id = state.account.id; //作者id
var fzz; //1未收藏 2收藏
// 判断是否收藏
var collection = document.getElementById('collection_log');
var url = "http://www.zjliang.com/index.php/Gapi/Collection/addpd.html/";
mui.ajax(url, {
data: {
user_id: user_id,
content_id: contentid
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
var obo = eval(data);
if(obo.length > 0) {
collection.innerText = '取消收藏';
fzz = 2;
} else {
collection.innerText = '收藏';
fzz = 1;
}
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
collection.addEventListener("tap", function() {
colection(fzz)
})
function colection(ofzz) {
if(ofzz == 1) {
var url = "http://www.zjliang.com/index.php/Gapi/Collection/addcollection.html/";
mui.ajax(url, {
data: {
user_id: user_id,
content_id: contentid
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
plus.nativeUI.toast('收藏成功');
collection.innerText = '取消收藏'
fzz=2;
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
} else if(ofzz == 2) {
var url = "http://www.zjliang.com/index.php/Gapi/Collection/delet.html/";
mui.ajax(url, {
data: {
user_id: user_id,
content_id: contentid
},
dataType: 'json', //服务器返回json格式数据
type: 'post', //HTTP请求类型
timeout: 10000, //超时时间设置为10秒;
success: function(data) {
plus.nativeUI.toast('取消收藏成功');
collection.innerText = '收藏'
fzz = 1;
},
error: function(xhr, type, errorThrown) {
//异常处理;
console.log(type);
}
});
}
}
mui.back = function() {
var ws = plus.webview.currentWebview();
plus.device.setWakelock(false);
plus.webview.close(ws);
}
});
</script>
</html>