|
@@ -2,32 +2,36 @@
|
|
|
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
|
|
<head>
|
|
|
<th:block th:include="include :: header('修改帮助中心')" />
|
|
|
+ <th:block th:include="include :: cropbox-css"/>
|
|
|
<th:block th:include="include :: bootstrap-fileinput-css" />
|
|
|
</head>
|
|
|
<body class="white-bg">
|
|
|
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
|
|
<form class="form-horizontal m" id="form-center-edit" th:object="${helpCenter}">
|
|
|
<input name="id" th:field="*{id}" type="hidden">
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">标题:</label>
|
|
|
+ <input id="input_fileUrl" name="fileUrl" type="hidden" value="" class="form-control">
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">文档类别:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="title" th:field="*{title}" class="form-control" type="text">
|
|
|
+ <select name="classifyTitle" id="sel_classifyTitle" class="form-control m-b"
|
|
|
+ th:with="type=${@dict.getType('help_center_classify_title')}" onchange="javascript:typeChange()">
|
|
|
+ <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{classifyTitle}" ></option>
|
|
|
+ </select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">描述:</label>
|
|
|
+ <label class="col-sm-3 control-label">文件标题:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="describe" th:field="*{describe}" class="form-control" type="text">
|
|
|
+ <input name="title" th:field="*{title}" class="form-control" type="text">
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">文件地址:</label>
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">文件描述:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <div class="file-loading">
|
|
|
- <input class="file" type="file" multiple data-min-file-count="1" data-theme="fas">
|
|
|
- </div>
|
|
|
+ <input name="describe" th:field="*{describe}" class="form-control" type="text">
|
|
|
</div>
|
|
|
</div>
|
|
|
+
|
|
|
<div class="form-group">
|
|
|
<label class="col-sm-3 control-label">文件类型:</label>
|
|
|
<div class="col-sm-8">
|
|
@@ -35,30 +39,82 @@
|
|
|
th:with="type=${@dict.getType('help_center_file_type')}" onchange="javascript:typeChange()">
|
|
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{fileType}"></option>
|
|
|
</select>
|
|
|
- <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 代码生成请选择字典属性</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">分类标题:</label>
|
|
|
- <div class="col-sm-8">
|
|
|
- <input name="classifyTitle" th:field="*{classifyTitle}" class="form-control" type="text">
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="form-group">
|
|
|
- <label class="col-sm-3 control-label">是否删除:</label>
|
|
|
+
|
|
|
+ <div class="form-group">
|
|
|
+ <label class="col-sm-3 control-label">文件地址:</label>
|
|
|
<div class="col-sm-8">
|
|
|
- <input name="delFlag" th:field="*{delFlag}" class="form-control" type="text">
|
|
|
+ <div class="file-loading">
|
|
|
+ <input id="fileinput-upload-1" type="file">
|
|
|
+ </div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</form>
|
|
|
+
|
|
|
+ <div class="row">
|
|
|
+ <div class="col-sm-offset-5 col-sm-10">
|
|
|
+ <button type="button" class="btn btn-sm btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保 存</button>
|
|
|
+ <button type="button" class="btn btn-sm btn-danger" onclick="closeItem()"><i class="fa fa-reply-all"></i>关 闭 </button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<th:block th:include="include :: footer" />
|
|
|
+ <th:block th:include="include :: cropbox-js"/>
|
|
|
<th:block th:include="include :: bootstrap-fileinput-js" />
|
|
|
<script type="text/javascript">
|
|
|
var prefix = ctx + "helpCenter/center";
|
|
|
- $("#form-center-edit").validate({
|
|
|
- focusCleanup: true
|
|
|
- });
|
|
|
+ $(function () {
|
|
|
+ //初始化
|
|
|
+ initFileInput("fileinput-upload-1");
|
|
|
+ //异步上传成功结果处理
|
|
|
+ $("#fileinput-upload-1").on("fileuploaded", function (event, data, previewId, index) {
|
|
|
+ console.log("fileName = "+ data.response.data.fileName);
|
|
|
+ $("#input_fileUrl").val(data.response.data.fileName);
|
|
|
+ });
|
|
|
+
|
|
|
+ //异步上传错误结果处理
|
|
|
+ $("#fileinput-upload-1").on('fileerror', function(event, data, msg) {
|
|
|
+ console.log(msg)
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ $("#form-center-add").validate({
|
|
|
+ ignore:"",
|
|
|
+ onkeyup: false,
|
|
|
+ rules: {
|
|
|
+ title: {
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ describe: {
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ fileUrl: {
|
|
|
+ required: true
|
|
|
+ },
|
|
|
+ classifyTitle: {
|
|
|
+ required: true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ focusCleanup: true
|
|
|
+ });
|
|
|
+
|
|
|
+ })
|
|
|
+ function initFileInput(ctrlName) {
|
|
|
+ var control = $('#' + ctrlName);
|
|
|
+
|
|
|
+ control.fileinput({
|
|
|
+ language: 'zh', //设置语言
|
|
|
+ theme: 'explorer-fas',
|
|
|
+ uploadUrl: ctx + "common/uploadCasePicture",
|
|
|
+ allowedFileExtensions : ['pdf', 'mp4'],//接收的文件后缀,
|
|
|
+ allowedPreviewTypes: ['pdf','video'],
|
|
|
+ allowedFileTypes:['pdf','video'],
|
|
|
+ overwriteInitial: false,
|
|
|
+ initialPreviewAsData: true,
|
|
|
+ maxFileCount : 1
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
function submitHandler() {
|
|
|
if ($.validate.form()) {
|