forked from integrated_whb/integrated_whb_vue
init
parent
4bd0189616
commit
7166ee57d8
|
@ -1,4 +1,5 @@
|
|||
import { setVideo, setVideoRefresh } from "@/request/api.js";
|
||||
import { ElLoading, ElMessage } from "element-plus";
|
||||
|
||||
export default function useAliYunUpload({
|
||||
addFileSuccess,
|
||||
|
@ -10,6 +11,7 @@ export default function useAliYunUpload({
|
|||
onUploadTokenExpired,
|
||||
onUploadEnd,
|
||||
}) {
|
||||
let loading;
|
||||
const uploader = new window.AliyunUpload.Vod({
|
||||
timeout: 60000,
|
||||
partSize: 1048576,
|
||||
|
@ -50,11 +52,18 @@ export default function useAliYunUpload({
|
|||
uploadAddress,
|
||||
videoId
|
||||
);
|
||||
loading = ElLoading.service({
|
||||
lock: true,
|
||||
text: "加载中...",
|
||||
background: "rgba(0, 0, 0, 0.5)",
|
||||
});
|
||||
},
|
||||
onUploadSucceed(uploadInfo) {
|
||||
loading.close();
|
||||
onUploadSucceed && onUploadSucceed(uploadInfo);
|
||||
},
|
||||
onUploadFailed(uploadInfo, code, message) {
|
||||
ElMessage.success("上传失败,请重新上传");
|
||||
onUploadFailed && onUploadFailed(uploadInfo, code, message);
|
||||
},
|
||||
onUploadCanceled(uploadInfo, code, message) {
|
||||
|
|
|
@ -219,6 +219,7 @@ export function getFileSuffix(name) {
|
|||
* @return {string} 文件名称
|
||||
**/
|
||||
export function getFileName(name) {
|
||||
if (!name) return "";
|
||||
return name.substring(name.lastIndexOf("/") + 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,6 @@ const fnSubmit = debounce(
|
|||
},
|
||||
onUploadFailed: () => {
|
||||
progressBarVisible.value = false;
|
||||
ElMessage.success("上传失败,请重新上传");
|
||||
},
|
||||
onUploadProgress: (uploadInfo, totalSize, progress) => {
|
||||
progressBar.value = Math.ceil(progress * 100);
|
||||
|
@ -194,6 +193,7 @@ const fnSubmitForm = async (videoId = "") => {
|
|||
...form.value,
|
||||
videoId,
|
||||
isEditVideo: !!form.value.file[0].raw,
|
||||
trainingSection: form.value.trainingSection.join(";"),
|
||||
};
|
||||
props.type === "add"
|
||||
? await setVideoCoursewareAdd(params)
|
||||
|
|
Loading…
Reference in New Issue