123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- <!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-add">
- <div class="form-group">
- <label class="col-sm-3 control-label is-required">新闻标题:</label>
- <div class="col-sm-8">
- <input name="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" 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" 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" name="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" 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" 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" 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" 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">
- <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" 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-add").validate({
- focusCleanup: true
- });
- function submitHandler() {
- if ($.validate.form()) {
- $.operate.save(prefix + "/add", $('#form-info-add').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").fileinput({
- uploadUrl: ctx + 'common/upload',
- 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('')
- })
- $(function() {
- $('.summernote').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("图片上传失败。");
- }
- });
- }
- }
- });
- });
- </script>
- </body>
- </html>
|