feat: 直接粘贴视频上传功能

This commit is contained in:
zhanzhenping
2024-07-05 09:57:03 +08:00
parent f78b65424a
commit a7eccd2a83
6 changed files with 18 additions and 11 deletions

View File

@@ -476,6 +476,9 @@ function uploadResource($id, $callback) {
case "video/mp4":
fileName += ".mp4";
break;
case "video/webm":
fileName += ".webm";
break;
default :
layer.msg(locales[lang].unsupportType);
return;

View File

@@ -251,14 +251,16 @@ $(function () {
shade: [0.1, '#fff'] // 0.1 透明度的白色背景
});
} else if ($state === "success") {
if ($res[0].errcode === 0) {
if ($res[0].resource_type === 'video') {
let value = `<video controls><source src="${$res[0].url}" type="video/mp4"></video>`;
if ($res.errcode === 0) {
if ($res.resource_type === 'video') {
let value = `<video controls><source src="${$res.url}" type="video/mp4"></video>`;
window.editor.insertValue(value);
} else {
let value = '![](' + $res[0].url + ')';
let value = '![](' + $res.url + ')';
window.editor.insertValue(value);
}
} else {
layer.msg("上传失败:" + $res.message);
}
}
});