<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<head>
|
<th:block th:include="include :: header('新增文章模板')" />
|
<th:block th:include="include :: select2-css" />
|
</head>
|
<body class="white-bg">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<form class="form-horizontal m" id="form-articleTemplate-add">
|
<div class="form-group">
|
<label class="col-sm-3 control-label">文章模板名称:</label>
|
<div class="col-sm-8">
|
<input id="name" name="name" class="form-control" required type="text">
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">标签:</label>
|
<div class="col-sm-8">
|
<!--<input name="tags" id="tags" class="form-control" type="text">-->
|
<select id="tags" name="tags" class="form-control select2-multiple" multiple>
|
<option th:each="tag:${tags}" th:value="${tag.tagId}" th:text="${tag.tagName}" th:selected="${tag.selected}" th:disabled="${tag.status == '1'}"></option>
|
</select>
|
|
</div>
|
</div>
|
|
<div class="form-group">
|
<label class="col-sm-3 control-label">共享类型:</label>
|
<div class="col-sm-8">
|
<div class="radio-box" th:each="dict : ${@dict.getType('share_type')}">
|
<input type="radio" th:id="${'shareType_' + dict.dictCode}" name="shareType" th:value="${dict.dictValue}" th:checked="${dict.default}">
|
<label th:for="${'shareType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
</div>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">权重:</label>
|
<div class="col-sm-8">
|
<input name="weight" class="form-control" type="text">
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">最热:</label>
|
<div class="col-sm-8">
|
<input id="hotFlag" name="hotFalg" class="form-control" value="0" type="hidden">
|
<label class="toggle-switch switch-solid">
|
<input type="checkbox" id="isHot">
|
<span></span>
|
</label>
|
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">最新:</label>
|
<div class="col-sm-8">
|
<input id="newFlag" name="newFlag" class="form-control" value="0" type="hidden">
|
<label class="toggle-switch switch-solid">
|
<input type="checkbox" id="isNew">
|
<span></span>
|
</label>
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">内容:</label>
|
<div class="col-sm-8">
|
<script id="editor" name="content" type="text/plain" ></script>
|
</div>
|
</div>
|
</form>
|
</div>
|
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: select2-js" />
|
<th:block th:include="include :: ueditor" />
|
<script type="text/javascript">
|
$(function() {
|
$("#editor").css("height", "380px");
|
$('#tags').select2({
|
placeholder: "请选择标签",
|
allowClear: true
|
});
|
|
$("#isHot").on("change",function(){
|
var v=$(this).prop("checked");
|
if(v){
|
$("#hotFlag").val("1");
|
}else{
|
$("#hotFlag").val("0");
|
}
|
});
|
$("#isNew").on("change",function(){
|
var v=$(this).prop("checked");
|
if(v){
|
$("#newFlag").val("1");
|
}else{
|
$("#newFlag").val("0");
|
}
|
});
|
|
});
|
|
|
|
var ue = UE.getEditor('editor');
|
function getContent() {
|
return UE.getEditor('editor').getContent();
|
}
|
function getContentTxt() {
|
return UE.getEditor('editor').getContentTxt();
|
}
|
|
var prefix = ctx + "cms/articleTemplate"
|
$("#form-articleTemplate-add").validate({
|
focusCleanup: true
|
});
|
|
function submitHandler() {
|
if ($.validate.form()) {
|
|
var name=$("#name").val();
|
if(isEmpty(name)){
|
Fast.msg_error("请输入标题!"); return;
|
}
|
var tagIds = $.form.selectSelects("tags");
|
if(isEmpty(tagIds)){
|
Fast.msg_error("请选择标签!"); return;
|
}
|
var c = getContentTxt();
|
if (c == '' || c.length == 0) {
|
Fast.msg_error("请输入内容!");
|
return;
|
}
|
|
$.operate.save(prefix + "/add", $('#form-articleTemplate-add').serialize());
|
}
|
}
|
</script>
|
</body>
|
</html>
|