add
This commit is contained in:
parent
bf6d3a6956
commit
5ac265819e
|
@ -1,11 +1,16 @@
|
||||||
import PostDetail from "@web/src/components/models/post/detail/PostDetail";
|
import PostDetail from "@web/src/components/models/post/detail/PostDetail";
|
||||||
|
import { useEffect } from "react";
|
||||||
import { useParams } from "react-router-dom";
|
import { useParams } from "react-router-dom";
|
||||||
|
|
||||||
export default function LetterDetailPage() {
|
export default function LetterDetailPage() {
|
||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
useEffect(() => {
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
}, []);
|
||||||
|
|
||||||
return <div className="shadow-elegant border-2 border-white rounded-xl bg-slate-200">
|
return (
|
||||||
|
<div className="shadow-elegant border-2 border-white rounded-xl bg-slate-200">
|
||||||
<PostDetail id={id}></PostDetail>
|
<PostDetail id={id}></PostDetail>
|
||||||
</div>;
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,11 +45,6 @@ export function LetterFormProvider({
|
||||||
|
|
||||||
const onSubmit = async (data: LetterFormData) => {
|
const onSubmit = async (data: LetterFormData) => {
|
||||||
try {
|
try {
|
||||||
if (!data?.content) {
|
|
||||||
toast.error("请输入正文");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("data", data);
|
|
||||||
const receivers = data?.receivers;
|
const receivers = data?.receivers;
|
||||||
const terms = data?.terms;
|
const terms = data?.terms;
|
||||||
delete data.receivers;
|
delete data.receivers;
|
||||||
|
@ -104,7 +99,10 @@ export function LetterFormProvider({
|
||||||
duration: 5000, // 10秒
|
duration: 5000, // 10秒
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
navigate(`/${result.id}/detail`, { replace: true });
|
navigate(`/${result.id}/detail`, {
|
||||||
|
replace: true,
|
||||||
|
state: { scrollToTop: true },
|
||||||
|
});
|
||||||
form.resetFields();
|
form.resetFields();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error submitting form:", error);
|
console.error("Error submitting form:", error);
|
||||||
|
|
|
@ -119,7 +119,7 @@ export function LetterBasicForm() {
|
||||||
</TabPane>
|
</TabPane>
|
||||||
</Tabs>
|
</Tabs>
|
||||||
{/* Footer Actions */}
|
{/* Footer Actions */}
|
||||||
<div className="flex flex-col-reverse sm:flex-row items-center justify-between gap-4 ">
|
<div className="flex flex-col-reverse sm:flex-row items-center justify-between gap-4 mt-2 ">
|
||||||
<Form.Item name="isPublic" valuePropName="checked">
|
<Form.Item name="isPublic" valuePropName="checked">
|
||||||
<Checkbox className="text-gray-600 hover:text-gray-900 transition-colors text-sm">
|
<Checkbox className="text-gray-600 hover:text-gray-900 transition-colors text-sm">
|
||||||
是否公开
|
是否公开
|
||||||
|
|
Loading…
Reference in New Issue