Commit cc9d42dc authored by wuwangwolihui's avatar wuwangwolihui

营地2.0-修改bug

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