<!DOCTYPE html>
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
<head>
|
<th:block th:include="include :: header('修改模板')" />
|
</head>
|
<body class="white-bg">
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
<form class="form-horizontal m" id="form-template-edit" th:object="${template}">
|
<input name="templateId" th:field="*{templateId}" type="hidden">
|
<div class="form-group">
|
<label class="col-sm-3 control-label">模板代码:</label>
|
<div class="col-sm-8">
|
<input name="templateCode" th:field="*{templateCode}" required class="form-control" type="text">
|
</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('template_type')}">
|
<input type="radio" th:id="${'templateType_' + dict.dictCode}" name="templateType" th:value="${dict.dictValue}" th:field="*{templateType}">
|
<label th:for="${'templateType_' + 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="templateName" th:field="*{templateName}" required class="form-control" type="text">
|
</div>
|
</div>
|
<div class="form-group">
|
<label class="col-sm-3 control-label">模板内容:</label>
|
<div class="col-sm-8">
|
<script id="editor" name="templateContent" type="text/plain" ></script>
|
</div>
|
</div>
|
<textarea hidden="text" id="divdata">[[*{templateContent}]]</textarea>
|
</form>
|
</div>
|
<th:block th:include="include :: footer" />
|
<th:block th:include="include :: ueditor" />
|
|
<script type="text/javascript">
|
var ue = UE.getEditor('editor');
|
function getContent() {
|
return UE.getEditor('editor').getContent();
|
}
|
function getContentTxt() {
|
return UE.getEditor('editor').getContentTxt();
|
}
|
</script>
|
|
<script type="text/javascript">
|
var prefix = ctx + "cms/template";
|
$("#form-template-edit").validate({
|
focusCleanup: true
|
});
|
|
function submitHandler() {
|
if ($.validate.form()) {
|
|
var c = getContentTxt();
|
if (c == '' || c.length == 0) {
|
Fast.msg_error("请输入模板内容!");
|
return;
|
}
|
|
$.operate.save(prefix + "/edit", $('#form-template-edit').serialize());
|
}
|
}
|
|
$(function(){
|
$("#editor").css("height","380px");
|
|
//给UEeditor赋值
|
var data=$("#divdata").text();
|
var ue = UE.getEditor('editor');
|
var proinfo=$("#divdata").text();
|
ue.ready(function() {//编辑器初始化完成再赋值
|
ue.setContent(data); //赋值给UEditor
|
});
|
|
|
})
|
|
</script>
|
</body>
|
</html>
|