import './proj-new.css'; import {Link, useNavigate, useParams, useSearchParams} from "react-router-dom"; import {Breadcrumb, Button, Flex, Form, Input, message, Modal, Spin} from "antd"; import {useEffect, useState} from "react"; import {get, post} from "../../util/AjaxUtils.ts"; import {IProjCharge, ProjAdditionalType, ProjChargeType} from "../../interfaces/proj/IProj.ts"; const {TextArea} = Input; type ProjInfo = { projName: string; projIntroduction: string; }; export default function ProjNew() { const nav = useNavigate(); const pathParams = useParams(); const [queryParams] = useSearchParams(); const [messageApi, contextHolder] = message.useMessage(); const [loading, setLoading] = useState(false); const height = window.innerHeight - 150; const [isCreateModalOpen, setIsCreateModalOpen] = useState(false); const [isEditModalOpen, setIsEditModalOpen] = useState(false); const [chargePrice, setChargePrice] = useState(0); const [projInfo, setProjInfo] = useState({ projName: '', projIntroduction: '', }); const listProjChargeAdditional: string[] = []; let createProjId = ''; useEffect(() => { get({ messageApi: messageApi, url: '/api/proj/charge/get', onSuccess({data}) { const charge = data as IProjCharge; let price = 0; switch (pathParams.projChargeType) { case ProjChargeType.ALL: price = charge.proj.all; break; case ProjChargeType.MATERIAL_AGENT: price = charge.proj.materialAgent; break; case ProjChargeType.MATERIAL_AGENT_URGENT: price = charge.proj.materialAgentUrgent; break; case ProjChargeType.MATERIAL: price = charge.proj.material; break; case ProjChargeType.FREE: price = charge.proj.free; break; default: messageApi.error({ type: 'error', content: '价格类型错误', }) } if (queryParams.get('pkg')) { price += charge.additional.pkg; listProjChargeAdditional.push(ProjAdditionalType.PKG); } if (queryParams.get('videoDemo')) { price += charge.additional.videoDemo; listProjChargeAdditional.push(ProjAdditionalType.VIDEO_DEMO); } setChargePrice(price); } }) }, []); const onBack = () => { nav(-1); } return ( <> {contextHolder} 首页}, {title: 创建项目}, {title: '新建项目'}, ]} />
请完善项目的基本信息
{ setIsCreateModalOpen(true); setProjInfo({ projName: formData.projName, projIntroduction: formData.projIntroduction }) }} autoComplete="off" > label="系统标题" name="projName" rules={[{required: true, message: '请输入系统标题'}]} > label="简单描述" name="projIntroduction" rules={[{required: true, message: '请输入简单描述'}]} >