-
Notifications
You must be signed in to change notification settings - Fork 0
/
reserve_free_listen.html
177 lines (165 loc) · 4.78 KB
/
reserve_free_listen.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Education</title>
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<!--标准mui.css-->
<link rel="stylesheet" href="css/mui.min.css">
<link rel="stylesheet" type="text/css" href="css/loaders.min.css" />
<link rel="stylesheet" type="text/css" href="css/loading.css" />
<script src="js/jquery.min.js" type="text/javascript"></script>
<script src="js/loading.animation.js" type="text/javascript"></script>
<script src="js/config.js" type="text/javascript"></script>
<style>
h5 {
margin: 5px 7px;
}
.mui-icon-clear {
margin-top: 8px;
}
</style>
</head>
<!--loading页开始-->
<div class="loading">
<div class="loader">
<div class="loader-inner pacman">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</div>
</div>
<!--loading页结束-->
<body>
<header class="mui-bar mui-bar-nav">
<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
<h1 class="mui-title">试听课程预约</h1>
</header>
<div class="mui-content">
<div class="mui-content-padded" style="margin: 10px;">
<form class="mui-input-group">
<div class="mui-input-row" style="height: 50px; padding: 8px;">
<label>试听课程</label>
<input id="title" type="text" value="" readonly>
</div>
<div class="mui-input-row" style="height: 50px; padding: 8px;">
<label>开课分部</label>
<input id="branch" type="text" value="" readonly>
</div>
<div class="mui-input-row" style="height: 50px; padding: 8px;">
<label>真实姓名</label>
<input id="username" type="text" class="mui-input-clear" placeholder="千万别输入微信昵称哟">
</div>
<div class="mui-input-row" style="height: 50px; padding: 8px;">
<label>联系方式</label>
<input id="tel" type="text" class="mui-input-clear" placeholder="最好输入手机号码">
</div>
<div class="mui-input-row" style="height: 160px; padding: 8px;">
<label>预约备注</label>
<textarea id="comment" rows="5" placeholder="您有什么特殊的需求"></textarea>
</div>
<div class="mui-button-row" style="height: 60px; padding: 10px;">
<button id="book" type="button" class="mui-btn mui-btn-primary"
data-loading-text="提交中" data-loading-icon-position="left"
style="width: 40%; height: 40px; font-size: 16px;">
申请预约
</button>
</div>
</form>
</div>
</div>
<script src="js/mui.min.js"></script>
<script>
mui.init({
swipeBack: true //启用右滑关闭功能
});
$(function() {
var parameters = ((window.location + '').split('?')[1]).split('&');
var id = parameters[0].split('=')[1];
jqxhr=$.ajax( {
type: "post",
async: true,
url:PREPATH + "/user/selectReserveInfoByID",
data: {id: id},
dataType: "json",
xhrFields: {
withCredentials: true
},
headers:{
"X-Requested-With":"XMLHttpRequest"
},
crossDomain: true,
success: function(data) {
$("#title").val(data.title);
$("#branch").val(data.branch);
$("#username").val(data.username);
$("#tel").val(data.tel);
},
error: function() {
mui.toast("信息加载失败");
}
});
//注册预约点击事件
$("#book").click(function() {
var btnArray = ['是', '否'];
mui.confirm('您是否确认预约?', '准备预约', btnArray, function(e) {
if (e.index == 0) {
book(id);
}
else {
mui.toast('预约取消');
}
})
});
})
//提交预约申请
function book(fid) {
var username = $('#username').val();
var tel = $('#tel').val();
var comment = $('#comment').val();
jqxhr=$.ajax( {
type: "post",
async: true,
url:PREPATH + "/user/saveFreeListenBook",
data: {
fid: fid,
username: username,
tel: tel,
comment: comment
},
dataType: "json",
xhrFields: {
withCredentials: true
},
headers:{
"X-Requested-With":"XMLHttpRequest"
},
crossDomain: true,
beforeSend: function() {
mui($("#book")).button('loading');
},
success: function(data) {
mui($("#book")).button('reset');
if(data.state == 1) {
mui.toast('申请成功');
mui.openWindow({
url: 'my_reservations.html'
});
}
else {
mui.toast("预约失败");
}
},
error: function() {
mui.toast("预约失败");
}
});
}
</script>
</body>
</html>