feat: 前后端+飞书全链路联调成功 - 创建项目自动发送飞书通知
Some checks failed
CI / lint-and-typecheck (push) Failing after 33s
CI / test (push) Has been skipped
CI / build (push) Has been skipped

This commit is contained in:
2026-04-12 02:08:02 +08:00
parent 28340b23c1
commit ab0154bcf9
4 changed files with 107 additions and 4 deletions

View File

@@ -185,13 +185,29 @@ const WizardPage: React.FC = () => {
const [project, setProject] = useState<ProjectData>(createEmptyProject());
const [submitted, setSubmitted] = useState(false);
const [submitting, setSubmitting] = useState(false);
const next = () => setCurrent(Math.min(current + 1, STEPS.length - 1));
const prev = () => setCurrent(Math.max(current - 1, 0));
const handleSubmit = () => {
setSubmitted(true);
Message.success(`项目「${project.name}」已创建!`);
console.log('Project created:', project);
const handleSubmit = async () => {
setSubmitting(true);
try {
const res = await fetch('/api/projects', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(project),
});
const data = await res.json();
setSubmitted(true);
Message.success(`项目「${project.name}」已创建!飞书通知已发送。`);
console.log('Project created:', data);
} catch (err) {
Message.error('创建失败,请重试');
console.error('Failed to create project:', err);
} finally {
setSubmitting(false);
}
};
const renderStep = () => {
@@ -328,6 +344,7 @@ const WizardPage: React.FC = () => {
type="primary"
onClick={handleSubmit}
disabled={!project.name || !project.goal}
loading={submitting}
>
</Button>