nsgm-cli 2.1.19 → 2.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/components/Button.tsx +3 -3
- package/client/components/ClientProviders.tsx +12 -12
- package/client/components/LanguageSwitcher.tsx +26 -26
- package/client/components/SSRSafeAntdProvider.tsx +7 -7
- package/client/components/SuppressHydrationWarnings.tsx +30 -30
- package/client/components/__tests__/Button.test.tsx +12 -12
- package/client/layout/index.tsx +124 -124
- package/client/redux/reducers.ts +2 -2
- package/client/redux/store.ts +24 -24
- package/client/redux/template/manage/actions.ts +40 -40
- package/client/redux/template/manage/reducers.ts +32 -32
- package/client/redux/template/manage/types.ts +19 -19
- package/client/service/template/manage.ts +29 -29
- package/client/styled/common.ts +6 -6
- package/client/styled/layout/index.ts +17 -17
- package/client/styled/template/manage.ts +19 -19
- package/client/utils/common.ts +54 -54
- package/client/utils/cookie.ts +30 -30
- package/client/utils/fetch.ts +111 -111
- package/client/utils/i18n.ts +41 -41
- package/client/utils/menu.tsx +12 -12
- package/client/utils/navigation.ts +22 -22
- package/client/utils/sso.ts +124 -124
- package/client/utils/suppressWarnings.ts +17 -17
- package/generation/prettierrc +6 -0
- package/lib/args.js +19 -19
- package/lib/cli/app.d.ts +1 -1
- package/lib/cli/app.js +2 -2
- package/lib/cli/commands/build.d.ts +1 -1
- package/lib/cli/commands/build.js +9 -9
- package/lib/cli/commands/create.d.ts +1 -1
- package/lib/cli/commands/create.js +36 -36
- package/lib/cli/commands/delete.d.ts +1 -1
- package/lib/cli/commands/delete.js +55 -55
- package/lib/cli/commands/export.d.ts +1 -1
- package/lib/cli/commands/export.js +12 -12
- package/lib/cli/commands/help.d.ts +1 -1
- package/lib/cli/commands/help.js +29 -29
- package/lib/cli/commands/init.d.ts +1 -1
- package/lib/cli/commands/init.js +31 -31
- package/lib/cli/commands/server.d.ts +1 -1
- package/lib/cli/commands/server.js +12 -12
- package/lib/cli/commands/upgrade.d.ts +1 -1
- package/lib/cli/commands/upgrade.js +13 -13
- package/lib/cli/commands/version.d.ts +1 -1
- package/lib/cli/commands/version.js +7 -7
- package/lib/cli/index.d.ts +13 -13
- package/lib/cli/parser.d.ts +1 -1
- package/lib/cli/parser.js +12 -12
- package/lib/cli/registry.d.ts +1 -1
- package/lib/cli/types.d.ts +2 -2
- package/lib/cli/utils/console.d.ts +2 -2
- package/lib/cli/utils/console.js +22 -22
- package/lib/cli/utils/index.d.ts +2 -2
- package/lib/cli/utils/prompt.d.ts +1 -1
- package/lib/cli/utils/prompt.js +98 -98
- package/lib/constants.js +28 -28
- package/lib/generate.d.ts +2 -2
- package/lib/generate.js +19 -19
- package/lib/generate_create.d.ts +1 -1
- package/lib/generate_create.js +38 -38
- package/lib/generate_delete.js +63 -63
- package/lib/generate_init.js +94 -94
- package/lib/generators/base-generator.d.ts +1 -1
- package/lib/generators/base-generator.js +23 -23
- package/lib/generators/file-generator.js +15 -15
- package/lib/generators/generator-factory.d.ts +5 -5
- package/lib/generators/i18n-generator.d.ts +1 -1
- package/lib/generators/i18n-generator.js +127 -127
- package/lib/generators/page-generator.d.ts +1 -1
- package/lib/generators/page-generator.js +25 -25
- package/lib/generators/resolver-generator.d.ts +1 -1
- package/lib/generators/resolver-generator.js +27 -27
- package/lib/generators/schema-generator.d.ts +1 -1
- package/lib/generators/schema-generator.js +4 -4
- package/lib/generators/service-generator.d.ts +1 -1
- package/lib/generators/service-generator.js +29 -29
- package/lib/generators/sql-generator.d.ts +1 -1
- package/lib/generators/sql-generator.js +10 -10
- package/lib/index.js +23 -23
- package/lib/server/csrf.d.ts +3 -3
- package/lib/server/csrf.js +20 -20
- package/lib/server/db.d.ts +1 -1
- package/lib/server/db.js +21 -21
- package/lib/server/graphql.js +26 -26
- package/lib/server/plugins/date.d.ts +1 -1
- package/lib/server/plugins/date.js +6 -6
- package/lib/server/utils/graphql-cache.js +5 -5
- package/lib/tsconfig.build.tsbuildinfo +1 -1
- package/lib/utils/project-config.d.ts +1 -1
- package/lib/utils/project-config.js +20 -20
- package/lib/utils.js +3 -3
- package/package.json +1 -1
- package/pages/_app.tsx +62 -62
- package/pages/_document.tsx +15 -15
- package/pages/_error.tsx +26 -26
- package/pages/index.tsx +48 -48
- package/pages/login.tsx +64 -64
- package/pages/template/manage.tsx +175 -175
package/pages/index.tsx
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import _ from
|
|
2
|
-
import { Container } from
|
|
3
|
-
import React from
|
|
4
|
-
import { Card, Typography, Divider, Row, Col, Tag } from
|
|
5
|
-
import { CodeOutlined, BookOutlined, DatabaseOutlined, SettingOutlined } from
|
|
6
|
-
import { useTranslation } from
|
|
7
|
-
import { serverSideTranslations } from
|
|
1
|
+
import _ from "lodash";
|
|
2
|
+
import { Container } from "../client/styled/common";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Card, Typography, Divider, Row, Col, Tag } from "antd";
|
|
5
|
+
import { CodeOutlined, BookOutlined, DatabaseOutlined, SettingOutlined } from "@ant-design/icons";
|
|
6
|
+
import { useTranslation } from "next-i18next";
|
|
7
|
+
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
|
|
8
8
|
|
|
9
|
-
const { Title, Paragraph, Text } = Typography
|
|
9
|
+
const { Title, Paragraph, Text } = Typography;
|
|
10
10
|
|
|
11
11
|
const Page = () => {
|
|
12
|
-
const { t } = useTranslation([
|
|
12
|
+
const { t } = useTranslation(["common", "home"]);
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<Container>
|
|
16
|
-
<Typography style={{ padding:
|
|
17
|
-
<Row justify="space-between" align="middle" style={{ marginBottom:
|
|
16
|
+
<Typography style={{ padding: "24px" }}>
|
|
17
|
+
<Row justify="space-between" align="middle" style={{ marginBottom: "24px" }}>
|
|
18
18
|
<Col>
|
|
19
|
-
<Title level={1}>{t(
|
|
19
|
+
<Title level={1}>{t("home:page.title")}</Title>
|
|
20
20
|
</Col>
|
|
21
21
|
</Row>
|
|
22
22
|
|
|
@@ -36,20 +36,20 @@ const Page = () => {
|
|
|
36
36
|
</Col>
|
|
37
37
|
</Row>
|
|
38
38
|
</Paragraph>
|
|
39
|
-
<Paragraph>{t(
|
|
39
|
+
<Paragraph>{t("home:page.description")}</Paragraph>
|
|
40
40
|
|
|
41
|
-
<Card style={{ marginBottom:
|
|
41
|
+
<Card style={{ marginBottom: "24px" }}>
|
|
42
42
|
<Row gutter={[24, 16]}>
|
|
43
43
|
<Col xs={24} md={8}>
|
|
44
44
|
<Card
|
|
45
45
|
type="inner"
|
|
46
46
|
title={
|
|
47
47
|
<>
|
|
48
|
-
<DatabaseOutlined /> {t(
|
|
48
|
+
<DatabaseOutlined /> {t("home:page.sections.database.title")}
|
|
49
49
|
</>
|
|
50
50
|
}
|
|
51
51
|
>
|
|
52
|
-
{t(
|
|
52
|
+
{t("home:page.sections.database.description")}
|
|
53
53
|
</Card>
|
|
54
54
|
</Col>
|
|
55
55
|
<Col xs={24} md={8}>
|
|
@@ -57,11 +57,11 @@ const Page = () => {
|
|
|
57
57
|
type="inner"
|
|
58
58
|
title={
|
|
59
59
|
<>
|
|
60
|
-
<SettingOutlined /> {t(
|
|
60
|
+
<SettingOutlined /> {t("home:page.sections.project.title")}
|
|
61
61
|
</>
|
|
62
62
|
}
|
|
63
63
|
>
|
|
64
|
-
{t(
|
|
64
|
+
{t("home:page.sections.project.description")}
|
|
65
65
|
</Card>
|
|
66
66
|
</Col>
|
|
67
67
|
<Col xs={24} md={8}>
|
|
@@ -69,107 +69,107 @@ const Page = () => {
|
|
|
69
69
|
type="inner"
|
|
70
70
|
title={
|
|
71
71
|
<>
|
|
72
|
-
<CodeOutlined /> {t(
|
|
72
|
+
<CodeOutlined /> {t("home:page.sections.framework.title")}
|
|
73
73
|
</>
|
|
74
74
|
}
|
|
75
75
|
>
|
|
76
|
-
{t(
|
|
76
|
+
{t("home:page.sections.framework.description")}
|
|
77
77
|
</Card>
|
|
78
78
|
</Col>
|
|
79
79
|
</Row>
|
|
80
80
|
</Card>
|
|
81
81
|
|
|
82
82
|
<Title level={2}>
|
|
83
|
-
<BookOutlined /> {t(
|
|
83
|
+
<BookOutlined /> {t("home:page.commands.title")}
|
|
84
84
|
</Title>
|
|
85
85
|
<Divider />
|
|
86
86
|
|
|
87
87
|
<Row gutter={[16, 16]}>
|
|
88
88
|
<Col xs={24} md={8}>
|
|
89
89
|
<Card hoverable>
|
|
90
|
-
<Title level={4}>{t(
|
|
90
|
+
<Title level={4}>{t("home:page.commands.categories.projectManagement.title")}</Title>
|
|
91
91
|
<ul>
|
|
92
92
|
<li>
|
|
93
|
-
<Text strong>nsgm init</Text> - {t(
|
|
93
|
+
<Text strong>nsgm init</Text> - {t("home:page.commands.categories.projectManagement.items.init")}
|
|
94
94
|
</li>
|
|
95
95
|
<li>
|
|
96
|
-
<Text strong>nsgm upgrade</Text> -{
|
|
97
|
-
{t(
|
|
96
|
+
<Text strong>nsgm upgrade</Text> -{" "}
|
|
97
|
+
{t("home:page.commands.categories.projectManagement.items.upgrade")}
|
|
98
98
|
</li>
|
|
99
99
|
</ul>
|
|
100
100
|
</Card>
|
|
101
101
|
</Col>
|
|
102
102
|
<Col xs={24} md={8}>
|
|
103
103
|
<Card hoverable>
|
|
104
|
-
<Title level={4}>{t(
|
|
104
|
+
<Title level={4}>{t("home:page.commands.categories.templateOperations.title")}</Title>
|
|
105
105
|
<ul>
|
|
106
106
|
<li>
|
|
107
|
-
<Text strong>nsgm create</Text> - {t(
|
|
107
|
+
<Text strong>nsgm create</Text> - {t("home:page.commands.categories.templateOperations.items.create")}
|
|
108
108
|
</li>
|
|
109
109
|
<li>
|
|
110
|
-
<Text strong>nsgm delete</Text> - {t(
|
|
110
|
+
<Text strong>nsgm delete</Text> - {t("home:page.commands.categories.templateOperations.items.delete")}
|
|
111
111
|
</li>
|
|
112
112
|
<li>
|
|
113
|
-
<Text strong>nsgm deletedb</Text> -{
|
|
114
|
-
{t(
|
|
113
|
+
<Text strong>nsgm deletedb</Text> -{" "}
|
|
114
|
+
{t("home:page.commands.categories.templateOperations.items.deletedb")}
|
|
115
115
|
</li>
|
|
116
116
|
</ul>
|
|
117
117
|
</Card>
|
|
118
118
|
</Col>
|
|
119
119
|
<Col xs={24} md={8}>
|
|
120
120
|
<Card hoverable>
|
|
121
|
-
<Title level={4}>{t(
|
|
121
|
+
<Title level={4}>{t("home:page.commands.categories.runBuild.title")}</Title>
|
|
122
122
|
<ul>
|
|
123
123
|
<li>
|
|
124
|
-
<Text strong>nsgm dev</Text> - {t(
|
|
124
|
+
<Text strong>nsgm dev</Text> - {t("home:page.commands.categories.runBuild.items.dev")}
|
|
125
125
|
</li>
|
|
126
126
|
<li>
|
|
127
|
-
<Text strong>nsgm start</Text> - {t(
|
|
127
|
+
<Text strong>nsgm start</Text> - {t("home:page.commands.categories.runBuild.items.start")}
|
|
128
128
|
</li>
|
|
129
129
|
<li>
|
|
130
|
-
<Text strong>nsgm build</Text> - {t(
|
|
130
|
+
<Text strong>nsgm build</Text> - {t("home:page.commands.categories.runBuild.items.build")}
|
|
131
131
|
</li>
|
|
132
132
|
<li>
|
|
133
|
-
<Text strong>nsgm export</Text> - {t(
|
|
133
|
+
<Text strong>nsgm export</Text> - {t("home:page.commands.categories.runBuild.items.export")}
|
|
134
134
|
</li>
|
|
135
135
|
</ul>
|
|
136
136
|
</Card>
|
|
137
137
|
</Col>
|
|
138
138
|
</Row>
|
|
139
139
|
|
|
140
|
-
<Title level={2} style={{ marginTop:
|
|
141
|
-
{t(
|
|
140
|
+
<Title level={2} style={{ marginTop: "24px" }}>
|
|
141
|
+
{t("home:page.parameters.title")}
|
|
142
142
|
</Title>
|
|
143
143
|
<Divider />
|
|
144
144
|
<Card>
|
|
145
145
|
<ul>
|
|
146
146
|
<li>
|
|
147
|
-
<Text strong>dictionary:</Text> {t(
|
|
147
|
+
<Text strong>dictionary:</Text> {t("home:page.parameters.items.dictionary")}
|
|
148
148
|
</li>
|
|
149
149
|
<li>
|
|
150
|
-
<Text strong>controller:</Text> {t(
|
|
150
|
+
<Text strong>controller:</Text> {t("home:page.parameters.items.controller")}
|
|
151
151
|
</li>
|
|
152
152
|
<li>
|
|
153
|
-
<Text strong>action:</Text> {t(
|
|
153
|
+
<Text strong>action:</Text> {t("home:page.parameters.items.action")}
|
|
154
154
|
</li>
|
|
155
155
|
</ul>
|
|
156
156
|
</Card>
|
|
157
157
|
</Typography>
|
|
158
158
|
</Container>
|
|
159
|
-
)
|
|
160
|
-
}
|
|
159
|
+
);
|
|
160
|
+
};
|
|
161
161
|
|
|
162
162
|
export const getServerSideProps = async ({ locale }) => {
|
|
163
163
|
// 确保 locale 有默认值,避免 serverSideTranslations 报错
|
|
164
|
-
const currentLocale = locale ||
|
|
164
|
+
const currentLocale = locale || "zh-CN";
|
|
165
165
|
|
|
166
166
|
return {
|
|
167
167
|
props: {
|
|
168
|
-
...(await serverSideTranslations(currentLocale, [
|
|
168
|
+
...(await serverSideTranslations(currentLocale, ["common", "home", "layout"])),
|
|
169
169
|
},
|
|
170
|
-
}
|
|
171
|
-
}
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
172
|
|
|
173
|
-
Page.displayName =
|
|
173
|
+
Page.displayName = "HomePage";
|
|
174
174
|
|
|
175
|
-
export default Page
|
|
175
|
+
export default Page;
|
package/pages/login.tsx
CHANGED
|
@@ -1,105 +1,105 @@
|
|
|
1
|
-
import MarkdownIt from
|
|
2
|
-
import _ from
|
|
3
|
-
import { LoginContainer } from
|
|
1
|
+
import MarkdownIt from "markdown-it";
|
|
2
|
+
import _ from "lodash";
|
|
3
|
+
import { LoginContainer } from "../client/styled/common";
|
|
4
4
|
// import getConfig from 'next/config'
|
|
5
|
-
import React, { useState, useEffect } from
|
|
6
|
-
import { Input, Button, Form, Typography, message } from
|
|
7
|
-
import { UserOutlined, LockOutlined } from
|
|
8
|
-
import { directLogin } from
|
|
9
|
-
import { serverSideTranslations } from
|
|
10
|
-
import { useTranslation } from
|
|
11
|
-
import { useRouter } from
|
|
12
|
-
import LanguageSwitcher from
|
|
13
|
-
import { navigateToHome } from
|
|
5
|
+
import React, { useState, useEffect } from "react";
|
|
6
|
+
import { Input, Button, Form, Typography, message } from "antd";
|
|
7
|
+
import { UserOutlined, LockOutlined } from "@ant-design/icons";
|
|
8
|
+
import { directLogin } from "../client/utils/sso";
|
|
9
|
+
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
|
|
10
|
+
import { useTranslation } from "next-i18next";
|
|
11
|
+
import { useRouter } from "next/router";
|
|
12
|
+
import LanguageSwitcher from "@/components/LanguageSwitcher";
|
|
13
|
+
import { navigateToHome } from "@/utils/navigation";
|
|
14
14
|
|
|
15
15
|
const md = new MarkdownIt({
|
|
16
16
|
html: true,
|
|
17
17
|
linkify: true,
|
|
18
18
|
typographer: true,
|
|
19
|
-
})
|
|
19
|
+
});
|
|
20
20
|
|
|
21
21
|
// const nextConfig = getConfig()
|
|
22
22
|
// const { publicRuntimeConfig } = nextConfig
|
|
23
23
|
// const { env } = publicRuntimeConfig
|
|
24
24
|
|
|
25
|
-
const renderArr: any = []
|
|
25
|
+
const renderArr: any = [];
|
|
26
26
|
|
|
27
|
-
renderArr.push(
|
|
27
|
+
renderArr.push("NSGM");
|
|
28
28
|
|
|
29
29
|
const Page = ({ html }) => {
|
|
30
|
-
const { t } = useTranslation([
|
|
31
|
-
const router = useRouter()
|
|
32
|
-
const [userName, setUserName] = useState(
|
|
33
|
-
const [userPassword, setUserPassword] = useState(
|
|
34
|
-
const [mounted, setMounted] = useState(false)
|
|
30
|
+
const { t } = useTranslation(["login"]);
|
|
31
|
+
const router = useRouter();
|
|
32
|
+
const [userName, setUserName] = useState("");
|
|
33
|
+
const [userPassword, setUserPassword] = useState("");
|
|
34
|
+
const [mounted, setMounted] = useState(false);
|
|
35
35
|
|
|
36
36
|
useEffect(() => {
|
|
37
|
-
setMounted(true)
|
|
38
|
-
}, [])
|
|
37
|
+
setMounted(true);
|
|
38
|
+
}, []);
|
|
39
39
|
|
|
40
40
|
const createMarkup = () => {
|
|
41
41
|
return {
|
|
42
42
|
__html: html,
|
|
43
|
-
}
|
|
44
|
-
}
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
45
|
|
|
46
46
|
const doLogin = () => {
|
|
47
|
-
if (!mounted || typeof window ===
|
|
47
|
+
if (!mounted || typeof window === "undefined") return;
|
|
48
48
|
|
|
49
|
-
if (userName ===
|
|
50
|
-
message.error(t(
|
|
51
|
-
return
|
|
49
|
+
if (userName === "") {
|
|
50
|
+
message.error(t("login:login.errors.usernameRequired"));
|
|
51
|
+
return;
|
|
52
52
|
}
|
|
53
|
-
if (userPassword ===
|
|
54
|
-
message.error(t(
|
|
55
|
-
return
|
|
53
|
+
if (userPassword === "") {
|
|
54
|
+
message.error(t("login:login.errors.passwordRequired"));
|
|
55
|
+
return;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
const result = directLogin(userName, userPassword, (user) => {
|
|
59
59
|
if (user && mounted) {
|
|
60
60
|
// 跳转到首页,保持当前语言设置,强制添加语言前缀避免自动检测
|
|
61
|
-
navigateToHome(router, true)
|
|
61
|
+
navigateToHome(router, true);
|
|
62
62
|
}
|
|
63
|
-
})
|
|
63
|
+
});
|
|
64
64
|
|
|
65
65
|
// 检查是否是 Promise
|
|
66
|
-
if (result && typeof (result as any).then ===
|
|
67
|
-
|
|
66
|
+
if (result && typeof (result as any).then === "function") {
|
|
67
|
+
(result as Promise<any>).then((loginResult) => {
|
|
68
68
|
if (!loginResult.success) {
|
|
69
|
-
message.error(loginResult.message)
|
|
69
|
+
message.error(loginResult.message);
|
|
70
70
|
}
|
|
71
|
-
})
|
|
71
|
+
});
|
|
72
72
|
} else {
|
|
73
73
|
// 直接返回的结果
|
|
74
|
-
const syncResult = result as { success: boolean; message?: string }
|
|
74
|
+
const syncResult = result as { success: boolean; message?: string };
|
|
75
75
|
if (!syncResult.success) {
|
|
76
|
-
message.error(syncResult.message || t(
|
|
76
|
+
message.error(syncResult.message || t("login:login.errors.loginFailed"));
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
80
|
|
|
81
81
|
const doChangeName = (e) => {
|
|
82
|
-
setUserName(_.trim(e.target.value))
|
|
83
|
-
}
|
|
82
|
+
setUserName(_.trim(e.target.value));
|
|
83
|
+
};
|
|
84
84
|
|
|
85
85
|
const doChangePassword = (e) => {
|
|
86
|
-
setUserPassword(_.trim(e.target.value))
|
|
87
|
-
}
|
|
86
|
+
setUserPassword(_.trim(e.target.value));
|
|
87
|
+
};
|
|
88
88
|
|
|
89
89
|
return (
|
|
90
90
|
<LoginContainer>
|
|
91
|
-
<div style={{ position:
|
|
91
|
+
<div style={{ position: "absolute", top: "20px", right: "20px" }}>
|
|
92
92
|
<LanguageSwitcher />
|
|
93
93
|
</div>
|
|
94
94
|
<div dangerouslySetInnerHTML={createMarkup()} />
|
|
95
|
-
<Typography.Title level={3} style={{ textAlign:
|
|
96
|
-
{t(
|
|
95
|
+
<Typography.Title level={3} style={{ textAlign: "center", marginBottom: 24 }}>
|
|
96
|
+
{t("login:login.title")}
|
|
97
97
|
</Typography.Title>
|
|
98
|
-
<Form layout="vertical" style={{ width:
|
|
98
|
+
<Form layout="vertical" style={{ width: "100%" }}>
|
|
99
99
|
<Form.Item>
|
|
100
100
|
<Input
|
|
101
|
-
prefix={<UserOutlined style={{ color:
|
|
102
|
-
placeholder={t(
|
|
101
|
+
prefix={<UserOutlined style={{ color: "rgba(0,0,0,.25)" }} />}
|
|
102
|
+
placeholder={t("login:login.username")}
|
|
103
103
|
size="large"
|
|
104
104
|
value={userName}
|
|
105
105
|
onChange={doChangeName}
|
|
@@ -108,8 +108,8 @@ const Page = ({ html }) => {
|
|
|
108
108
|
</Form.Item>
|
|
109
109
|
<Form.Item>
|
|
110
110
|
<Input.Password
|
|
111
|
-
prefix={<LockOutlined style={{ color:
|
|
112
|
-
placeholder={t(
|
|
111
|
+
prefix={<LockOutlined style={{ color: "rgba(0,0,0,.25)" }} />}
|
|
112
|
+
placeholder={t("login:login.password")}
|
|
113
113
|
size="large"
|
|
114
114
|
value={userPassword}
|
|
115
115
|
onChange={doChangePassword}
|
|
@@ -118,32 +118,32 @@ const Page = ({ html }) => {
|
|
|
118
118
|
</Form.Item>
|
|
119
119
|
<Form.Item>
|
|
120
120
|
<Button type="primary" onClick={doLogin} size="large" block>
|
|
121
|
-
{t(
|
|
121
|
+
{t("login:login.loginButton")}
|
|
122
122
|
</Button>
|
|
123
123
|
</Form.Item>
|
|
124
124
|
</Form>
|
|
125
125
|
</LoginContainer>
|
|
126
|
-
)
|
|
127
|
-
}
|
|
126
|
+
);
|
|
127
|
+
};
|
|
128
128
|
|
|
129
129
|
export const getServerSideProps = async ({ locale }) => {
|
|
130
130
|
// 确保 locale 有默认值,避免 serverSideTranslations 报错
|
|
131
|
-
const currentLocale = locale ||
|
|
131
|
+
const currentLocale = locale || "zh-CN";
|
|
132
132
|
|
|
133
133
|
// 处理 markdown 内容
|
|
134
|
-
let html =
|
|
134
|
+
let html = "";
|
|
135
135
|
_.each(renderArr, (item) => {
|
|
136
|
-
html += md.render(item)
|
|
137
|
-
})
|
|
136
|
+
html += md.render(item);
|
|
137
|
+
});
|
|
138
138
|
|
|
139
139
|
return {
|
|
140
140
|
props: {
|
|
141
141
|
html,
|
|
142
|
-
...(await serverSideTranslations(currentLocale, [
|
|
142
|
+
...(await serverSideTranslations(currentLocale, ["common", "layout", "login"])),
|
|
143
143
|
},
|
|
144
|
-
}
|
|
145
|
-
}
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
146
|
|
|
147
|
-
Page.displayName =
|
|
147
|
+
Page.displayName = "LoginPage";
|
|
148
148
|
|
|
149
|
-
export default Page
|
|
149
|
+
export default Page;
|