mirror of https://github.com/1099438829/apeblog
205 lines
10 KiB
HTML
205 lines
10 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="zh">
|
|
<head>
|
|
<title>添加文章 - {:system_config("title")}后台管理系统</title>
|
|
{include file="public/header" /}
|
|
<!--标签插件-->
|
|
<link rel="stylesheet" href="__ADMIN_PATH__js/jquery-tags-input/jquery.tagsinput.min.css">
|
|
</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="javascript:history.back(-1);return false;">返 回</button>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div class="card-body">
|
|
<ul id="myTabs" class="nav nav-tabs" role="tablist">
|
|
<li class="active"><a href="#home" id="home-tab" role="tab" data-toggle="tab">基本信息</a></li>
|
|
<li><a href="#profile" role="tab" id="profile-tab" data-toggle="tab">SEO设置</a></li>
|
|
</ul>
|
|
<div id="myTabContent" class="tab-content">
|
|
<div class="tab-pane fade active in" id="home">
|
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
|
<div class="form-group col-md-12">
|
|
<label>分类名称</label>
|
|
<input type="text" class="form-control" id="title" name="title" value="{$info.title}" placeholder="分类名称" />
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label>英文名称</label>
|
|
<input type="text" class="form-control" id="en_title" name="en_title" value="{$info.en_title}" placeholder="英文名称" />
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<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}" {if $vo.id == $info.pid}selected{/if}>{$vo.html}{$vo.title}</option>
|
|
{/volist}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label>属性</label>
|
|
<div class="form-controls">
|
|
<select name="type" class="form-control">
|
|
<option value="0" {if 0== $info.type}selected{/if}>请选择</option>
|
|
<option value="1" {if 1== $info.type}selected{/if}>列表</option>
|
|
<option value="2" {if 2== $info.type}selected{/if}>单页</option>
|
|
<option value="3" {if 3== $info.type}selected{/if}>外联</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label>排序</label>
|
|
<input type="text" class="form-control" name="sort" placeholder="请输入排序" value="{$info.sort}">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="link_str">外链</label>
|
|
<input type="text" class="form-control" name="link_str" id="link_str" placeholder="外链" value="{$info.link_str}">
|
|
</div>
|
|
<div class="form-group col-md-12">
|
|
<label for="content">单页内容</label>
|
|
<textarea id="content" name="content">{$info.content}</textarea>
|
|
</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 class="tab-pane fade" id="profile">
|
|
<form action="#!" method="post" class="row add-form" onsubmit="return false;">
|
|
<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关键字" value="{$info.meta_title}">
|
|
</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关键字" value="{$info.keywords}">
|
|
</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描述" value="{$info.description}">
|
|
</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>
|
|
</div>
|
|
</div>
|
|
{include file="public/footer"/}
|
|
<!--select2-->
|
|
<script src="__ADMIN_PATH__js/select2.min.js"></script>
|
|
<!--富文本输入框-->
|
|
<script src="__ADMIN_PATH__js/tinymce/tinymce.min.js"></script>
|
|
<!--标签-->
|
|
<script src="__ADMIN_PATH__js/jquery-tags-input/jquery.tagsinput.min.js"></script>
|
|
<script>
|
|
$(function () {
|
|
$('#tag').select2();
|
|
});
|
|
$(document).ready(function(){
|
|
tinymce.init({
|
|
selector: '#content',
|
|
language: 'zh_CN',
|
|
directionality: 'ltl',
|
|
browser_spellcheck: true,
|
|
contextmenu: false,
|
|
height: 480,
|
|
plugins: [
|
|
"advlist autolink lists link image charmap print preview anchor",
|
|
"searchreplace visualblocks code fullscreen",
|
|
"insertdatetime media table contextmenu paste imagetools wordcount",
|
|
"code"
|
|
],
|
|
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | code",
|
|
images_upload_url: '/admin/files/tinymce',
|
|
});
|
|
});
|
|
/**
|
|
* 选择文件
|
|
* @param inputName
|
|
*/
|
|
function btnClick(inputName) {
|
|
$("#file_"+inputName).click()
|
|
}
|
|
/**
|
|
* 异步上传
|
|
* @param inputName
|
|
*/
|
|
function upload(inputName) {
|
|
var formData = new FormData();
|
|
formData.append("type",'images');
|
|
formData.append("file",$("#file_"+inputName)[0].files[0]);
|
|
$.ajax({
|
|
type:'POST',
|
|
url:'/admin/files/upload',
|
|
data: formData,
|
|
cache: false,
|
|
processData: false,
|
|
contentType: false,
|
|
success: function (res) {
|
|
if (res.code == 200){
|
|
$("#"+inputName).val(res.data.filePath);
|
|
let html =' <figure>\n' +
|
|
' <img src="'+res.data.filePath+'" alt="'+res.data.name+'">\n' +
|
|
' <figcaption>\n' +
|
|
' <a class="btn btn-round btn-square btn-danger btn-image-delete" href="#!"><i class="mdi mdi-delete"></i></a>\n' +
|
|
' </figcaption>\n' +
|
|
' </figure>';
|
|
$('#pic-image').html(html);
|
|
$('#pic-image').show().next('li').hide();
|
|
}else{
|
|
lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
return false;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
$(".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;
|
|
}
|
|
} catch (error) {
|
|
lightyear.notify(error, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
checkResult = false;
|
|
return false;
|
|
}
|
|
})
|
|
// 检验不通过终止执行
|
|
if (!checkResult) {
|
|
return false;
|
|
}
|
|
$.post(url="/admin/article/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/article/index';},2000)}
|
|
else lightyear.notify(res.msg, 'danger', 3000, 'mdi mdi-emoticon-happy', 'top', 'center');
|
|
});
|
|
return true;
|
|
})
|
|
|
|
//删除事件
|
|
$('body').on('click','.btn-image-delete',function(){
|
|
$('#pic-image').hide().next('li').show();
|
|
$('#cover_path').val('');
|
|
})
|
|
</script>
|
|
</body>
|
|
</html> |