Commit cc9d42dc authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-修改bug

parent 402d9e3d
......@@ -366,8 +366,9 @@
return this.$message.error(res.data.msg);
}
let url = res.data.url;
let reg = /^.+(\.pdf|\.txt|\.mp3|\.mp4)$/;
if (reg.test(url)) {
let reg = /(\.pdf|\.txt|\.mp3|\.mp4)/;
let regImg = /(\.jpg|\.png|\.jpeg)/;
if (reg.test(url) || regImg.test(url)) {
window.open(url, "_black");
} else {
window.open(url, "_self");
......@@ -382,8 +383,9 @@
return this.$message.error(res.data.msg);
}
let url = res.data.url;
let reg = /^.+(\.pdf|\.txt|\.mp3|\.mp4)$/;
if (reg.test(url)) {
let reg = /(\.pdf|\.txt|\.mp3|\.mp4)/;
let regImg = /(\.jpg|\.png|\.jpeg)/;
if (reg.test(url) || regImg.test(url)) {
window.open(url, "_black");
} else {
window.open(url, "_self");
......@@ -443,7 +445,7 @@
let arr = scoreFileList.split(",");
this.tea_scoreFileList = arr.map((item) => {
return {
name: item.split("workforstudent/")[1],
name: item.split("work/")[1],
url: item,
};
});
......@@ -481,6 +483,17 @@
},
//上传前
beforeAvatarUpload(file) {
let isName = false;
for (let i = 0; i < this.stu_fileList.length; i++) {
if (this.stu_fileList[i].name == file.name) {
isName = true;
break;
}
}
if (isName) {
this.$message.info("不能上传同名文件");
return false;
}
const isLt500M = file.size / 1024 / 1024 < 500;
if (!isLt500M) {
this.$message.info("上传图片大小不能超过 500MB!");
......@@ -500,7 +513,6 @@
},
// cos上传
async getCosConfigs(image, file) {
console.log(file)
this.isUploading = true;
await cosSignature({image: image, index: '2'})
.then((res) => {
......@@ -555,6 +567,7 @@
await achievementCallBack({key: resData.key, index: 2}).then(res => {
if (res.data.code != 200) {
this.loading = false;
this.isUploading = false;
return this.$message.error('上传失败!');
}
this.isUploading = false;
......
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