fix
parent
bc292b63ab
commit
b49e43f1b7
|
|
@ -10,7 +10,7 @@ module.exports = {
|
|||
javaGitBranch: "dev",
|
||||
// 本地联调 safetyEval-service(context-path: /safetyEval,默认端口 8095)
|
||||
// 可通过环境变量覆盖: SAFETY_EVAL_API_HOST=http://192.168.x.x:8095
|
||||
API_HOST: "http://127.0.0.1",
|
||||
API_HOST: "http://192.168.0.152",
|
||||
},
|
||||
production: {
|
||||
// 应用后端分支名称,部署上线需要
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { Form, Image, Upload } from "antd";
|
||||
import { Form, Image, Upload, message } from "antd";
|
||||
import { useState } from "react";
|
||||
import { PlusOutlined } from "@ant-design/icons";
|
||||
const isImage = (url) =>
|
||||
/\.(png|jpe?g|gif|bmp|webp|svg)(\?.*)?$/i.test(url || "");
|
||||
|
||||
export default function AttachmentUpload({ name, label, disabled = false, maxCount, accept }) {
|
||||
export default function AttachmentUpload({ name, label, disabled = false, maxCount, accept, extra }) {
|
||||
const [previewImage, setPreviewImage] = useState("");
|
||||
|
||||
return (
|
||||
|
|
@ -12,6 +12,7 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
|
|||
<Form.Item
|
||||
name={name}
|
||||
label={label}
|
||||
extra={extra}
|
||||
valuePropName="fileList"
|
||||
getValueProps={(value) => {
|
||||
if (Array.isArray(value)) {
|
||||
|
|
@ -56,6 +57,16 @@ export default function AttachmentUpload({ name, label, disabled = false, maxCou
|
|||
maxCount={maxCount}
|
||||
accept={accept}
|
||||
action={`${window.process.env.app.API_HOST}/safetyEval/file/upload`}
|
||||
beforeUpload={(file) => {
|
||||
if (!accept) return true;
|
||||
const exts = accept.split(",").map((e) => e.trim().toLowerCase());
|
||||
const ext = "." + file.name.split(".").pop().toLowerCase();
|
||||
if (!exts.includes(ext)) {
|
||||
message.error(`仅支持 ${accept} 格式文件`);
|
||||
return Upload.LIST_IGNORE;
|
||||
}
|
||||
return true;
|
||||
}}
|
||||
onPreview={(file) => {
|
||||
if (isImage(file.url || file.thumbUrl)) {
|
||||
setPreviewImage(file.url || file.thumbUrl);
|
||||
|
|
|
|||
|
|
@ -130,6 +130,8 @@ export default function BasicInfoStep({ form, disabled }) {
|
|||
name="attachmentUrl"
|
||||
label="上传附件"
|
||||
disabled={disabled}
|
||||
maxCount={12}
|
||||
accept=".pdf,.doc,.docx"
|
||||
/>
|
||||
</Col>
|
||||
</Row>
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ export default function CommitmentStep({
|
|||
</Col>
|
||||
</Row>
|
||||
<AttachmentUpload
|
||||
extra="请上传一张电子签名图片"
|
||||
name="legalRepSignatureUrl"
|
||||
label="电子签名"
|
||||
disabled={disabled}
|
||||
|
|
|
|||
Loading…
Reference in New Issue