-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmember-list.html
275 lines (270 loc) · 14 KB
/
member-list.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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
<!DOCTYPE html>
<html class="x-admin-sm">
<head>
<meta charset="UTF-8">
<title>欢迎页面-X-admin2.2</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="stylesheet" href="./css/font.css">
<link rel="stylesheet" href="./css/xadmin.css">
<script src="./lib/layui/layui.js" charset="utf-8"></script>
<script type="text/javascript" src="./js/xadmin.js"></script>
<!--[if lt IE 9]>
<script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
<script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="mybg2">
<div class="x-nav">
<span class="layui-breadcrumb">
<a href="">首页</a>
<a href="">演示</a>
<a>
<cite>导航元素</cite></a>
</span>
<a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
<i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
<div class="layui-row layui-col-space15">
<div class="layui-col-md12">
<div class="layui-card">
<div class="layui-card-body ">
<form class="layui-form">
<div class="layui-input-inline">
<select lay-verify="choose" name="optioin">
<option value="">选择要查找的内容</option>
<option value="student">学号</option>
<option value="name">姓名</option>
<option value="birthday">生日</option>
<option value="class">班级</option>
<option value="department">院系</option>
</select>
</div>
<div class="layui-inline layui-show-xs-block">
<input lay-verify="message" type="text" name="message" placeholder="输入信息" autocomplete="off" class="layui-input">
</div>
<div class="layui-inline layui-show-xs-block">
<button class="layui-btn" lay-submit="" lay-filter="sreach"><i class="layui-icon"></i></button>
</div>
</form>
</div>
<div class="layui-card-header">
<button class="layui-btn layui-btn-danger" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
<button class="layui-btn" onclick="xadmin.open('添加学生','member-add',430,550)"><i class="layui-icon"></i>录入</button>
<button class="layui-btn layui-btn-normal" onclick="window.location.href='member-list'">显示所有</button>
</div>
<div class="layui-card-body layui-table-body layui-table-main">
<table class="layui-table layui-form">
<thead>
<tr>
<th>
<input type="checkbox" lay-filter="checkall" name="" lay-skin="primary">
</th>
<th>学号</th>
<th>姓名</th>
<th>性别</th>
<th>班级</th>
<th>院系</th>
<th>生日</th>
<th>籍贯</th>
<th>学籍变更</th>
<th>获奖情况</th>
<th>处罚记录</th>
<th>操作</th></tr>
</thead>
<tbody>
{foreach $list as $key}
<tr>
<td>
<input type="checkbox" name="id" value="{$key.STUDENTID}" lay-skin="primary">
</td>
<td>{$key.STUDENTID}</td>
<td>{$key.NAME}</td>
<td>{$key.SEX}</td>
<td>{$key.CLASS}</td>
<td>{$key.DEPARTMENT}</td>
<td>{$key.BIRTHDAY}</td>
<td>{$key.NATIVE_PLACE}</td>
<td>{if $key.CHANGE=='查看'}<a onclick="xadmin.open('查看数据','chang-list?choose=student&message={$key.STUDENTID}',800,550);" href="javascript:;">{$key.CHANGE}</a>{else/}{$key.CHANGE}{/if}</td>
<td>{if $key.REWARD=='查看'}<a onclick="xadmin.open('查看数据','reward-list?choose=student&message={$key.STUDENTID}',800,550);" href="javascript:;">{$key.REWARD}</a>{else/}{$key.REWARD}{/if}</td>
<td>{if $key.PUNISHMENT=='查看'}<a onclick="xadmin.open('查看数据','punish-list?choose=student&message={$key.STUDENTID}',800,550);" href="javascript:;">{$key.PUNISHMENT}</a>{else/}{$key.PUNISHMENT}{/if}</td>
<td class="td-manage">
<a title="编辑" onclick="xadmin.open('编辑','member-edit?id={$key.STUDENTID}',430,550);" href="javascript:;">
<i class="layui-icon"></i>
</a>
<a title="删除" onclick="member_del(this,'{$key.STUDENTID}')" href="javascript:;">
<i class="layui-icon"></i>
</a>
<a title="查看成绩" onclick="xadmin.open('查看数据','grade-list?choose=student&message={$key.STUDENTID}',800,550);" href="javascript:;">
<i class="layui-icon"></i>
</a>
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
<div class="layui-card-body ">
<div class="page">
<div>
<form class="layui-form">
<p class="layui-laypage-count"> 当前第{$id+1}页/共{$page}页(共 {$num}条记录)</p>
{if $id>0}
<a class="prev" href="member-list?id={$id-1}">上一页</a>
{/if}
{php}
if($page>7){
for($i=($id-3);$i<=$id;$i++){
if($i>=1){
if($i==($id+1))
echo '<span class="current">'.$i.'</span>';
else
echo '<a class="num" href="member-list?id='.($i-1).'">'.$i.'</a>';
}
}
for($i=($id+1);$i<=($id+5);$i++){
if($i<=$page){
if($i==($id+1))
echo '<span class="current">'.$i.'</span>';
else
echo '<a class="num" href="member-list?id='.($i-1).'">'.$i.'</a>';
}
}
}else{
for($i=1;$i<=$page;$i++){
if($i==($id+1))
echo '<span class="current">'.$i.'</span>';
else
echo '<a class="num" href="member-list?id='.($i-1).'">'.$i.'</a>';
}
}
{/php}
{if ($id+1)!=$page}
<a class="next" href="member-list?id={$id+1}">下一页</a>
{/if}
<div class="layui-inline layui-show-xs-block">
<input style="width:90px;height:37px" lay-verify="message" type="text" name="message" placeholder="输入页数" autocomplete="off" class="layui-input">
</div>
<div class="layui-inline layui-show-xs-block">
<button style="width:41px;height:37px" class="layui-btn" lay-submit lay-filter="goto"><i class="layui-icon"></i></button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
<script>
layui.use(['form', 'layer'],
function() {
$ = layui.jquery;
var form = layui.form,
layer = layui.layer;
//自定义验证规则
form.verify({
choose:function (value) {
if(!value)
return '请选择搜索项!'
},
message:function (value) {
if(!value)
return '请输入要搜索的内容';
}
});
//监听提交
form.on('submit(sreach)',
function(data) {
//layer.msg('搜索!', {icon: 1, time: 1000});
window.location.href="member-list?choose="+data.field.optioin+"&message="+data.field.message;
return false;
});
//跳转页面
form.on('submit(goto)',
function(data) {
window.location.href="member-list?id="+(data.field.message-1);
return false;
});
});
layui.use(['laydate','form'], function(){
var form = layui.form;
// 监听全选
form.on('checkbox(checkall)', function(data){
if(data.elem.checked){
$('tbody input').prop('checked',true);
}else{
$('tbody input').prop('checked',false);
}
form.render('checkbox');
});
});
/*用户-删除*/
function member_del(obj,id){
layer.confirm('确认要删除吗?',function(index){
//发异步删除数据
console.log(id);
var result='err';
del=$.ajax({
type:'get',
url:'/tools/del?',
data:{
id:id
},
success:function (msg) {
result=msg;
},
error:function () {
layer.msg('删除失败!', {icon: 2, time: 1000});
}
});
$.when(del).done(function (data) {
if(result==='ok') {
$(obj).parents("tr").remove();
layer.msg('已删除!', {icon: 1, time: 1000});
}else{
layer.msg('删除失败!', {icon: 2, time: 1000});
}
});
});
}
/*批量删除*/
function delAll (argument) {
var ids = [];
// 获取选中的id
$('tbody input').each(function(index, el) {
if($(this).prop('checked')){
ids.push($(this).val())
}
});
layer.confirm('确认要删除吗?',function(index){
//捉到所有被选中的,发异步进行删除
//这里获取选中的id
del=$.ajax({
type: 'post',
url:'/tools/mdel',
data:{ids:ids.toString()},
success:function (msg) {
console.log("获取到的数据"+msg)
},
error:function () {
layer.msg('删除失败!', {icon: 2});
}
});
$.when(del).done(function (data) {
console.log("最终数据"+data)
if(data==='ok'){
layer.msg('删除成功!', {icon: 1});
$(".layui-form-checked").not('.header').parents('tr').remove();
}else{
layer.msg('删除失败!', {icon: 2});
}
});
});
}
</script>
</html>