|
|
|
@ -7,6 +7,7 @@
|
|
|
|
|
class="upload-demo"
|
|
|
|
|
ref="upload"
|
|
|
|
|
action="#"
|
|
|
|
|
:before-upload="beforeUpload"
|
|
|
|
|
:http-request="customUpload"
|
|
|
|
|
:limit="1"
|
|
|
|
|
:file-list="fileList"
|
|
|
|
@ -190,6 +191,14 @@ export default {
|
|
|
|
|
// 显示上传进度
|
|
|
|
|
console.log(this.progress); // 或者你可以使用其他方式来显示进度,比如使用进度条组件等。
|
|
|
|
|
},
|
|
|
|
|
beforeUpload(file) {
|
|
|
|
|
const fileName = file.name;
|
|
|
|
|
if (fileName.length > 19) {
|
|
|
|
|
this.$message.error("文件名长度不能超过 19 个字符!");
|
|
|
|
|
return false; // 阻止文件自动上传
|
|
|
|
|
}
|
|
|
|
|
return true; // 允许文件继续上传
|
|
|
|
|
},
|
|
|
|
|
// //点击升级确定
|
|
|
|
|
// beforeAvatarUpload(file) {
|
|
|
|
|
// console.log(this.reportData.title);
|
|
|
|
@ -206,7 +215,19 @@ export default {
|
|
|
|
|
formData.append("file", options.file);
|
|
|
|
|
formData.append("title", this.reportData.title); // 假设后端需要这个字段
|
|
|
|
|
console.log(formData);
|
|
|
|
|
uploadApk(formData)
|
|
|
|
|
uploadApk(formData, (progressEvent) => {
|
|
|
|
|
// 计算上传进度百分比
|
|
|
|
|
const percentCompleted = Math.round(
|
|
|
|
|
(progressEvent.loaded * 100) / progressEvent.total
|
|
|
|
|
);
|
|
|
|
|
this.progressLoading = true;
|
|
|
|
|
// 更新UI或执行其他逻辑,比如显示进度条
|
|
|
|
|
console.log(`上传进度: ${percentCompleted}%`);
|
|
|
|
|
this.progress = Math.round(percentCompleted);
|
|
|
|
|
|
|
|
|
|
// 你可以通过其他方式将进度信息传递给组件或Vue实例
|
|
|
|
|
// this.uploadProgress = percentCompleted; // 假设你有一个data属性来存储进度
|
|
|
|
|
})
|
|
|
|
|
.then((res) => {
|
|
|
|
|
console.log(res);
|
|
|
|
|
// this.progressLoading = true;
|
|
|
|
@ -220,7 +241,7 @@ export default {
|
|
|
|
|
this.reportData.title = "";
|
|
|
|
|
this.$refs.upload.clearFiles();
|
|
|
|
|
this.getUpgradeList();
|
|
|
|
|
// this.progressLoading = false;
|
|
|
|
|
this.progressLoading = false;
|
|
|
|
|
} else {
|
|
|
|
|
this.$message({
|
|
|
|
|
duration: 1500,
|
|
|
|
|