add
This commit is contained in:
parent
24e936d672
commit
0c031ddff3
|
@ -0,0 +1,38 @@
|
|||
import { useEffect } from "react";
|
||||
import { useSearchParams } from "react-router-dom";
|
||||
import { Form } from "antd";
|
||||
|
||||
export default function SubmissionSuccess() {
|
||||
const [searchParams] = useSearchParams();
|
||||
useEffect(() => {
|
||||
window.scrollTo(0, 0);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="bg-white min-h-screen flex flex-col items-center rounded-xl p-40">
|
||||
<h1 className="text-3xl font-bold mb-8 text-green-700">信件投递成功</h1>
|
||||
{/* 投递时间 */}
|
||||
<Form className="w-full max-w-2xl"> {/* 新增宽度容器 */}
|
||||
<Form.Item
|
||||
className="grid grid-cols-[1fr_2fr] items-center pb-2 gap-4 w-full"
|
||||
>
|
||||
<span className="text-gray-600">投递时间:</span>
|
||||
<span className="text-min text-left text-gray-600">
|
||||
{searchParams.get("submitTime")}
|
||||
</span>
|
||||
</Form.Item>
|
||||
</Form>
|
||||
{/* 回执编号 */}
|
||||
<div className="bg-blue-100 p-6 rounded-lg mb-8 w-full max-w-2xl"> {/* 已有相同宽度 */}
|
||||
<div className="text-4xl font-mono text-center text-blue-600 font-bold">
|
||||
{searchParams.get("ownCode")}
|
||||
</div>
|
||||
</div>
|
||||
<Form className="w-full max-w-2xl space-y-4 mb-8 text-center">
|
||||
<span className="mt-8 text-gray-500 text-sm">
|
||||
请妥善保管您的信件密钥,以便用于进度查询
|
||||
</span>
|
||||
</Form>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -35,7 +35,7 @@ interface LetterFormProviderProps {
|
|||
const LetterEditorContext = createContext<LetterEditorContextType | null>(null);
|
||||
function generateRandomString(length: number = 6): string {
|
||||
const characters =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||
let result = "";
|
||||
const charactersLength = characters.length;
|
||||
|
||||
|
@ -43,7 +43,6 @@ function generateRandomString(length: number = 6): string {
|
|||
const randomIndex = Math.floor(Math.random() * charactersLength);
|
||||
result += characters.charAt(randomIndex);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -98,28 +97,51 @@ export function LetterFormProvider({
|
|||
},
|
||||
});
|
||||
const formattedDateTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
||||
// 创建包含信件编号和提交时间的文本
|
||||
const fileContent = `信件编号: ${ownCode}\n投递时间: ${formattedDateTime}\n 信件cuid:${result.id}\n(编号区分大小写)`;
|
||||
// 创建包含信件编号和提交时间的文本 信件cuid:${result.id}\n(编号区分大小写)
|
||||
const fileContent = `信件回执编号: ${ownCode}\n投递时间: ${formattedDateTime}\n `;
|
||||
// 创建包含信件编号和提交时间的Blob对象
|
||||
const blob = new Blob([fileContent], { type: "text/plain" });
|
||||
// 创建下载链接
|
||||
const downloadUrl = window.URL.createObjectURL(blob);
|
||||
const link = document.createElement("a");
|
||||
link.href = downloadUrl;
|
||||
link.download = `信件编号(区分大小写)-${ownCode}.txt`; // 设置下载文件名
|
||||
document.body.appendChild(link);
|
||||
link.click();
|
||||
document.body.removeChild(link);
|
||||
window.URL.revokeObjectURL(downloadUrl);
|
||||
|
||||
// // 创建下载链接
|
||||
// const downloadUrl = window.URL.createObjectURL(blob);
|
||||
// const link = document.createElement("a");
|
||||
// link.href = downloadUrl;
|
||||
// link.download = `信件回执编号(区分大小写)-${ownCode}.txt`; // 设置下载文件名
|
||||
// document.body.appendChild(link);
|
||||
// link.click();
|
||||
// document.body.removeChild(link);
|
||||
// window.URL.revokeObjectURL(downloadUrl);
|
||||
toast.success(
|
||||
`信件投递成功!信件编号已保存到本地,请妥善保管用于进度查询`,
|
||||
`信件投递成功!`,
|
||||
{
|
||||
duration: 5000, // 10秒
|
||||
}
|
||||
);
|
||||
|
||||
navigate("/");
|
||||
const searchParams = new URLSearchParams({
|
||||
ownCode,
|
||||
submitTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||
});
|
||||
// navigate(`/submission-success?${searchParams}`, {
|
||||
// state: {
|
||||
// ownCode,
|
||||
// submitTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||
// }
|
||||
// });
|
||||
if (data.isPublic) {
|
||||
navigate("/", {
|
||||
state: {
|
||||
successMessage: "信件提交成功",
|
||||
ownCode
|
||||
}
|
||||
});
|
||||
} else {
|
||||
navigate(`/submission-success?${searchParams}`, {
|
||||
state: {
|
||||
ownCode,
|
||||
submitTime: dayjs().format("YYYY-MM-DD HH:mm:ss")
|
||||
}
|
||||
});
|
||||
}
|
||||
// window.open(`/submission-success?${searchParams}`, '_blank');
|
||||
// navigate(`/${result.id}/detail`, {
|
||||
// replace: true,
|
||||
// state: { scrollToTop: true },
|
||||
|
|
|
@ -30,14 +30,12 @@ export function LetterBasicForm() {
|
|||
try {
|
||||
await form.validateFields();
|
||||
form.submit();
|
||||
|
||||
// toast.success("提交成功!");
|
||||
} catch (error) {
|
||||
// 提取所有错误信息
|
||||
const errorMessages = (error as any).errorFields
|
||||
.map((field) => field.errors[0])
|
||||
.filter(Boolean);
|
||||
|
||||
// 显示 toast 错误提示
|
||||
toast.error(
|
||||
<div className="flex flex-col gap-1">
|
||||
|
|
|
@ -13,6 +13,7 @@ import { adminRoute } from "./admin-route";
|
|||
import InboxPage from "../app/main/letter/inbox/page";
|
||||
import OutboxPage from "../app/main/letter/outbox/page";
|
||||
import IndexPage from "../app/main/letter/index/page";
|
||||
import SubmissionSuccess from "../app/SubmissionSuccess";
|
||||
export const routes: CustomRouteObject[] = [
|
||||
{
|
||||
path: "/",
|
||||
|
@ -64,6 +65,10 @@ export const routes: CustomRouteObject[] = [
|
|||
path: "help",
|
||||
element: <HelpPage></HelpPage>,
|
||||
},
|
||||
{
|
||||
path: "submission-success",
|
||||
element: <SubmissionSuccess></SubmissionSuccess>,
|
||||
}
|
||||
],
|
||||
},
|
||||
adminRoute,
|
||||
|
@ -71,9 +76,9 @@ export const routes: CustomRouteObject[] = [
|
|||
},
|
||||
{
|
||||
path: "/auth",
|
||||
|
||||
element: <AuthPage></AuthPage>,
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
export const router = createBrowserRouter(routes);
|
||||
|
|
|
@ -101,7 +101,7 @@ server {
|
|||
# 仅供内部使用
|
||||
internal;
|
||||
# 代理到认证服务
|
||||
proxy_pass http://host.docker.internal:3002/auth/file;
|
||||
proxy_pass http://host.docker.internal:/auth/file;
|
||||
# 请求优化:不传递请求体
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
|
|
|
@ -199,7 +199,7 @@ export enum PostState {
|
|||
export const PostStateLabels = {
|
||||
[PostState.PENDING]: "待处理",
|
||||
[PostState.PROCESSING]: "处理中",
|
||||
[PostState.RESOLVED]: "已完成",
|
||||
[PostState.RESOLVED]: "已回复",
|
||||
};
|
||||
export enum RoleName {
|
||||
Basic = "基层", // 基层
|
||||
|
|
1343
pnpm-lock.yaml
1343
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue