Files
RuoYi/ruoyi-admin/src/main/resources/templates/system/notice/add.html

98 lines
3.3 KiB
HTML
Raw Normal View History

2019-03-31 12:56:04 +08:00
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增通知公告')" />
<th:block th:include="include :: summernote-css" />
</head>
2018-07-09 08:44:52 +08:00
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-notice-add">
<div class="form-group">
2019-12-31 16:34:24 +08:00
<label class="col-sm-2 control-label is-required">公告标题:</label>
2019-04-21 14:27:45 +08:00
<div class="col-sm-10">
2019-02-25 13:19:06 +08:00
<input id="noticeTitle" name="noticeTitle" class="form-control" type="text" required>
2018-07-09 08:44:52 +08:00
</div>
</div>
<div class="form-group">
2019-04-21 14:27:45 +08:00
<label class="col-sm-2 control-label">公告类型:</label>
<div class="col-sm-10">
2018-07-22 23:05:50 +08:00
<select name="noticeType" class="form-control m-b" th:with="type=${@dict.getType('sys_notice_type')}">
2018-08-23 17:06:31 +08:00
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
2018-07-09 08:44:52 +08:00
</select>
</div>
</div>
<div class="form-group">
2019-04-21 14:27:45 +08:00
<label class="col-sm-2 control-label">公告内容:</label>
<div class="col-sm-10">
2018-07-09 08:44:52 +08:00
<input id="noticeContent" name="noticeContent" type="hidden">
<div class="summernote"></div>
</div>
</div>
<div class="form-group">
2019-04-21 14:27:45 +08:00
<label class="col-sm-2 control-label">公告状态:</label>
<div class="col-sm-10">
2018-08-23 17:06:31 +08:00
<div class="radio-box" th:each="dict : ${@dict.getType('sys_notice_status')}">
<input type="radio" th:id="${dict.dictCode}" name="status" th:value="${dict.dictValue}" th:checked="${dict.default}">
2018-08-23 17:06:31 +08:00
<label th:for="${dict.dictCode}" th:text="${dict.dictLabel}"></label>
2018-07-09 08:44:52 +08:00
</div>
</div>
</div>
</form>
</div>
2019-03-31 12:56:04 +08:00
<th:block th:include="include :: footer" />
<th:block th:include="include :: summernote-js" />
2018-07-09 08:44:52 +08:00
<script type="text/javascript">
2018-10-05 19:27:24 +08:00
var prefix = ctx + "system/notice";
2019-01-09 16:22:45 +08:00
2018-07-09 08:44:52 +08:00
$('.summernote').summernote({
2019-04-21 14:27:45 +08:00
placeholder: '请输入公告内容',
height : 192,
2019-01-16 14:56:27 +08:00
lang : 'zh-CN',
2019-05-17 21:29:04 +08:00
followingToolbar: false,
2019-01-16 14:56:27 +08:00
callbacks: {
onImageUpload: function (files) {
sendFile(files[0], this);
}
}
2018-07-09 08:44:52 +08:00
});
2019-01-16 14:56:27 +08:00
// 上传文件
function sendFile(file, obj) {
var data = new FormData();
data.append("file", file);
$.ajax({
type: "POST",
url: ctx + "common/upload",
data: data,
cache: false,
contentType: false,
processData: false,
dataType: 'json',
success: function(result) {
if (result.code == web_status.SUCCESS) {
$(obj).summernote('editor.insertImage', result.url, result.fileName);
} else {
$.modal.alertError(result.msg);
}
},
error: function(error) {
$.modal.alertWarning("图片上传失败。");
}
});
}
2018-10-05 19:27:24 +08:00
2018-07-09 08:44:52 +08:00
$("#form-notice-add").validate({
2019-02-25 13:19:06 +08:00
focusCleanup: true
2018-07-09 08:44:52 +08:00
});
2019-01-04 11:37:35 +08:00
function submitHandler() {
if ($.validate.form()) {
2019-01-09 16:22:45 +08:00
var sHTML = $('.summernote').summernote('code');
2019-01-04 11:37:35 +08:00
$("#noticeContent").val(sHTML);
$.operate.save(prefix + "/add", $('#form-notice-add').serialize());
}
}
2018-07-09 08:44:52 +08:00
</script>
</body>
</html>