Commit 911e9aa3 authored by 沈翠玲's avatar 沈翠玲

优化作业端版本记录上传

parent 0ecfcdb2
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
:headers="headers" :headers="headers"
:show-file-list="false" :show-file-list="false"
:limit="1"> :limit="1">
<el-button size="small" type="primary">浏览</el-button> <el-button size="small" type="primary" :loading="loading">浏览</el-button>
</el-upload> </el-upload>
</el-input> </el-input>
</el-form-item> </el-form-item>
...@@ -166,6 +166,7 @@ ...@@ -166,6 +166,7 @@
title: "", title: "",
// 是否显示弹出层 // 是否显示弹出层
open: false, open: false,
loading: false,
// 查询参数 // 查询参数
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
...@@ -189,18 +190,18 @@ ...@@ -189,18 +190,18 @@
methods: { methods: {
// 上传前校检格式和大小 // 上传前校检格式和大小
handleBeforeUpload(file) { handleBeforeUpload(file) {
// 校检文件大小 this.loading = true
if (this.fileSize) { // 校检文件后缀名
const isLt = file.size / 1024 / 1024 < this.fileSize; if(file && file.name && file.name.substring(file.name.lastIndexOf('.') + 1) === 'apk') {
if (!isLt) { return true;
this.$message.error(`上传文件大小不能超过 ${this.fileSize} MB!`); } else {
this.$message.error('请上传APK安装包');
this.loading = false
return false; return false;
} }
}
console.log('file', file)
return true;
}, },
handleUploadSuccess(res, file) { handleUploadSuccess(res, file) {
this.loading = false
// 如果上传成功 // 如果上传成功
if (res.code == 200) { if (res.code == 200) {
this.form.url = res.url this.form.url = res.url
...@@ -211,6 +212,7 @@ ...@@ -211,6 +212,7 @@
this.$refs.upload.clearFiles(); this.$refs.upload.clearFiles();
}, },
handleUploadError() { handleUploadError() {
this.loading = false
this.$message.error("文件上传失败"); this.$message.error("文件上传失败");
}, },
/** 查询作业端版本记录列表 */ /** 查询作业端版本记录列表 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment