|
@@ -803,10 +803,16 @@ async function cancelUp() {
|
|
|
const res = await deleteQiniuFile({
|
|
const res = await deleteQiniuFile({
|
|
|
qiniu_key: qiniu_key,
|
|
qiniu_key: qiniu_key,
|
|
|
});
|
|
});
|
|
|
- // console.log(res);
|
|
|
|
|
|
|
+ console.log(res);
|
|
|
if (res.code == 0) {
|
|
if (res.code == 0) {
|
|
|
ElMessage.success(res.msg);
|
|
ElMessage.success(res.msg);
|
|
|
}
|
|
}
|
|
|
|
|
+ if (window.location.href.indexOf("#reloaded") == -1) {
|
|
|
|
|
+ console.log("刷新页面")
|
|
|
|
|
+ window.location.href = window.location.href + "#reloaded";
|
|
|
|
|
+ window.location.reload();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
async function ComputerFileMd5(files) {
|
|
async function ComputerFileMd5(files) {
|
|
@@ -980,34 +986,45 @@ function handleAvatarSuccess(res) {
|
|
|
fileTypeOptions.value[uploadForm.value.type].name;
|
|
fileTypeOptions.value[uploadForm.value.type].name;
|
|
|
uploadForm.value.type = fileTypeOptions.value[uploadForm.value.type].typeId;
|
|
uploadForm.value.type = fileTypeOptions.value[uploadForm.value.type].typeId;
|
|
|
//此处获取七牛云返回的MD5值,并和本地计算的进行对比,如不一致,则删除文件并结束
|
|
//此处获取七牛云返回的MD5值,并和本地计算的进行对比,如不一致,则删除文件并结束
|
|
|
|
|
+ //因七牛返回MD5很慢,因此此处先不对比
|
|
|
// console.warn(fileUrl)
|
|
// console.warn(fileUrl)
|
|
|
- axios.get(fileUrl + '?qhash/md5', {
|
|
|
|
|
- })
|
|
|
|
|
- .then(response => {
|
|
|
|
|
- console.log(response.data.hash)
|
|
|
|
|
- if (response.data.hash) {
|
|
|
|
|
- afterMD5.value = response.data.hash
|
|
|
|
|
- if (afterMD5.value == beforeMD5.value) {
|
|
|
|
|
- keyWord.value = `文件校验完成,即将保存`
|
|
|
|
|
- setTimeout(() => {
|
|
|
|
|
- uploadForm.value.md5 = afterMD5.value
|
|
|
|
|
- recordFile(uploadForm.value);
|
|
|
|
|
- }, 1000); // 一秒后执行保存
|
|
|
|
|
- } else {
|
|
|
|
|
- keyWord.value = `文件校验失败,与云端MD5不一致(${afterMD5.value})`
|
|
|
|
|
- cancelUp()
|
|
|
|
|
- }
|
|
|
|
|
- } else {
|
|
|
|
|
- keyWord.value = `文件校验失败,七牛云未返回MD5(${response.data})`
|
|
|
|
|
- cancelUp()
|
|
|
|
|
|
|
+ // axios.get(fileUrl + '?qhash/md5', {
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .then(response => {
|
|
|
|
|
+ // console.log(response.data.hash)
|
|
|
|
|
+ // if (response.data.hash) {
|
|
|
|
|
+ // afterMD5.value = response.data.hash
|
|
|
|
|
+ // if (afterMD5.value == beforeMD5.value) {
|
|
|
|
|
+ // keyWord.value = `文件校验完成,即将保存`
|
|
|
|
|
+ // setTimeout(() => {
|
|
|
|
|
+ // uploadForm.value.md5 = afterMD5.value
|
|
|
|
|
+ // recordFile(uploadForm.value);
|
|
|
|
|
+ // }, 1000); // 一秒后执行保存
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // keyWord.value = `文件校验失败,与云端MD5不一致(${afterMD5.value})`
|
|
|
|
|
+ // cancelUp()
|
|
|
|
|
+ // }
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // keyWord.value = `文件校验失败,七牛云未返回MD5(${response.data})`
|
|
|
|
|
+ // cancelUp()
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
- })
|
|
|
|
|
- .catch(error => {
|
|
|
|
|
- console.error(error)
|
|
|
|
|
- keyWord.value = `文件校验失败,七牛云未返回MD5(${error})`
|
|
|
|
|
- cancelUp()
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ // .catch(error => {
|
|
|
|
|
+ // console.error(error)
|
|
|
|
|
+ // keyWord.value = `文件校验失败,七牛云未返回MD5(${error})`
|
|
|
|
|
+ // cancelUp()
|
|
|
|
|
+ // })
|
|
|
|
|
+ if (beforeMD5.value) {
|
|
|
|
|
+ keyWord.value = `文件校验完成,即将保存`
|
|
|
|
|
+ setTimeout(() => {
|
|
|
|
|
+ uploadForm.value.md5 = beforeMD5.value
|
|
|
|
|
+ recordFile(uploadForm.value);
|
|
|
|
|
+ }, 1000); // 一秒后执行保存
|
|
|
|
|
+ } else {
|
|
|
|
|
+ keyWord.value = `MD5有误(${afterMD5.value})`
|
|
|
|
|
+ cancelUp()
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
//进度条显示
|
|
//进度条显示
|
|
|
function onProgress(event, file, fileList) {
|
|
function onProgress(event, file, fileList) {
|