新增百度富文本编辑器
This commit is contained in:
parent
3b7d03d748
commit
9286c51f8f
@ -178,6 +178,10 @@
|
||||
AND
|
||||
LEFT(t1.gmt_create, 10) <![CDATA[ <= ]]> #{endTime}
|
||||
</if>
|
||||
<if test="articleCategoryId != null and articleCategoryId != ''">
|
||||
AND
|
||||
t1.article_category_id = #{articleCategoryId}
|
||||
</if>
|
||||
<if test="articleContentIds != null and articleContentIds.size > 0">
|
||||
AND
|
||||
t1.article_content_id IN
|
||||
|
@ -93,9 +93,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label">正文</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="content"></div>
|
||||
<script id="content" name="content" type="text/plain"></script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
@ -110,7 +109,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ueditor/ueditor.config.js"></script>
|
||||
<script src="assets/js/vendor/ueditor/ueditor.all.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
@ -122,8 +122,7 @@
|
||||
var form = layui.form;
|
||||
var laytpl = layui.laytpl;
|
||||
var laydate = layui.laydate;
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var ueEditorObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
@ -191,25 +190,11 @@
|
||||
|
||||
// 初始化正文富文本
|
||||
function initContentRichText() {
|
||||
var editor = new wangEditor('#content');
|
||||
editor.customConfig.zIndex = 1000;
|
||||
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
|
||||
editor.customConfig.uploadImgMaxLength = 1;
|
||||
editor.customConfig.uploadFileName = 'image';
|
||||
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
|
||||
editor.customConfig.uploadImgHooks = {
|
||||
fail: function (xhr, editor, result) {
|
||||
top.dialog.msg('系统错误,图片上传失败');
|
||||
},
|
||||
error: function (xhr, editor) {
|
||||
top.dialog.msg('网络异常');
|
||||
},
|
||||
timeout: function (xhr, editor) {
|
||||
top.dialog.msg('网络请求超时');
|
||||
}
|
||||
};
|
||||
editor.create();
|
||||
wangEditorObj['content'] = editor;
|
||||
var editor = UE.getEditor('content');
|
||||
editor.ready(function() {
|
||||
editor.setHeight(400);
|
||||
});
|
||||
ueEditorObj['content'] = editor;
|
||||
}
|
||||
|
||||
// 初始化文章类别联表
|
||||
@ -238,7 +223,7 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
formData.field['content'] = wangEditorObj['content'].txt.html();
|
||||
formData.field['content'] = ueEditorObj['content'].getContent();
|
||||
top.restAjax.post(top.restAjax.path('api/articlecontent/savearticlecontent', []), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
|
||||
time: 0,
|
||||
|
@ -93,9 +93,8 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-form-text">
|
||||
<label class="layui-form-label layui-form">正文</label>
|
||||
<div class="layui-input-block">
|
||||
<div id="content"></div>
|
||||
<script id="content" name="content" type="text/plain"></script>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item layui-layout-admin">
|
||||
@ -110,7 +109,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script src="assets/js/vendor/wangEditor/wangEditor.min.js"></script>
|
||||
<script src="assets/js/vendor/ueditor/ueditor.config.js"></script>
|
||||
<script src="assets/js/vendor/ueditor/ueditor.all.js"></script>
|
||||
<script src="assets/layuiadmin/layui/layui.js"></script>
|
||||
<script>
|
||||
layui.config({
|
||||
@ -124,8 +124,7 @@
|
||||
var laydate = layui.laydate;
|
||||
var articleContentId = top.restAjax.params(window.location.href).articleContentId;
|
||||
|
||||
var wangEditor = window.wangEditor;
|
||||
var wangEditorObj = {};
|
||||
var ueEditorObj = {};
|
||||
|
||||
function closeBox() {
|
||||
parent.layer.close(parent.layer.getFrameIndex(window.name));
|
||||
@ -193,26 +192,12 @@
|
||||
|
||||
// 初始化正文富文本
|
||||
function initContentRichText(value) {
|
||||
var editor = new wangEditor('#content');
|
||||
editor.customConfig.zIndex = 1000;
|
||||
editor.customConfig.uploadImgMaxSize = 5 * 1024 * 1024;
|
||||
editor.customConfig.uploadImgMaxLength = 1;
|
||||
editor.customConfig.uploadFileName = 'image';
|
||||
editor.customConfig.uploadImgServer = 'api/file/wangeditorimage';
|
||||
editor.customConfig.uploadImgHooks = {
|
||||
fail: function (xhr, editor, result) {
|
||||
top.dialog.msg('系统错误,图片上传失败');
|
||||
},
|
||||
error: function (xhr, editor) {
|
||||
top.dialog.msg('网络异常');
|
||||
},
|
||||
timeout: function (xhr, editor) {
|
||||
top.dialog.msg('网络请求超时');
|
||||
}
|
||||
};
|
||||
editor.create();
|
||||
editor.txt.html(value);
|
||||
wangEditorObj['content'] = editor;
|
||||
var editor = UE.getEditor('content');
|
||||
editor.ready(function() {
|
||||
editor.setHeight(400);
|
||||
editor.setContent(value);
|
||||
});
|
||||
ueEditorObj['content'] = editor;
|
||||
}
|
||||
|
||||
// 初始化文章类别联表
|
||||
@ -261,7 +246,7 @@
|
||||
top.dialog.confirm(top.dataMessage.commit, function(index) {
|
||||
top.dialog.close(index);
|
||||
var loadLayerIndex;
|
||||
formData.field['content'] = wangEditorObj['content'].txt.html();
|
||||
formData.field['content'] = ueEditorObj['content'].getContent();
|
||||
top.restAjax.put(top.restAjax.path('api/articlecontent/updatearticlecontent/{articleContentId}', [articleContentId]), formData.field, null, function(code, data) {
|
||||
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
|
||||
time: 0,
|
||||
|
Binary file not shown.
@ -235,7 +235,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
FileDTO fileDTO = uploadSingleForFileDTO(null, image, UploadTypeEnum.IMAGE, params);
|
||||
result.put("errno", 0);
|
||||
JSONArray fileArray = new JSONArray();
|
||||
fileArray.add(String.format("route/file/downloadfile/false/%s", fileDTO.getFileId()));
|
||||
fileArray.add(String.format("route/file/downloadfile/true/%s", fileDTO.getFileId()));
|
||||
result.put("data", fileArray);
|
||||
} catch (Exception e) {
|
||||
LOG.error(e.getMessage(), e);
|
||||
@ -262,10 +262,12 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
int start = Integer.parseInt(params.get("start").toString());
|
||||
int pageSize = Integer.parseInt(params.get("size").toString());
|
||||
int pageNum = start / pageSize + 1;
|
||||
String downloadFile = "true";
|
||||
if (UEDITOR_LIST_IMAGE.equals(action)) {
|
||||
params.put("fileUrl", "images");
|
||||
} else if (UEDITOR_LIST_FILE.equals(action)) {
|
||||
params.put("fileUrl", "files");
|
||||
downloadFile = "false";
|
||||
}
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
List<FileDTO> listFileDTOs = fileDao.listFile(params);
|
||||
@ -273,7 +275,7 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
List<Map<String, String>> fileList = new ArrayList<>();
|
||||
for (FileDTO fileDTO : listFileDTOs) {
|
||||
Map<String, String> fileMap = new HashMap<>(0);
|
||||
fileMap.put("url", String.format("%s/%s", request.getContextPath(), fileDTO.getFileUrl()));
|
||||
fileMap.put("url", String.format("%s/route/file/downloadfile/%s/%s", request.getContextPath(), downloadFile, fileDTO.getFileId()));
|
||||
fileList.add(fileMap);
|
||||
}
|
||||
JSONObject uEditorListResult = new JSONObject();
|
||||
@ -297,19 +299,23 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
private JSONObject uEditorUpload(MultipartFile file, HttpServletRequest request, String action, Map<String, Object> params) throws SystemException {
|
||||
LOG.debug("UEditor上传文件");
|
||||
FileDTO fileDTO = null;
|
||||
String downloadFile = "true";
|
||||
if (UEDITOR_UPLOAD_IMAGE.equals(action)) {
|
||||
fileDTO = uploadSingleForFileDTO(null, file, UploadTypeEnum.IMAGE, params);
|
||||
} else if (UEDITOR_UPLOAD_VIDEO.equals(action)) {
|
||||
fileDTO = uploadSingleForFileDTO(null, file, UploadTypeEnum.VIDEO, params);
|
||||
downloadFile = "false";
|
||||
} else if (UEDITOR_UPLOAD_FILE.equals(action)) {
|
||||
fileDTO = uploadSingleForFileDTO(null, file, UploadTypeEnum.FILE, params);
|
||||
downloadFile = "false";
|
||||
}
|
||||
if (fileDTO == null) {
|
||||
throw new SystemException("文件上传失败");
|
||||
}
|
||||
String fileUrl = String.format("route/file/downloadfile/%s/%s", downloadFile, fileDTO.getFileId());
|
||||
JSONObject fileUploadResult = new JSONObject();
|
||||
fileUploadResult.put("state", "SUCCESS");
|
||||
fileUploadResult.put("url", fileDTO.getFileUrl());
|
||||
fileUploadResult.put("url", fileUrl);
|
||||
fileUploadResult.put("title", fileDTO.getFileName());
|
||||
fileUploadResult.put("original", fileDTO.getFileName());
|
||||
return fileUploadResult;
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* 上传图片配置项 */
|
||||
"imageActionName": "uploadimage", /* 执行上传图片的action名称 */
|
||||
"imageFieldName": "file", /* 提交的图片表单名称 */
|
||||
"imageMaxSize": 2048000, /* 上传大小限制,单位B */
|
||||
"imageMaxSize": 10240000000, /* 上传大小限制,单位B */
|
||||
"imageAllowFiles": [".png", ".jpg", ".jpeg", ".gif", ".bmp"], /* 上传图片格式显示 */
|
||||
"imageCompressEnable": true, /* 是否压缩图片,默认是true */
|
||||
"imageCompressBorder": 1600, /* 图片压缩最长边限制 */
|
||||
@ -51,7 +51,7 @@
|
||||
"videoFieldName": "file", /* 提交的视频表单名称 */
|
||||
"videoPathFormat": "/files/videos/{yyyy}{mm}{dd}", /* 上传保存路径,可以自定义保存路径和文件名格式 */
|
||||
"videoUrlPrefix": "", /* 视频访问路径前缀 */
|
||||
"videoMaxSize": 1024000000, /* 上传大小限制,单位B,默认100MB */
|
||||
"videoMaxSize": 10240000000, /* 上传大小限制,单位B,默认100MB */
|
||||
"videoAllowFiles": [
|
||||
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid"], /* 上传视频格式显示 */
|
||||
@ -66,7 +66,7 @@
|
||||
".png", ".jpg", ".jpeg", ".gif", ".bmp",
|
||||
".flv", ".swf", ".mkv", ".avi", ".rm", ".rmvb", ".mpeg", ".mpg",
|
||||
".ogg", ".ogv", ".mov", ".wmv", ".mp4", ".webm", ".mp3", ".wav", ".mid",
|
||||
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso",
|
||||
".rar", ".zip", ".tar", ".gz", ".7z", ".bz2", ".cab", ".iso", ".apk",
|
||||
".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".pdf", ".txt", ".md", ".xml"
|
||||
], /* 上传文件格式显示 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user