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