forked from mayining043/Yue_WebApp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowmeal.html
112 lines (98 loc) · 4.64 KB
/
showmeal.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<link rel="stylesheet" type="text/css" href="css/total.css">
<link rel="stylesheet" type="text/css" href="css/swm.css">
<body>
<button id="swmbtn" onclick="getback()">返回</button>
<p id="title">约饭</p>
<div id="swmpart"></div>
<script src="jquery-3.1.0.min.js"></script>
<script type="text/javascript">
var w=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth;
if(w<=414){
document.getElementsByTagName('body')[0].style.width= w+'px';
}
window.onload = function(){
$.get("online.php",
function(data,status){
if (status=="success"){
if(data!=0){
var r=confirm("请先登录!");
if (r==true)
{
window.location.href="index.html";
}
else
{
alert("再见!");
}
}
}
});
$.post("showlist.php",
{
kind:"约饭"
},
function(data,status){
if (status=="success"){
var t=eval("("+data+")");
var o = document.body;
for(var i=0;i<t.length;i++){
var groupid=t[i].groupid,
kind=t[i].kind,
username=t[i].username,
rantname=t[i].rantname,
time=t[i].time,
amount=t[i].amount,
isshow=t[i].isshow,
intro=t[i].intro,
sum=t[i].sum;
var div = document.createElement("div");
div.className="swmpart";
var str="<p>发布者:"+username+"</p><p>时间:"+time+"</p>"+
"<p>地点:"+rantname+"</p><p>已加入/总人数:"+sum+"/"+amount+"</p>"+
"<p>可见:"+isshow+"</p><p>备注:"+intro+"</p>"+"<button onclick='add(this)' class='btn' id="+groupid+">加入</button>";
div.innerHTML = str;
o.appendChild(div);
}
}
else{
alert("后台数据连接失败");
}
});
}
function getback(){
window.location.href="select.html";
}
function add(t){
var id=t.id;
var name="鬼";
$.post("addother.php",
{
groupid:id,
username:name
},
function(data,status){
if (status=="success"){
var condition = data;
switch (condition)
{
case "0": alert("已成功约饭~\(≧▽≦)/~");window.location.reload();break;
case "1": alert("数据连接失败QUQ");break;
case "2": alert("录入信息失败QUQ");break;
default:alert(condition);break;
// "未知错误"
}
}
else{
alert("Request was unsuccessful: " + status);
}
}
);
}
</script>
</body>
</html>