完成文章基本管理示例
This commit is contained in:
parent
b694d51e05
commit
38fd4b7dc6
|
@ -1,63 +0,0 @@
|
|||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>新增</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="${basePath}/manage/index">首页</a> > <a href="${basePath}/manage/article/list">文章列表</a> > 新增
|
||||
</div>
|
||||
<div>
|
||||
<form method="post">
|
||||
<table border="1">
|
||||
<tr><td>标题:</td><td><input type="text" name="title" autofocus/></td></tr>
|
||||
<tr><td>原作者:</td><td><input type="text" name="author"/></td></tr>
|
||||
<tr><td>来源:</td><td><input type="text" name="fromurl"/></td></tr>
|
||||
<tr><td>封面图:</td><td><input type="text" name="image"/></td></tr>
|
||||
<tr><td>关键字:</td><td><input type="text" name="keywords"/></td></tr>
|
||||
<tr><td>简介:</td><td><input type="text" name="description"/></td></tr>
|
||||
<tr>
|
||||
<td>类型:</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="1">普通</option>
|
||||
<option value="2">热门</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否允许评论:</td>
|
||||
<td>
|
||||
<select name="allowcomments">
|
||||
<option value="1">允许</option>
|
||||
<option value="0">不允许</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态:</td>
|
||||
<td>
|
||||
<select name="status">
|
||||
<option value="0">未审核</option>
|
||||
<option value="-1">不通过</option>
|
||||
<option value="1">通过</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>内容:</td><td><input type="text" name="content"/></td></tr>
|
||||
<tr><td>发布人ID:</td><td><input type="text" name="userId"/></td></tr>
|
||||
<tr><td>阅读量:</td><td><input type="text" name="readnumber" value="0"/></td></tr>
|
||||
<tr><td></td><td><a href="${basePath}/manage/article/list">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,203 @@
|
|||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
|
||||
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||
<div id="createDialog" class="crudDialog">
|
||||
<form id="createForm" method="post">
|
||||
<input type="hidden" name="userId" value="1">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="title">标题</label>
|
||||
<input id="title" type="text" class="form-control" name="title" maxlength="200">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="description">描述</label>
|
||||
<input id="description" type="text" class="form-control" name="description" maxlength="500">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="author">作者</label>
|
||||
<input id="author" type="text" class="form-control" name="author" maxlength="20">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="fromurl">来源</label>
|
||||
<input id="fromurl" type="text" class="form-control" name="fromurl" maxlength="300">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="keywords">关键字</label>
|
||||
<input id="keywords" type="text" class="form-control" name="keywords" maxlength="100">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="image">封面图</label>
|
||||
<input id="image" type="text" class="form-control" name="image" maxlength="300" value="http://">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="readnumber">阅读数量</label>
|
||||
<input id="readnumber" type="text" class="form-control" name="readnumber" value="0">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="ctime">创建时间</label>
|
||||
<input id="ctime" type="text" class="form-control" name="ctime">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="content">内容</label>
|
||||
<input id="content" type="text" class="form-control" name="content">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>类型</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="type_1" type="radio" name="type" value="1" checked>
|
||||
<label for="type_1">普通 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="type_2" type="radio" name="type" value="2">
|
||||
<label for="type_2">热门 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>评论</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="allowcomments_1" type="radio" name="allowcomments" value="1" checked>
|
||||
<label for="allowcomments_1">允许 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="allowcomments_0" type="radio" name="allowcomments" value="0">
|
||||
<label for="allowcomments_0">不允许 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>状态</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="status_-1" type="radio" name="status" value="-1">
|
||||
<label for="status_-1">不通过 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="status_0" type="radio" name="status" value="0" checked>
|
||||
<label for="status_0">待审核 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-success">
|
||||
<input id="status_1" type="radio" name="status" value="1">
|
||||
<label for="status_1">已通过 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right dialog-buttons">
|
||||
<a class="waves-effect waves-button" href="javascript:;" onclick="createSubmit();">保存</a>
|
||||
<a class="waves-effect waves-button" href="javascript:;" onclick="createDialog.close();">取消</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
function createSubmit() {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '${basePath}/manage/article/create',
|
||||
data: $('#createForm').serialize(),
|
||||
beforeSend: function() {
|
||||
if ($('#title').val() == '') {
|
||||
$('#title').focus();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.code != 1) {
|
||||
if (result.data instanceof Array) {
|
||||
$.each(result.data, function(index, value) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: value.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: result.data.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
createDialog.close();
|
||||
$table.bootstrapTable('refresh');
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: textStatus,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
|
@ -0,0 +1,237 @@
|
|||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
|
||||
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="zh-cn">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>文章管理</title>
|
||||
<jsp:include page="/resources/inc/head.jsp" flush="true"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="main">
|
||||
<div id="toolbar">
|
||||
<shiro:hasPermission name="cms:article:create"><a class="waves-effect waves-button" href="javascript:;" onclick="createAction()"><i class="zmdi zmdi-plus"></i> 新增文章</a></shiro:hasPermission>
|
||||
<shiro:hasPermission name="cms:article:update"><a class="waves-effect waves-button" href="javascript:;" onclick="updateAction()"><i class="zmdi zmdi-edit"></i> 编辑文章</a></shiro:hasPermission>
|
||||
<shiro:hasPermission name="cms:article:delete"><a class="waves-effect waves-button" href="javascript:;" onclick="deleteAction()"><i class="zmdi zmdi-close"></i> 删除文章</a></shiro:hasPermission>
|
||||
</div>
|
||||
<table id="table"></table>
|
||||
</div>
|
||||
<jsp:include page="/resources/inc/footer.jsp" flush="true"/>
|
||||
<script>
|
||||
var $table = $('#table');
|
||||
$(function() {
|
||||
// bootstrap table初始化
|
||||
$table.bootstrapTable({
|
||||
url: '${basePath}/manage/article/list',
|
||||
height: getHeight(),
|
||||
striped: true,
|
||||
search: true,
|
||||
showRefresh: true,
|
||||
showColumns: true,
|
||||
minimumCountColumns: 2,
|
||||
clickToSelect: true,
|
||||
detailView: true,
|
||||
detailFormatter: 'detailFormatter',
|
||||
pagination: true,
|
||||
paginationLoop: false,
|
||||
sidePagination: 'server',
|
||||
silentSort: false,
|
||||
smartDisplay: false,
|
||||
escape: true,
|
||||
searchOnEnterKey: true,
|
||||
idField: 'articleId',
|
||||
maintainSelected: true,
|
||||
toolbar: '#toolbar',
|
||||
columns: [
|
||||
{field: 'ck', checkbox: true},
|
||||
{field: 'articleId', title: '编号', sortable: true, align: 'center'},
|
||||
{field: 'title', title: '标题'},
|
||||
{field: 'author', title: '作者'},
|
||||
{field: 'description', title: '描述'},
|
||||
{field: 'type', title: '类型', sortable: true, align: 'center', formatter: 'typeFormatter'},
|
||||
{field: 'status', title: '审核', sortable: true, align: 'center', formatter: 'statusFormatter'},
|
||||
{field: 'readnumber', title: '阅读量'},
|
||||
{field: 'action', title: '操作', align: 'center', formatter: 'actionFormatter', events: 'actionEvents', clickToSelect: false}
|
||||
]
|
||||
});
|
||||
});
|
||||
// 格式化操作按钮
|
||||
function actionFormatter(value, row, index) {
|
||||
return [
|
||||
'<a class="update" href="javascript:;" onclick="updateAction()" data-toggle="tooltip" title="Edit"><i class="glyphicon glyphicon-edit"></i></a> ',
|
||||
'<a class="delete" href="javascript:;" onclick="deleteAction()" data-toggle="tooltip" title="Remove"><i class="glyphicon glyphicon-remove"></i></a>'
|
||||
].join('');
|
||||
}
|
||||
// 格式化类型
|
||||
function typeFormatter(value, row, index) {
|
||||
if (value == 1) {
|
||||
return '<span class="label label-primary">普通</span>';
|
||||
}
|
||||
if (value == 2) {
|
||||
return '<span class="label label-danger">热门</span>';
|
||||
}
|
||||
}
|
||||
// 格式化状态
|
||||
function statusFormatter(value, row, index) {
|
||||
if (value == -1) {
|
||||
return '<span class="label label-danger">不通过</span>';
|
||||
}
|
||||
if (value == 0) {
|
||||
return '<span class="label label-primary">待审核</span>';
|
||||
}
|
||||
if (value == 1) {
|
||||
return '<span class="label label-success">已通过</span>';
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
var createDialog;
|
||||
function createAction() {
|
||||
createDialog = $.dialog({
|
||||
animationSpeed: 300,
|
||||
title: '新增文章',
|
||||
columnClass: 'xlarge',
|
||||
content: 'url:${basePath}/manage/article/create',
|
||||
onContentReady: function () {
|
||||
initMaterialInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
// 编辑
|
||||
var updateDialog;
|
||||
function updateAction() {
|
||||
var rows = $table.bootstrapTable('getSelections');
|
||||
if (rows.length != 1) {
|
||||
$.confirm({
|
||||
title: false,
|
||||
content: '请选择一条记录!',
|
||||
autoClose: 'cancel|3000',
|
||||
backgroundDismiss: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: '取消',
|
||||
btnClass: 'waves-effect waves-button'
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
updateDialog = $.dialog({
|
||||
animationSpeed: 300,
|
||||
title: '编辑文章',
|
||||
columnClass: 'xlarge',
|
||||
content: 'url:${basePath}/manage/article/update/' + rows[0].articleId,
|
||||
onContentReady: function () {
|
||||
initMaterialInput();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
// 删除
|
||||
var deleteDialog;
|
||||
function deleteAction() {
|
||||
var rows = $table.bootstrapTable('getSelections');
|
||||
if (rows.length == 0) {
|
||||
$.confirm({
|
||||
title: false,
|
||||
content: '请至少选择一条记录!',
|
||||
autoClose: 'cancel|3000',
|
||||
backgroundDismiss: true,
|
||||
buttons: {
|
||||
cancel: {
|
||||
text: '取消',
|
||||
btnClass: 'waves-effect waves-button'
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
deleteDialog = $.confirm({
|
||||
type: 'red',
|
||||
animationSpeed: 300,
|
||||
title: false,
|
||||
content: '确认删除该文章吗?',
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button',
|
||||
action: function () {
|
||||
var ids = new Array();
|
||||
for (var i in rows) {
|
||||
ids.push(rows[i].articleId);
|
||||
}
|
||||
$.ajax({
|
||||
type: 'get',
|
||||
url: '${basePath}/manage/article/delete/' + ids.join("-"),
|
||||
success: function(result) {
|
||||
if (result.code != 1) {
|
||||
if (result.data instanceof Array) {
|
||||
$.each(result.data, function(index, value) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: value.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: result.data.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
deleteDialog.close();
|
||||
$table.bootstrapTable('refresh');
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: textStatus,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
cancel: {
|
||||
text: '取消',
|
||||
btnClass: 'waves-effect waves-button'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -1,84 +0,0 @@
|
|||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>列表</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="${basePath}/manage/index">首页</a> > 文章列表
|
||||
</div>
|
||||
<div>
|
||||
<table border="1">
|
||||
<caption><a href="${basePath}/manage/article/add">新增</a></caption>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>标题</th>
|
||||
<th>原作者</th>
|
||||
<th>来源</th>
|
||||
<th>封面图</th>
|
||||
<th>关键字</th>
|
||||
<th>简介</th>
|
||||
<th>类型</th>
|
||||
<th>是否允许评论</th>
|
||||
<th>状态</th>
|
||||
<th>内容</th>
|
||||
<th>发布人ID</th>
|
||||
<th>阅读数</th>
|
||||
<th>创建时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<c:forEach var="article" items="${articles}">
|
||||
<tr>
|
||||
<td>${article.articleId}</td>
|
||||
<td>${article.title}</td>
|
||||
<td>${article.author}</td>
|
||||
<td>${article.fromurl}</td>
|
||||
<td>${article.image}</td>
|
||||
<td>${article.keywords}</td>
|
||||
<td>${article.description}</td>
|
||||
<td>
|
||||
<c:if test="${article.type==1}">普通</c:if>
|
||||
<c:if test="${article.type==2}">热门</c:if>
|
||||
</td>
|
||||
<td>
|
||||
<c:if test="${article.allowcomments==0}">不允许</c:if>
|
||||
<c:if test="${article.allowcomments==1}">允许</c:if>
|
||||
</td>
|
||||
<td>
|
||||
<c:if test="${article.status==-1}">不通过</c:if>
|
||||
<c:if test="${article.status==0}">未审核</c:if>
|
||||
<c:if test="${article.status==1}">通过</c:if>
|
||||
</td>
|
||||
<td>${article.content}</td>
|
||||
<td>${article.userId}</td>
|
||||
<td>${article.readnumber}</td>
|
||||
<td>
|
||||
<jsp:useBean id="date" class="java.util.Date"/>
|
||||
<jsp:setProperty name="date" property="time" value="${article.ctime}"/>
|
||||
<fmt:formatDate value="${date}" type="both" pattern="yyyy-MM-dd HH:mm:ss" timeZone="Asia/Shanghai"/>
|
||||
</td>
|
||||
<td>
|
||||
<a href="${basePath}/manage/article/update/${article.articleId}">修改</a>
|
||||
<a href="${basePath}/manage/article/delete/${article.articleId}" onclick="return confirm('确认删除吗?');">删除</a>
|
||||
<a href="${basePath}/manage/article/up/${article.articleId}">上移</a>
|
||||
<a href="${basePath}/manage/article/down/${article.articleId}">下移</a>
|
||||
</td>
|
||||
</tr>
|
||||
</c:forEach>
|
||||
</tbody>
|
||||
</table>
|
||||
<div>${paginator.html}</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,64 +1,203 @@
|
|||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ page contentType="text/html; charset=utf-8"%>
|
||||
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
|
||||
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
|
||||
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
|
||||
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
|
||||
<c:set var="basePath" value="${pageContext.request.contextPath}"/>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>编辑</title>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<a href="${basePath}/manage/index">首页</a> > <a href="${basePath}/manage/article/list">文章列表</a> > 编辑
|
||||
</div>
|
||||
<div>
|
||||
<form method="post">
|
||||
<table border="1">
|
||||
<input type="hidden" name="articleId" value="${article.articleId}"/>
|
||||
<tr><td>标题:</td><td><input type="text" name="title" value="${article.title}"/></td></tr>
|
||||
<tr><td>原作者:</td><td><input type="text" name="author" value="${article.author}"/></td></tr>
|
||||
<tr><td>来源:</td><td><input type="text" name="fromurl" value="${article.fromurl}"/></td></tr>
|
||||
<tr><td>封面图:</td><td><input type="text" name="image" value="${article.image}"/></td></tr>
|
||||
<tr><td>关键字:</td><td><input type="text" name="keywords" value="${article.keywords}"/></td></tr>
|
||||
<tr><td>简介:</td><td><input type="text" name="description" value="${article.description}"/></td></tr>
|
||||
<tr>
|
||||
<td>类型:</td>
|
||||
<td>
|
||||
<select name="type">
|
||||
<option value="1" <c:if test="${article.type==1}">selected="selected"</c:if>>普通</option>
|
||||
<option value="2" <c:if test="${article.type==2}">selected="selected"</c:if>>热门</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>是否允许评论:</td>
|
||||
<td>
|
||||
<select name="allowcomments">
|
||||
<option value="1" <c:if test="${article.allowcomments==1}">selected="selected"</c:if>>允许</option>
|
||||
<option value="0" <c:if test="${article.allowcomments==0}">selected="selected"</c:if>>不允许</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>状态:</td>
|
||||
<td>
|
||||
<select name="status">
|
||||
<option value="0" <c:if test="${article.status==0}">selected="selected"</c:if>>未审核</option>
|
||||
<option value="-1" <c:if test="${article.status==-1}">selected="selected"</c:if>>不通过</option>
|
||||
<option value="1" <c:if test="${article.status==1}">selected="selected"</c:if>>通过</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td>内容:</td><td><input type="text" name="content" value="${article.content}"/></td></tr>
|
||||
<tr><td>发布人ID:</td><td><input type="text" name="userId" value="${article.userId}"/></td></tr>
|
||||
<tr><td>阅读量:</td><td><input type="text" name="readnumber" value="${article.readnumber}"/></td></tr>
|
||||
<tr><td></td><td><a href="${basePath}/manage/article/list">取消</a> <input type="submit" value="保存"/></td></tr>
|
||||
</table>
|
||||
<div id="updateDialog" class="crudDialog">
|
||||
<form id="updateForm" method="post">
|
||||
<input type="hidden" name="userId" value="1">
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="title">标题</label>
|
||||
<input id="title" type="text" class="form-control" name="title" maxlength="200" value="${article.title}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="description">描述</label>
|
||||
<input id="description" type="text" class="form-control" name="description" maxlength="500" value="${article.description}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="author">作者</label>
|
||||
<input id="author" type="text" class="form-control" name="author" maxlength="20" value="${article.author}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="fromurl">来源</label>
|
||||
<input id="fromurl" type="text" class="form-control" name="fromurl" maxlength="300" value="${article.fromurl}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="keywords">关键字</label>
|
||||
<input id="keywords" type="text" class="form-control" name="keywords" maxlength="100" value="${article.keywords}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="image">封面图</label>
|
||||
<input id="image" type="text" class="form-control" name="image" maxlength="300" value="${article.image}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="readnumber">阅读数量</label>
|
||||
<input id="readnumber" type="text" class="form-control" name="readnumber" value="0" value="${article.readnumber}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="ctime">创建时间</label>
|
||||
<input id="ctime" type="text" class="form-control" name="ctime" value="${article.ctime}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<div class="fg-line">
|
||||
<label for="content">内容</label>
|
||||
<input id="content" type="text" class="form-control" name="content" value="${article.content}">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>类型</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="type_1" type="radio" name="type" value="1" <c:if test="${article.type==1}">checked</c:if>>
|
||||
<label for="type_1">普通 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="type_2" type="radio" name="type" value="2" <c:if test="${article.type==2}">checked</c:if>>
|
||||
<label for="type_2">热门 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>评论</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="allowcomments_1" type="radio" name="allowcomments" value="1" <c:if test="${article.allowcomments==1}">checked</c:if>>
|
||||
<label for="allowcomments_1">允许 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="allowcomments_0" type="radio" name="allowcomments" value="0" <c:if test="${article.allowcomments==0}">checked</c:if>>
|
||||
<label for="allowcomments_0">不允许 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<label>状态</label>
|
||||
<div class="radio">
|
||||
<div class="radio radio-inline radio-danger">
|
||||
<input id="status_-1" type="radio" name="status" value="-1" <c:if test="${article.status==-1}">checked</c:if>>
|
||||
<label for="status_-1">不通过 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-info">
|
||||
<input id="status_0" type="radio" name="status" value="0" <c:if test="${article.status==0}">checked</c:if>>
|
||||
<label for="status_0">待审核 </label>
|
||||
</div>
|
||||
<div class="radio radio-inline radio-success">
|
||||
<input id="status_1" type="radio" name="status" value="1" <c:if test="${article.status==1}">checked</c:if>>
|
||||
<label for="status_1">已通过 </label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group text-right dialog-buttons">
|
||||
<a class="waves-effect waves-button" href="javascript:;" onclick="updateSubmit();">保存</a>
|
||||
<a class="waves-effect waves-button" href="javascript:;" onclick="updateDialog.close();">取消</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
function updateSubmit() {
|
||||
$.ajax({
|
||||
type: 'post',
|
||||
url: '${basePath}/manage/article/update/${article.articleId}',
|
||||
data: $('#updateForm').serialize(),
|
||||
beforeSend: function() {
|
||||
if ($('#title').val() == '') {
|
||||
$('#title').focus();
|
||||
return false;
|
||||
}
|
||||
},
|
||||
success: function(result) {
|
||||
if (result.code != 1) {
|
||||
if (result.data instanceof Array) {
|
||||
$.each(result.data, function(index, value) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: value.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: result.data.errorMsg,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
updateDialog.close();
|
||||
$table.bootstrapTable('refresh');
|
||||
}
|
||||
},
|
||||
error: function(XMLHttpRequest, textStatus, errorThrown) {
|
||||
$.confirm({
|
||||
theme: 'dark',
|
||||
animation: 'rotateX',
|
||||
closeAnimation: 'rotateX',
|
||||
title: false,
|
||||
content: textStatus,
|
||||
buttons: {
|
||||
confirm: {
|
||||
text: '确认',
|
||||
btnClass: 'waves-effect waves-button waves-light'
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
Loading…
Reference in New Issue