Repository navigation
Expand file tree
/
Copy pathadmin.js
More file actions
143 lines (131 loc) · 3.85 KB
/
Copy pathadmin.js
File metadata and controls
143 lines (131 loc) · 3.85 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
138
139
140
141
142
143
$('a[data-toggle=layout-small-menu]').on('click', function (e) {
e.preventDefault(), e.stopPropagation(), $('.layout-fixed-header').toggleClass("layout-small-menu");
});
var jc = new $.jc();
function len(o) {
var n, count = 0;
for (n in o) {
if (o.hasOwnProperty(n)) {
count++;
}
}
return count;
}
// 激活用户
$('.user-table .activeAccount').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'activeAccount'}, function (response) {
if (response) {
if (response.status == 200) {
window.location.reload();
} else {
alertError(response.msg);
}
}
});
});
// 重新发送激活邮件
$('.user-table .resendMail').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'resend'}, function (response) {
if (response) {
if (response.status == 200) {
alertOk('邮件已发送');
} else {
alertError(response.msg);
}
}
});
});
//禁用用户
$('.user-table .disable').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'disable'}, function (response) {
if (response) {
if (response.status == 200) {
window.location.reload();
} else {
jc.alertError(response.msg);
}
}
});
});
//取消管理员
$('.user-table .removeAdmin').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'removeAdmin'}, function (response) {
if (response) {
if (response.status == 200) {
window.location.reload();
} else {
jc.alertError(response.msg);
}
}
});
});
//设置管理员
$('.user-table .setAdmin').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'setAdmin'}, function (response) {
if (response) {
if (response.status == 200) {
window.location.reload();
} else {
jc.alertError(response.msg);
}
}
});
});
//恢复账户
$('.user-table .recoveryAccount').on('click', function () {
var uid = $(this).attr("uid");
$.post(BASE + '/admin/status', {uid: uid, type: 'recoveryAccount'}, function (response) {
if (response) {
if (response.status == 200) {
window.location.reload();
} else {
jc.alertError(response.msg);
}
}
});
});
var setting_data = {};
$("#setting_form :input").change(function () {
var key = $(this).attr('name');
if (key == 'allow_signup') {
setting_data[key] = $(this).is(':checked');
} else {
setting_data[key] = $(this).val();
}
});
// 保存系统设置
function save_settings() {
if (len(setting_data) > 0) {
$.post(BASE + '/admin/settings', setting_data, function (response) {
setting_data = {};
if (response) {
if (response.status == 200) {
jc.alertOk("保存成功!");
} else {
jc.alertError(response.msg);
}
}
});
}
return false;
}
// 修改节点
function update_node() {
var formData = $('#editnode_form').serialize();
$.post(BASE + '/admin/nodes/edit', formData, function (response) {
setting_data = {};
if (response) {
if (response.status == 200) {
jc.alertOk("修改成功!");
} else {
jc.alertError(response.msg);
}
}
});
return false;
}