mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/fe-manage.git
synced 2025-12-07 01:46:43 +08:00
fix:上传证书修改
This commit is contained in:
@@ -372,6 +372,7 @@ import { reactive, toRefs } from "vue";
|
||||
import CreateCertificate from "../../../components/drawers/project/CreateCertificate";
|
||||
import { message } from "ant-design-vue";
|
||||
import * as api from "@/api/index1";
|
||||
import { fileUp } from "../../../api/indexEval";
|
||||
export default {
|
||||
name: "AddCertificate",
|
||||
components: {
|
||||
@@ -587,12 +588,43 @@ export default {
|
||||
}
|
||||
};
|
||||
|
||||
function beforeUpload(file) {
|
||||
if (!state.fileType.includes(file.name.split(".").slice(-1).join(""))) {
|
||||
message.error("不支持该格式");
|
||||
const beforeUpload = (file) => {
|
||||
const isJpgOrPng =
|
||||
file.type === "image/jpg" ||
|
||||
file.type === "image/jpeg" ||
|
||||
file.type === "image/png" ||
|
||||
file.type === "image/svg" ||
|
||||
file.type === "image/bmp" ||
|
||||
file.type === "image/gif";
|
||||
if (!isJpgOrPng) {
|
||||
message.error("仅支持jpg、gif、png、jpeg、svg、bmp格式!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
let isLt1M = file.size / 10240 / 10240 <= 1;
|
||||
if (!isLt1M) {
|
||||
this.$message.error("图片大小超过10MB!");
|
||||
return false;
|
||||
}
|
||||
|
||||
const formDatas = new FormData();
|
||||
formDatas.append("file", file);
|
||||
fileUp(formDatas).then((res) => {
|
||||
if (res.data.code === 200) {
|
||||
console.log(file)
|
||||
state.imageUrl = res.data.data;
|
||||
state.imageName = file.name;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
};
|
||||
|
||||
// function beforeUpload(file) {
|
||||
// if (!state.fileType.includes(file.name.split(".").slice(-1).join(""))) {
|
||||
// message.error("不支持该格式");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
//查看证书
|
||||
const getcertificate = () => {
|
||||
|
||||
Reference in New Issue
Block a user