Browse Source

视频上传限制大小,并有效提示

master
yanyan 3 years ago
parent
commit
246c7d6311
  1. 41
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/ruoyi/js/zdxtUtil.js
  2. 4
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html
  3. 2
      lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/role/view.html
  4. 9
      lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java

41
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/ruoyi/js/zdxtUtil.js

@ -868,6 +868,47 @@ var table = {
}); });
layer.full(index); layer.full(index);
}, },
// 弹出层全屏
openFullCutBtnName: function (title, url, width, height, leftBtnName) {
//如果是移动端,就使用自适应大小弹窗
if (navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)) {
width = 'auto';
height = 'auto';
}
if ($.common.isEmpty(title)) {
title = false;
}
if ($.common.isEmpty(url)) {
url = "/404.html";
}
if ($.common.isEmpty(width)) {
width = 800;
}
if ($.common.isEmpty(height)) {
height = ($(window).height() - 50);
}
var index = layer.open({
type: 2,
area: [width + 'px', height + 'px'],
fix: false,
//不固定
maxmin: true,
shade: 0.3,
title: title,
content: url,
btn: [leftBtnName, '关闭'],
// 弹层外区域关闭
shadeClose: true,
yes: function(index, layero) {
var iframeWin = layero.find('iframe')[0];
iframeWin.contentWindow.submitHandler(index, layero);
},
cancel: function(index) {
return true;
}
});
layer.full(index);
},
// 弹出层全屏 // 弹出层全屏
openFullClose: function (title, url, width, height) { openFullClose: function (title, url, width, height) {
//如果是移动端,就使用自适应大小弹窗 //如果是移动端,就使用自适应大小弹窗

4
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html

@ -274,11 +274,11 @@
function fileUploadCallBack(result) { function fileUploadCallBack(result) {
var parent = window.parent; var parent = window.parent;
if (result.success) { if (result.success) {
parent.$.modal.msgSuccess(result.message); $.modal.msgSuccess(result.message);
} else { } else {
$.modal.alertError(result.message); $.modal.alertError(result.message);
} }
$.modal.close(); // $.modal.close();
parent.$.table.refresh(); parent.$.table.refresh();
// $.modal.closeLoading(); // $.modal.closeLoading();
// $.modal.msgReload(result.message, modal_status.SUCCESS); // $.modal.msgReload(result.message, modal_status.SUCCESS);

2
lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/role/view.html

@ -123,7 +123,7 @@
function question(id) { function question(id) {
table.set(); table.set();
$.modal.openFull("", ctx + "small/project/role/bindNew/" + id); $.modal.openFullCutBtnName("", ctx + "small/project/role/bindNew/" + id, null,null,"保存流程图");
} }
function reset() { function reset() {

9
lib/EmergencyService/zdxtEmergencyKnowledgeService/src/main/java/com/zdxt/knowledge/service/impl/SceneQuestionServiceImpl.java

@ -108,6 +108,11 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
} }
String uploadFilePath = null; String uploadFilePath = null;
if (!ObjectUtil.isEmpty(files) && files.length == 1) { if (!ObjectUtil.isEmpty(files) && files.length == 1) {
long fileSize = files[0].getSize();
int maxSize = 10 * 1024 * 1024;
if (fileSize > maxSize) {
return ZDResponse.error("不允许超过10MB");
}
uploadFilePath = fileUploadApi.upload(files[0]); uploadFilePath = fileUploadApi.upload(files[0]);
} }
UserBean userBean = userApi.getCurrentUser(); UserBean userBean = userApi.getCurrentUser();
@ -131,9 +136,9 @@ public class SceneQuestionServiceImpl implements ISceneQuestionService {
if (result > 0 && !ObjectUtil.isEmpty(files)) { if (result > 0 && !ObjectUtil.isEmpty(files)) {
zdxtFileCommonApi.deleteZdxtFileByIds(sceneQuestion.getGuid()); zdxtFileCommonApi.deleteZdxtFileByIds(sceneQuestion.getGuid());
zdxtFileCommonApi.insertZdxtFile(files[0], sceneQuestion.getGuid() + "", uploadFilePath); zdxtFileCommonApi.insertZdxtFile(files[0], sceneQuestion.getGuid() + "", uploadFilePath);
return ZDResponse.success(); return ZDResponse.success("更改成功,点击'保存流程图'生效");
} else if (result > 0) { } else if (result > 0) {
return ZDResponse.success(); return ZDResponse.success("更改成功,点击'保存流程图'生效");
} }
return ZDResponse.error("失败"); return ZDResponse.error("失败");
} }

Loading…
Cancel
Save