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