first commit
This commit is contained in:
161
target/classes/templates/admin/user/add.ftl
Normal file
161
target/classes/templates/admin/user/add.ftl
Normal file
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
<title>猫眼|用户管理-添加用户</title>
|
||||
<#include "../common/header.ftl"/>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lyear-layout-web">
|
||||
<div class="lyear-layout-container">
|
||||
<!--左侧导航-->
|
||||
<aside class="lyear-layout-sidebar">
|
||||
|
||||
<!-- logo -->
|
||||
<div id="logo" class="sidebar-header">
|
||||
<a href="index.html"><img src="/admin/images/logo.png" title="猫眼" alt="猫眼" /></a>
|
||||
</div>
|
||||
<div class="lyear-layout-sidebar-scroll">
|
||||
<#include "../common/left-menu.ftl"/>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
<!--End 左侧导航-->
|
||||
|
||||
<#include "../common/header-menu.ftl"/>
|
||||
|
||||
<!--页面主要内容-->
|
||||
<main class="lyear-layout-content">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header"><h4>添加用户</h4></div>
|
||||
<div class="card-body">
|
||||
<form action="add" id="user-add-form" method="post" class="row">
|
||||
<div class="form-group col-md-12">
|
||||
<label>头像上传</label>
|
||||
<div class="form-controls">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic">
|
||||
<li class="col-xs-4 col-sm-3 col-md-2">
|
||||
<figure>
|
||||
<img src="/admin/images/default-head.jpg" id="show-picture-img" alt="默认头像">
|
||||
</figure>
|
||||
</li>
|
||||
<input type="hidden" name="headPic" id="headPic">
|
||||
<input type="file" id="select-file" style="display:none;" onchange="upload('show-picture-img','headPic')">
|
||||
<li class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add" id="add-pic-btn" href="javascript:void(0)" title="点击上传"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">登陆名称</span>
|
||||
<input type="text" class="form-control required" id="username" name="username" value="" placeholder="请输入用户名" tips="请填写用户名" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">登录密码</span>
|
||||
<input type="password" class="form-control required" id="password" name="password" value="" placeholder="请输入登录密码" tips="请填写登录密码" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">所属角色</span>
|
||||
<select name="role.id" class="form-control" id="role">
|
||||
<#list roles as role>
|
||||
<option value="${role.id}">${role.name}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">手机号码</span>
|
||||
<input type="tel" class="form-control" id="mobile" name="mobile" value="" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">邮箱账号</span>
|
||||
<input type="email" class="form-control" id="email" name="email" value="" />
|
||||
</div>
|
||||
<div class="input-group" style="margin-top:15px;margin-bottom:15px;padding-left:25px;">
|
||||
性别:
|
||||
<label class="lyear-radio radio-inline radio-primary" style="margin-left:30px;">
|
||||
<input type="radio" name="sex" value="1" checked="" >
|
||||
<span>男</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="sex" value="2">
|
||||
<span>女</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="sex" value="0">
|
||||
<span>未知</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group" style="margin-top:15px;margin-bottom:15px;padding-left:25px;">
|
||||
状态:
|
||||
<label class="lyear-radio radio-inline radio-primary" style="margin-left:30px;">
|
||||
<input type="radio" name="status" value="1" checked="">
|
||||
<span>正常</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="status" value="0">
|
||||
<span>冻结</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="button" class="btn btn-primary ajax-post" id="add-form-submit-btn">确 定</button>
|
||||
<button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<!--End 页面主要内容-->
|
||||
</div>
|
||||
</div>
|
||||
<#include "../common/footer.ftl"/>
|
||||
<script type="text/javascript" src="/admin/js/perfect-scrollbar.min.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/main.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
//提交按钮监听事件
|
||||
$("#add-form-submit-btn").click(function(){
|
||||
if(!checkForm("user-add-form")){
|
||||
return;
|
||||
}
|
||||
var data = $("#user-add-form").serialize();
|
||||
$.ajax({
|
||||
url:'add',
|
||||
type:'POST',
|
||||
data:data,
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
showSuccessMsg('用户添加成功!',function(){
|
||||
window.location.href = 'list';
|
||||
})
|
||||
}else{
|
||||
showErrorMsg(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
alert('网络错误!');
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听上传图片按钮
|
||||
$("#add-pic-btn").click(function(){
|
||||
$("#select-file").click();
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
165
target/classes/templates/admin/user/edit.ftl
Normal file
165
target/classes/templates/admin/user/edit.ftl
Normal file
@@ -0,0 +1,165 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
<title>猫眼|用户管理-编辑用户</title>
|
||||
<#include "../common/header.ftl"/>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lyear-layout-web">
|
||||
<div class="lyear-layout-container">
|
||||
<!--左侧导航-->
|
||||
<aside class="lyear-layout-sidebar">
|
||||
|
||||
<!-- logo -->
|
||||
<div id="logo" class="sidebar-header">
|
||||
<a href="index.html"><img src="/admin/images/logo.png" title="猫眼" alt="猫眼" /></a>
|
||||
</div>
|
||||
<div class="lyear-layout-sidebar-scroll">
|
||||
<#include "../common/left-menu.ftl"/>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
<!--End 左侧导航-->
|
||||
|
||||
<#include "../common/header-menu.ftl"/>
|
||||
|
||||
<!--页面主要内容-->
|
||||
<main class="lyear-layout-content">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header"><h4>编辑用户</h4></div>
|
||||
<div class="card-body">
|
||||
<form action="add" id="user-add-form" method="post" class="row">
|
||||
<input type="hidden" name="id" value="${user.id}">
|
||||
<div class="form-group col-md-12">
|
||||
<label>头像上传</label>
|
||||
<div class="form-controls">
|
||||
<ul class="list-inline clearfix lyear-uploads-pic">
|
||||
<li class="col-xs-4 col-sm-3 col-md-2">
|
||||
<figure>
|
||||
<#if user.headPic?length gt 0>
|
||||
<img src="/photo/view?filename=${user.headPic}" id="show-picture-img">
|
||||
<#else>
|
||||
<img src="/admin/images/default-head.jpg" id="show-picture-img" alt="默认头像">
|
||||
</#if>
|
||||
</figure>
|
||||
</li>
|
||||
<input type="hidden" name="headPic" id="headPic" value="${user.headPic}">
|
||||
<input type="file" id="select-file" style="display:none;" onchange="upload('show-picture-img','headPic')">
|
||||
<li class="col-xs-4 col-sm-3 col-md-2">
|
||||
<a class="pic-add" id="add-pic-btn" href="javascript:void(0)" title="点击上传"></a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">登陆名称</span>
|
||||
<input type="text" class="form-control required" id="username" name="username" value="${user.username}" placeholder="请输入用户名" tips="请填写用户名" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">登录密码</span>
|
||||
<input type="password" class="form-control required" id="password" name="password" value="${user.password}" placeholder="请输入登录密码" tips="请填写登录密码" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">所属角色</span>
|
||||
<select name="role.id" class="form-control" id="role">
|
||||
<#list roles as role>
|
||||
<option value="${role.id}" <#if user.role.id == role.id>selected</#if> >${role.name}</option>
|
||||
</#list>
|
||||
</select>
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">手机号码</span>
|
||||
<input type="tel" class="form-control" id="mobile" name="mobile" value="${user.mobile}" />
|
||||
</div>
|
||||
<div class="input-group m-b-10">
|
||||
<span class="input-group-addon">邮箱账号</span>
|
||||
<input type="email" class="form-control" id="email" name="email" value="${user.email}" />
|
||||
</div>
|
||||
<div class="input-group" style="margin-top:15px;margin-bottom:15px;padding-left:25px;">
|
||||
性别:
|
||||
<label class="lyear-radio radio-inline radio-primary" style="margin-left:30px;">
|
||||
<input type="radio" name="sex" value="1" <#if user.sex == 1> checked </#if> >
|
||||
<span>男</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="sex" value="2" <#if user.sex == 2> checked </#if>>
|
||||
<span>女</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="sex" value="0" <#if user.sex == 0> checked </#if>>
|
||||
<span>未知</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="input-group" style="margin-top:15px;margin-bottom:15px;padding-left:25px;">
|
||||
状态:
|
||||
<label class="lyear-radio radio-inline radio-primary" style="margin-left:30px;">
|
||||
<input type="radio" name="status" value="1" <#if user.status == 1> checked </#if>>
|
||||
<span>正常</span>
|
||||
<label class="lyear-radio radio-inline radio-primary">
|
||||
<input type="radio" name="status" value="0" <#if user.status == 0> checked </#if>>
|
||||
<span>冻结</span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-group col-md-12">
|
||||
<button type="button" class="btn btn-primary ajax-post" id="add-form-submit-btn">确 定</button>
|
||||
<button type="button" class="btn btn-default" onclick="javascript:history.back(-1);return false;">返 回</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<!--End 页面主要内容-->
|
||||
</div>
|
||||
</div>
|
||||
<#include "../common/footer.ftl"/>
|
||||
<script type="text/javascript" src="/admin/js/perfect-scrollbar.min.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/main.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
//提交按钮监听事件
|
||||
$("#add-form-submit-btn").click(function(){
|
||||
if(!checkForm("user-add-form")){
|
||||
return;
|
||||
}
|
||||
var data = $("#user-add-form").serialize();
|
||||
$.ajax({
|
||||
url:'edit',
|
||||
type:'POST',
|
||||
data:data,
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
showSuccessMsg('用户编辑成功!',function(){
|
||||
window.location.href = 'list';
|
||||
})
|
||||
}else{
|
||||
showErrorMsg(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
alert('网络错误!');
|
||||
}
|
||||
});
|
||||
});
|
||||
//监听上传图片按钮
|
||||
$("#add-pic-btn").click(function(){
|
||||
$("#select-file").click();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
226
target/classes/templates/admin/user/list.ftl
Normal file
226
target/classes/templates/admin/user/list.ftl
Normal file
@@ -0,0 +1,226 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="zh">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" />
|
||||
<title>猫眼|用户管理-${title!""}</title>
|
||||
<#include "../common/header.ftl"/>
|
||||
<style>
|
||||
td{
|
||||
vertical-align:middle;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="lyear-layout-web">
|
||||
<div class="lyear-layout-container">
|
||||
<!--左侧导航-->
|
||||
<aside class="lyear-layout-sidebar">
|
||||
|
||||
<!-- logo -->
|
||||
<div id="logo" class="sidebar-header">
|
||||
<a href="index.html"><img src="/admin/images/logo.png" title="猫眼" alt="猫眼" /></a>
|
||||
</div>
|
||||
<div class="lyear-layout-sidebar-scroll">
|
||||
<#include "../common/left-menu.ftl"/>
|
||||
</div>
|
||||
|
||||
</aside>
|
||||
<!--End 左侧导航-->
|
||||
|
||||
<#include "../common/header-menu.ftl"/>
|
||||
|
||||
<!--页面主要内容-->
|
||||
<main class="lyear-layout-content">
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-toolbar clearfix">
|
||||
<form class="pull-right search-bar" method="get" action="list" role="form">
|
||||
<div class="input-group">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default dropdown-toggle" id="search-btn" data-toggle="dropdown" type="button" aria-haspopup="true" aria-expanded="false">
|
||||
用户名 <span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li> <a tabindex="-1" href="javascript:void(0)" data-field="title">用户名</a> </li>
|
||||
</ul>
|
||||
</div>
|
||||
<input type="text" class="form-control" value="${username!""}" name="username" placeholder="请输入用户名">
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="submit">搜索</button>
|
||||
</span>
|
||||
</div>
|
||||
</form>
|
||||
<#include "../common/third-menu.ftl"/>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<label class="lyear-checkbox checkbox-primary">
|
||||
<input type="checkbox" id="check-all"><span></span>
|
||||
</label>
|
||||
</th>
|
||||
<th>头像</th>
|
||||
<th>用户名</th>
|
||||
<th>角色</th>
|
||||
<th>状态</th>
|
||||
<th>性别</th>
|
||||
<th>手机</th>
|
||||
<th>邮箱</th>
|
||||
<th>添加时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if pageBean.content?size gt 0>
|
||||
<#list pageBean.content as user>
|
||||
<tr>
|
||||
<td style="vertical-align:middle;">
|
||||
<label class="lyear-checkbox checkbox-primary">
|
||||
<input type="checkbox" name="ids[]" value="${user.id}"><span></span>
|
||||
</label>
|
||||
</td>
|
||||
<td style="vertical-align:middle;">
|
||||
<#if user.headPic??>
|
||||
<#if user.headPic?length gt 0>
|
||||
<img src="/photo/view?filename=${user.headPic}" width="60px" height="60px">
|
||||
<#else>
|
||||
<img src="/admin/images/default-head.jpg" width="60px" height="60px">
|
||||
</#if>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="vertical-align:middle;">${user.username}</td>
|
||||
<td style="vertical-align:middle;">${user.role.name}</td>
|
||||
<td style="vertical-align:middle;">
|
||||
<#if user.status == 1>
|
||||
<font class="text-success">正常</font>
|
||||
<#else>
|
||||
<font class="text-warning">冻结</font>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="vertical-align:middle;">
|
||||
<#if user.sex == 1>
|
||||
<font class="text-success">男</font>
|
||||
<#elseif user.sex == 2>
|
||||
<font class="text-info">女</font>
|
||||
<#else>
|
||||
<font class="text-warning">未知</font>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="vertical-align:middle;" align="center">${user.mobile}</td>
|
||||
<td style="vertical-align:middle;" align="center">${user.email}</td>
|
||||
<td style="vertical-align:middle;" style="vertical-align:middle;"><font class="text-success">${user.createTime}</font></td>
|
||||
</tr>
|
||||
</#list>
|
||||
<#else>
|
||||
<tr align="center"><td colspan="9">这里空空如也!</td></tr>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<#if pageBean.total gt 0>
|
||||
<ul class="pagination ">
|
||||
<#if pageBean.currentPage == 1>
|
||||
<li class="disabled"><span>«</span></li>
|
||||
<#else>
|
||||
<li><a href="list?username=${username!""}¤tPage=1">«</a></li>
|
||||
</#if>
|
||||
<#list pageBean.currentShowPage as showPage>
|
||||
<#if pageBean.currentPage == showPage>
|
||||
<li class="active"><span>${showPage}</span></li>
|
||||
<#else>
|
||||
<li><a href="list?username=${username!""}¤tPage=${showPage}">${showPage}</a></li>
|
||||
</#if>
|
||||
</#list>
|
||||
<#if pageBean.currentPage == pageBean.totalPage>
|
||||
<li class="disabled"><span>»</span></li>
|
||||
<#else>
|
||||
<li><a href="list?username=${username!""}¤tPage=${pageBean.totalPage}">»</a></li>
|
||||
</#if>
|
||||
<li><span>共${pageBean.totalPage}页,${pageBean.total}条数据</span></li>
|
||||
</ul>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
<!--End 页面主要内容-->
|
||||
</div>
|
||||
</div>
|
||||
<#include "../common/footer.ftl"/>
|
||||
<script type="text/javascript" src="/admin/js/perfect-scrollbar.min.js"></script>
|
||||
<script type="text/javascript" src="/admin/js/main.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function(){
|
||||
|
||||
});
|
||||
function del(url){
|
||||
if($("input[type='checkbox']:checked").length != 1){
|
||||
showWarningMsg('请选择一条数据进行删除!');
|
||||
return;
|
||||
}
|
||||
var id = $("input[type='checkbox']:checked").val();
|
||||
$.confirm({
|
||||
title: '确定删除?',
|
||||
content: '删除后数据不可恢复,请慎重!',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
action: function(){
|
||||
deleteReq(id,url);
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '关闭',
|
||||
action: function(){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//打开编辑页面
|
||||
function edit(url){
|
||||
if($("input[type='checkbox']:checked").length != 1){
|
||||
showWarningMsg('请选择一条数据进行编辑!');
|
||||
return;
|
||||
}
|
||||
window.location.href = url + '?id=' + $("input[type='checkbox']:checked").val();
|
||||
}
|
||||
//调用删除方法
|
||||
function deleteReq(id,url){
|
||||
$.ajax({
|
||||
url:url,
|
||||
type:'POST',
|
||||
data:{id:id},
|
||||
dataType:'json',
|
||||
success:function(data){
|
||||
if(data.code == 0){
|
||||
showSuccessMsg('用户删除成功!',function(){
|
||||
$("input[type='checkbox']:checked").parents("tr").remove();
|
||||
})
|
||||
}else{
|
||||
showErrorMsg(data.msg);
|
||||
}
|
||||
},
|
||||
error:function(data){
|
||||
alert('网络错误!');
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user