frontUser.html
7.79 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
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
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('前台用户列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
登录账号:<input type="text" name="loginName"/>
</li>
<li>
用户邮箱:<input type="text" name="email"/>
</li>
<li>
手机号码:<input type="text" name="phoneNumber"/>
</li>
<li>
用户状态:
<select name="status" th:with="type=${@dict.getType('sys_normal_disable')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<!--<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="front:frontUser:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="front:frontUser:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="front:frontUser:remove">
<i class="fa fa-remove"></i> 删除
</a>-->
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="front:frontUser:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table" data-mobile-responsive="true"></table>
</div>
</div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('front:frontUser:edit')}]];
var removeFlag = [[${@permission.hasPermi('front:frontUser:remove')}]];
var resetPwdFlag = [[${@permission.hasPermi('system:user:edit')}]];
var openView = [[${@permission.hasPermi('front:frontUser:coinDetail')}]];
var addCoinView = [[${@permission.hasPermi('front:frontUser:addCoin')}]];
var prefix = ctx + "front/frontUser";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "前台用户",
showExport: true,
columns: [{
checkbox: true
},
{
field : 'userId',
title : '用户ID',
visible: false
},
{
field : 'loginName',
title : '登录账号',
sortable: true
},
{
field : 'userType',
title : '用户类型',
sortable: true
},
{
field : 'email',
title : '用户邮箱',
sortable: true
},
{
field : 'phoneNumber',
title : '手机号码',
sortable: true
},
{
field : 'userName',
title : '用户昵称',
sortable: true
},
{
visible: editFlag == 'hidden' ? false : true,
title: '用户状态',
align: 'center',
formatter: function (value, row, index) {
return statusTools(row);
}
},
{
visible: editFlag == 'hidden' ? false : true,
title: '删除标识',
align: 'center',
formatter: function (value, row, index) {
return delFlagTools(row);
}
},
{
field : 'inviternum',
title : '邀请人数',
sortable: true
},
{
field: 'createTime',
title: '创建时间',
sortable: true
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<apiDoc class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.userId + '\')"><i class="fa fa-edit"></i>编辑</apiDoc> ');
actions.push('<apiDoc class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.userId + '\')"><i class="fa fa-remove"></i>删除</apiDoc>');
actions.push('<a class="btn btn-info btn-xs ' + resetPwdFlag + '" href="javascript:void(0)" onclick="resetPwd(\'' + row.userId + '\')"><i class="fa fa-key"></i>重置</a>');
actions.push('<apiDoc class="btn btn-success btn-xs ' + openView + '" href="javascript:void(0)" onclick="coinDetail(\'' + row.userId + '\')"><i class="fa fa-edit"></i>兑换详情</apiDoc> ');
actions.push('<apiDoc class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="regDetail(\'' + row.userId + '\')"><i class="fa fa-edit"></i>注册详情</apiDoc> ');
actions.push('<apiDoc class="btn btn-info btn-xs ' + addCoinView + '" href="javascript:void(0)" onclick="addCoin(\'' + row.userId + '\')"><i class="fa fa-keyboard-o"></i>金币充值</apiDoc> ');
return actions.join('');
}
}]
};
$.table.init(options);
});
function addCoin(userId) {
var url = prefix + '/addCoin/' + userId;
$.modal.open("用户编号" + userId + "金币充值", url);
}
function coinDetail(userId) {
var url = prefix + '/coinDetail/' + userId;
createMenuItem(url, "编号" + userId + "邀请获金币");
}
/*注册详情*/
function regDetail(userId) {
var url = prefix + '/regDetail/' + userId;
createMenuItem(url, "编号" + userId + "注册详情");
}
/* 用户管理-重置密码 */
function resetPwd(userId) {
var url = prefix + '/resetPwd/' + userId;
$.modal.open("重置密码", url, '800', '300');
}
/* */
function statusTools(row) {
if (row.status == 1) {
return '<i class=\"fa fa-toggle-off text-info fa-2x\" onclick="enable(\'' + row.userId + '\')"></i> ';
} else {
return '<i class=\"fa fa-toggle-on text-info fa-2x\" onclick="disable(\'' + row.userId + '\')"></i> ';
}
}
/* 用户管理-停用 */
function disable(userId) {
$.modal.confirm("确认要停用用户吗?", function() {
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 1 });
})
}
/* 用户管理启用 */
function enable(userId) {
$.modal.confirm("确认要启用用户吗?", function() {
$.operate.post(prefix + "/changeStatus", { "userId": userId, "status": 0 });
})
}
/* 删除标识 */
function delFlagTools(row) {
if (row.delFlag == 1) {
// 如果一个用户既用手机号注册了,又用微信或者APP注册了,那么将这种账号暂时失效掉,绑定统一使用手机号账号,当手机账号删除时,再将这种账号恢复正常
return '<i title=\"该账号暂时被手机号绑定,当手机号删除时自动恢复该账号正常使用\">失效</i>';
} else if (row.delFlag == 0){
return '正常';
} else if (row.delFlag == 2){
return '已删除';
} else{
return '未知';
}
}
</script>
</body>
</html>