Repository navigation
Expand file tree
/
Copy pathindex.php
More file actions
137 lines (136 loc) · 3.23 KB
/
Copy pathindex.php
File metadata and controls
137 lines (136 loc) · 3.23 KB
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
<?php
require('../../global.php');
//验证是否登入
if(!checkLogin()){
redirect('../error.php?code='.$errorcode['noLogin']);
}
//验证是否为管理员
else if(!checkAdmin()){
redirect('../error.php?code='.$errorcode['noAdmin']);
}
//验证是否有权限
else if(!checkPermissions(3)){
redirect('../error.php?code='.$errorcode['noPermissions']);
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>用户管理</title>
<?php include('sysapp/global_css.php'); ?>
<style>
body{
margin: 0 10px;
}
.membername{
margin-left: 10px;
}
</style>
</head>
<body>
<div id="toorbar">
<div class="form-inline">
<div class="form-group">
<a class="btn btn-primary" href="javascript:openDetailIframe('detail.php');"><i class="glyphicon glyphicon-plus"></i> 添加新用户</a>
</div>
<div class="form-group">
<label class="control-label">类型:</label>
<select class="form-control" id="s_type">
<option value="">全部</option>
<option value="0">普通会员</option>
<option value="1">管理员</option>
</select>
</div>
</div>
</div>
<table id="table"></table>
<?php include('sysapp/global_module_detailIframe.php'); ?>
<?php include('sysapp/global_js.php'); ?>
<script>
$(function(){
$('#table').bootstrapTable({
height : $(window).height(),
url : 'index.ajax.php',
queryParams : function(params){
params['ac'] = 'getList';
params['type'] = $('#s_type').val();
return params;
},
columns : [
{
title : '头像',
field : 'avatar',
align : 'center',
valign : 'middle',
width : 70
},
{
title : '用户名',
field : 'username',
halign : 'left',
valign : 'middle',
sortable : true
},
{
title : '类型',
field : 'type',
align : 'center',
valign : 'middle',
width : 150
},
{
title : '操作',
field : 'do',
align : 'center',
valign : 'middle',
width : 150
}
],
striped : true, // 开启隔行换色
showRefresh : true, // 显示刷新按钮
// 工具栏
toolbar : '#toorbar',
// 搜索
search : true,
// 分页
pagination : true, // 开启分页
sidePagination : 'server', // 在服务器进行分页
paginationPreText : '上一页',
paginationNextText : '下一页',
});
$('#s_type').change(function(){
$('#table').bootstrapTable('refresh');
});
//删除
$('#table').on('click', '.do-del', function(){
var id = $(this).data().id;
var username = $(this).data().username;
swal({
type : 'warning',
title : '删除 “' + username + '” 用户',
showCancelButton : true,
confirmButtonText : '确认',
cancelButtonText : '取消',
closeOnConfirm : false,
showLoaderOnConfirm : true
}, function(){
$.ajax({
type : 'POST',
url : 'index.ajax.php',
data : 'ac=del&id=' + id
}).done(function(){
swal({
type: 'success',
title: '操作成功',
timer: 2000,
showConfirmButton: false
});
$('#table').bootstrapTable('refresh');
});
});
});
});
</script>
</body>
</html>