mirror of https://github.com/1099438829/apeblog
123 lines
5.8 KiB
HTML
123 lines
5.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
<head>
|
|
<title>添加分类 - {:system_config('title')}后台管理系统</title>
|
|
{include file="public/header" /}
|
|
</head>
|
|
<body>
|
|
<div class="row">
|
|
<div class="col-lg-12">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h4>基本信息</h4>
|
|
<ul class="card-actions">
|
|
<li>
|
|
<button type="button" data-toggle="tooltip" title="" data-original-title="返回"
|
|
onclick="history.back(-1);return false;"><i class="mdi mdi-undo"></i></button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="card-body">
|
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
|
<div class="form-group col-md-12">
|
|
<label for="title">分类名称</label>
|
|
<input type="text" class="form-control" id="title" name="title" value="" placeholder="分类名称"/>
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<div class="row">
|
|
<div class="col-xs-3">
|
|
<label for="pid">上级分类</label>
|
|
<div class="form-controls">
|
|
<select name="pid" id="pid" class="form-control">
|
|
<option value="0">顶级分类</option>
|
|
{volist name="category" id="vo"}
|
|
<option value="{$vo.id}" {notempty name="pid" }{if $vo.id== $pid}selected{/if}{/notempty}>{$vo.html}{$vo.title}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-3">
|
|
<label>展示模板</label>
|
|
<div class="form-group form-controls">
|
|
<select name="template" class="form-control">
|
|
{volist name="template_list" id="vo"}
|
|
<option value="{$vo.template}">{$vo.name}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-xs-3">
|
|
<label for="alias">URL名称</label>
|
|
<input class="form-control" id="alias" name="alias" type="text" placeholder="URL名称">
|
|
</div>
|
|
<div class="col-xs-3">
|
|
<label for="sort">排序</label>
|
|
<input type="text" class="form-control" id="sort" name="sort" placeholder="请输入排序" value="99">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="meta_title">seo标题</label>
|
|
<input type="text" class="form-control" id="meta_title" name="meta_title" placeholder="请输入seo关键字">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="keywords">seo关键字</label>
|
|
<input type="text" class="form-control" id="keywords" name="keywords" placeholder="请输入seo关键字">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="description">seo描述</label>
|
|
<input type="text" class="form-control" name="description" id="description" placeholder="seo描述">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<button type="submit" class="btn btn-primary ajax-post" target-form="add-form">立即提交
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{include file="public/footer"/}
|
|
<!--select2-->
|
|
<script type="text/javascript" src="/static/admin/js/select2.min.js"></script>
|
|
<script>
|
|
$(".add-form").submit(function () {
|
|
let Arr = $('.add-form').serializeArray();
|
|
let checkResult = true;
|
|
$.each(Arr, function (index, item) {
|
|
try {
|
|
switch (item.name) {
|
|
case 'title':
|
|
if (!item.value) {
|
|
throw "分类名称不能为空";
|
|
}
|
|
break;
|
|
case 'template':
|
|
if (!item.value) {
|
|
throw "展示模板不能为空";
|
|
}
|
|
break;
|
|
}
|
|
} catch (error) {
|
|
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
checkResult = false;
|
|
return false;
|
|
}
|
|
})
|
|
// 检验不通过终止执行
|
|
if (!checkResult) {
|
|
return false;
|
|
}
|
|
$.post(url = "/admin/category/save", $('.add-form').serialize(), function (res) {
|
|
if (res.code == 200) {
|
|
lightyear.notify(res.msg, 'success', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
setTimeout(function () {
|
|
location.href = '/admin/category/index';
|
|
}, 2000)
|
|
} else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
});
|
|
return true;
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |