123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- <!DOCTYPE html>
- <html lang="zh" xmlns:th="http://www.thymeleaf.org" >
- <head>
- <th:block th:include="include :: header('修改文章管理')" />
- <th:block th:include="include :: datetimepicker-css" />
- <th:block th:include="include :: bootstrap-fileinput-css"/>
- <th:block th:include="include :: summernote-css" />
- </head>
- <body class="white-bg">
- <div class="wrapper wrapper-content animated fadeInRight ibox-content">
- <form class="form-horizontal m" id="form-info-edit" th:object="${newsInfo}">
- <input name="newsInfoId" th:field="*{newsInfoId}" type="hidden">
- <div class="form-group">
- <label class="col-sm-3 control-label is-required">新闻标题:</label>
- <div class="col-sm-8">
- <input name="newsInfoTitle" th:field="*{newsInfoTitle}" class="form-control" type="text" required>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label is-required">新闻作者:</label>
- <div class="col-sm-8">
- <input name="newsInfoAuthor" th:field="*{newsInfoAuthor}" class="form-control" type="text" required>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">新闻来源:</label>
- <div class="col-sm-8">
- <input name="newsInfoSource" th:field="*{newsInfoSource}" class="form-control" type="text">
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label is-required">新闻正文:</label>
- <div class="col-sm-8">
- <input type="hidden" class="form-control" th:field="*{newsInfoContent}">
- <div class="summernote" id="newsInfoContent"></div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label is-required">新闻时间:</label>
- <div class="col-sm-8">
- <div class="input-group date">
- <input name="newsInfoTime" th:value="${#dates.format(newsInfo.newsInfoTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text" required>
- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">新闻点击数量:</label>
- <div class="col-sm-8">
- <input name="newsInfoClick" th:field="*{newsInfoClick}" 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="input-group date">
- <input name="newsInfoInittime" th:value="${#dates.format(newsInfo.newsInfoInittime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
- <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">是否是轮播(0不是,1是):</label>
- <div class="col-sm-8">
- <input name="newsInfoCarousel" th:field="*{newsInfoCarousel}" 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 type="hidden" name="newsInfoUrl" th:field="*{newsInfoUrl}">
- <div class="file-loading">
- <input class="form-control file-upload" id="newsInfoUrl" name="file" type="file">
- </div>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-3 control-label">用户作者id:</label>
- <div class="col-sm-8">
- <input name="newsInfoAuthorid" th:field="*{newsInfoAuthorid}" class="form-control" type="text">
- </div>
- </div>
- </form>
- </div>
- <th:block th:include="include :: footer" />
- <th:block th:include="include :: datetimepicker-js" />
- <th:block th:include="include :: bootstrap-fileinput-js"/>
- <th:block th:include="include :: summernote-js" />
- <script th:inline="javascript">
- var prefix = ctx + "system/info";
- $("#form-info-edit").validate({
- focusCleanup: true
- });
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/edit", $('#form-info-edit').serialize());
- }
- }
- $("input[name='newsInfoTime']").datetimepicker({
- format: "yyyy-mm-dd",
- minView: "month",
- autoclose: true
- });
- $("input[name='newsInfoInittime']").datetimepicker({
- format: "yyyy-mm-dd",
- minView: "month",
- autoclose: true
- });
- $(".file-upload").each(function (i) {
- var val = $("input[name='" + this.id + "']").val()
- $(this).fileinput({
- 'uploadUrl': ctx + 'common/upload',
- initialPreviewAsData: true,
- initialPreview: [val],
- maxFileCount: 1,
- autoReplace: true
- }).on('fileuploaded', function (event, data, previewId, index) {
- $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
- }).on('fileremoved', function (event, id, index) {
- $("input[name='" + event.currentTarget.id + "']").val('')
- })
- $(this).fileinput('_initFileActions');
- });
- $(function() {
- $('.summernote').each(function(i) {
- $('#' + this.id).summernote({
- lang: 'zh-CN',
- dialogsInBody: true,
- callbacks: {
- onChange: function(contents, $edittable) {
- $("input[name='" + this.id + "']").val(contents);
- },
- onImageUpload: function(files) {
- var obj = this;
- var data = new FormData();
- data.append("file", files[0]);
- $.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.id).summernote('insertImage', result.url);
- } else {
- $.modal.alertError(result.msg);
- }
- },
- error: function(error) {
- $.modal.alertWarning("图片上传失败。");
- }
- });
- }
- }
- });
- var content = $("input[name='" + this.id + "']").val();
- $('#' + this.id).summernote('code', content);
- })
- });
- </script>
- </body>
- </html>
|