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);
|
const LetterEditorContext = createContext<LetterEditorContextType | null>(null);
|
||||||
function generateRandomString(length: number = 6): string {
|
function generateRandomString(length: number = 6): string {
|
||||||
const characters =
|
const characters =
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
|
||||||
let result = "";
|
let result = "";
|
||||||
const charactersLength = characters.length;
|
const charactersLength = characters.length;
|
||||||
|
|
||||||
|
@ -43,7 +43,6 @@ function generateRandomString(length: number = 6): string {
|
||||||
const randomIndex = Math.floor(Math.random() * charactersLength);
|
const randomIndex = Math.floor(Math.random() * charactersLength);
|
||||||
result += characters.charAt(randomIndex);
|
result += characters.charAt(randomIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,7 +63,7 @@ export function LetterFormProvider({
|
||||||
const ownCode = generateRandomString();
|
const ownCode = generateRandomString();
|
||||||
delete data.receivers;
|
delete data.receivers;
|
||||||
delete data.term;
|
delete data.term;
|
||||||
|
|
||||||
const result = await create.mutateAsync({
|
const result = await create.mutateAsync({
|
||||||
data: {
|
data: {
|
||||||
...data,
|
...data,
|
||||||
|
@ -98,28 +97,51 @@ export function LetterFormProvider({
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const formattedDateTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
const formattedDateTime = dayjs().format("YYYY-MM-DD HH:mm:ss");
|
||||||
// 创建包含信件编号和提交时间的文本
|
// 创建包含信件编号和提交时间的文本 信件cuid:${result.id}\n(编号区分大小写)
|
||||||
const fileContent = `信件编号: ${ownCode}\n投递时间: ${formattedDateTime}\n 信件cuid:${result.id}\n(编号区分大小写)`;
|
const fileContent = `信件回执编号: ${ownCode}\n投递时间: ${formattedDateTime}\n `;
|
||||||
// 创建包含信件编号和提交时间的Blob对象
|
// 创建包含信件编号和提交时间的Blob对象
|
||||||
const blob = new Blob([fileContent], { type: "text/plain" });
|
const blob = new Blob([fileContent], { type: "text/plain" });
|
||||||
// 创建下载链接
|
// // 创建下载链接
|
||||||
const downloadUrl = window.URL.createObjectURL(blob);
|
// const downloadUrl = window.URL.createObjectURL(blob);
|
||||||
const link = document.createElement("a");
|
// const link = document.createElement("a");
|
||||||
link.href = downloadUrl;
|
// link.href = downloadUrl;
|
||||||
link.download = `信件编号(区分大小写)-${ownCode}.txt`; // 设置下载文件名
|
// link.download = `信件回执编号(区分大小写)-${ownCode}.txt`; // 设置下载文件名
|
||||||
document.body.appendChild(link);
|
// document.body.appendChild(link);
|
||||||
link.click();
|
// link.click();
|
||||||
document.body.removeChild(link);
|
// document.body.removeChild(link);
|
||||||
window.URL.revokeObjectURL(downloadUrl);
|
// window.URL.revokeObjectURL(downloadUrl);
|
||||||
|
|
||||||
toast.success(
|
toast.success(
|
||||||
`信件投递成功!信件编号已保存到本地,请妥善保管用于进度查询`,
|
`信件投递成功!`,
|
||||||
{
|
{
|
||||||
duration: 5000, // 10秒
|
duration: 5000, // 10秒
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
const searchParams = new URLSearchParams({
|
||||||
navigate("/");
|
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`, {
|
// navigate(`/${result.id}/detail`, {
|
||||||
// replace: true,
|
// replace: true,
|
||||||
// state: { scrollToTop: true },
|
// state: { scrollToTop: true },
|
||||||
|
|
|
@ -30,14 +30,12 @@ export function LetterBasicForm() {
|
||||||
try {
|
try {
|
||||||
await form.validateFields();
|
await form.validateFields();
|
||||||
form.submit();
|
form.submit();
|
||||||
|
|
||||||
// toast.success("提交成功!");
|
// toast.success("提交成功!");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// 提取所有错误信息
|
// 提取所有错误信息
|
||||||
const errorMessages = (error as any).errorFields
|
const errorMessages = (error as any).errorFields
|
||||||
.map((field) => field.errors[0])
|
.map((field) => field.errors[0])
|
||||||
.filter(Boolean);
|
.filter(Boolean);
|
||||||
|
|
||||||
// 显示 toast 错误提示
|
// 显示 toast 错误提示
|
||||||
toast.error(
|
toast.error(
|
||||||
<div className="flex flex-col gap-1">
|
<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 InboxPage from "../app/main/letter/inbox/page";
|
||||||
import OutboxPage from "../app/main/letter/outbox/page";
|
import OutboxPage from "../app/main/letter/outbox/page";
|
||||||
import IndexPage from "../app/main/letter/index/page";
|
import IndexPage from "../app/main/letter/index/page";
|
||||||
|
import SubmissionSuccess from "../app/SubmissionSuccess";
|
||||||
export const routes: CustomRouteObject[] = [
|
export const routes: CustomRouteObject[] = [
|
||||||
{
|
{
|
||||||
path: "/",
|
path: "/",
|
||||||
|
@ -64,6 +65,10 @@ export const routes: CustomRouteObject[] = [
|
||||||
path: "help",
|
path: "help",
|
||||||
element: <HelpPage></HelpPage>,
|
element: <HelpPage></HelpPage>,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "submission-success",
|
||||||
|
element: <SubmissionSuccess></SubmissionSuccess>,
|
||||||
|
}
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
adminRoute,
|
adminRoute,
|
||||||
|
@ -71,9 +76,9 @@ export const routes: CustomRouteObject[] = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/auth",
|
path: "/auth",
|
||||||
|
|
||||||
element: <AuthPage></AuthPage>,
|
element: <AuthPage></AuthPage>,
|
||||||
},
|
},
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export const router = createBrowserRouter(routes);
|
export const router = createBrowserRouter(routes);
|
||||||
|
|
|
@ -101,7 +101,7 @@ server {
|
||||||
# 仅供内部使用
|
# 仅供内部使用
|
||||||
internal;
|
internal;
|
||||||
# 代理到认证服务
|
# 代理到认证服务
|
||||||
proxy_pass http://host.docker.internal:3002/auth/file;
|
proxy_pass http://host.docker.internal:/auth/file;
|
||||||
# 请求优化:不传递请求体
|
# 请求优化:不传递请求体
|
||||||
proxy_pass_request_body off;
|
proxy_pass_request_body off;
|
||||||
proxy_set_header Content-Length "";
|
proxy_set_header Content-Length "";
|
||||||
|
|
|
@ -199,7 +199,7 @@ export enum PostState {
|
||||||
export const PostStateLabels = {
|
export const PostStateLabels = {
|
||||||
[PostState.PENDING]: "待处理",
|
[PostState.PENDING]: "待处理",
|
||||||
[PostState.PROCESSING]: "处理中",
|
[PostState.PROCESSING]: "处理中",
|
||||||
[PostState.RESOLVED]: "已完成",
|
[PostState.RESOLVED]: "已回复",
|
||||||
};
|
};
|
||||||
export enum RoleName {
|
export enum RoleName {
|
||||||
Basic = "基层", // 基层
|
Basic = "基层", // 基层
|
||||||
|
|
1343
pnpm-lock.yaml
1343
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue