Просмотр исходного кода

Merge pull request #2047 from visuddhinanda/agile

基本版-》基础版
visuddhinanda 2 лет назад
Родитель
Сommit
361a37abbb

+ 4 - 3
dashboard/src/components/anthology/AnthologyCreate.tsx

@@ -33,12 +33,13 @@ const AnthologyCreateWidget = ({ studio, onSuccess }: IWidget) => {
           return;
           return;
         }
         }
         values.studio = studio;
         values.studio = studio;
-        console.log(values);
+        const url = `/v2/anthology`;
+        console.info("api request", url, values);
         const res = await post<IAnthologyCreateRequest, IAnthologyResponse>(
         const res = await post<IAnthologyCreateRequest, IAnthologyResponse>(
-          `/v2/anthology`,
+          url,
           values
           values
         );
         );
-        console.log(res);
+        console.debug("api response", res);
         if (res.ok) {
         if (res.ok) {
           message.success(intl.formatMessage({ id: "flashes.success" }));
           message.success(intl.formatMessage({ id: "flashes.success" }));
           if (typeof onSuccess !== "undefined") {
           if (typeof onSuccess !== "undefined") {

+ 3 - 3
dashboard/src/components/anthology/AnthologyList.tsx

@@ -353,7 +353,7 @@ const AnthologyListWidget = ({
                 key: "my",
                 key: "my",
                 label: (
                 label: (
                   <span>
                   <span>
-                    此工作室的
+                    {intl.formatMessage({ id: "labels.this-studio" })}
                     {renderBadge(myNumber, activeKey === "my")}
                     {renderBadge(myNumber, activeKey === "my")}
                   </span>
                   </span>
                 ),
                 ),
@@ -362,7 +362,7 @@ const AnthologyListWidget = ({
                 key: "collaboration",
                 key: "collaboration",
                 label: (
                 label: (
                   <span>
                   <span>
-                    协作
+                    {intl.formatMessage({ id: "labels.collaboration" })}
                     {renderBadge(
                     {renderBadge(
                       collaborationNumber,
                       collaborationNumber,
                       activeKey === "collaboration"
                       activeKey === "collaboration"
@@ -383,7 +383,7 @@ const AnthologyListWidget = ({
       <Modal
       <Modal
         destroyOnClose={true}
         destroyOnClose={true}
         width={700}
         width={700}
-        title="协作"
+        title={intl.formatMessage({ id: "labels.collaboration" })}
         open={isModalOpen}
         open={isModalOpen}
         onOk={handleOk}
         onOk={handleOk}
         onCancel={handleCancel}
         onCancel={handleCancel}

+ 7 - 1
dashboard/src/components/article/AnthologyDetail.tsx

@@ -11,6 +11,7 @@ import StudioName from "../auth/Studio";
 import TimeShow from "../general/TimeShow";
 import TimeShow from "../general/TimeShow";
 import Marked from "../general/Marked";
 import Marked from "../general/Marked";
 import AnthologyTocTree from "../anthology/AnthologyTocTree";
 import AnthologyTocTree from "../anthology/AnthologyTocTree";
+import { useIntl } from "react-intl";
 
 
 const { Title, Text, Paragraph } = Typography;
 const { Title, Text, Paragraph } = Typography;
 
 
@@ -36,6 +37,7 @@ const AnthologyDetailWidget = ({
   onError,
   onError,
 }: IWidgetAnthologyDetail) => {
 }: IWidgetAnthologyDetail) => {
   const [tableData, setTableData] = useState<IAnthologyData>();
   const [tableData, setTableData] = useState<IAnthologyData>();
+  const intl = useIntl();
 
 
   useEffect(() => {
   useEffect(() => {
     fetchData(aid);
     fetchData(aid);
@@ -100,7 +102,11 @@ const AnthologyDetailWidget = ({
       <Paragraph>
       <Paragraph>
         <Marked text={tableData?.summary} />
         <Marked text={tableData?.summary} />
       </Paragraph>
       </Paragraph>
-      <Title level={5}>目录</Title>
+      <Title level={5}>
+        {intl.formatMessage({
+          id: "labels.table-of-content",
+        })}
+      </Title>
       <AnthologyTocTree
       <AnthologyTocTree
         anthologyId={aid}
         anthologyId={aid}
         channels={channels}
         channels={channels}

+ 5 - 1
dashboard/src/components/article/ArticleCardMainMenu.tsx

@@ -4,12 +4,14 @@ import { MenuOutlined, PushpinOutlined } from "@ant-design/icons";
 import PaliTextToc from "./PaliTextToc";
 import PaliTextToc from "./PaliTextToc";
 import Find from "./Find";
 import Find from "./Find";
 import Nav from "./Nav";
 import Nav from "./Nav";
+import { useIntl } from "react-intl";
 
 
 interface IWidget {
 interface IWidget {
   type?: string;
   type?: string;
   articleId?: string;
   articleId?: string;
 }
 }
 const ArticleCardMainMenuWidget = ({ type, articleId }: IWidget) => {
 const ArticleCardMainMenuWidget = ({ type, articleId }: IWidget) => {
+  const intl = useIntl();
   const id = articleId?.split("_");
   const id = articleId?.split("_");
   let tocWidget = <></>;
   let tocWidget = <></>;
   if (id && id.length > 0) {
   if (id && id.length > 0) {
@@ -34,7 +36,9 @@ const ArticleCardMainMenuWidget = ({ type, articleId }: IWidget) => {
       }}
       }}
       items={[
       items={[
         {
         {
-          label: `目录`,
+          label: intl.formatMessage({
+            id: "labels.table-of-content",
+          }),
           key: "1",
           key: "1",
           children: <div style={styleTabBody}>{tocWidget}</div>,
           children: <div style={styleTabBody}>{tocWidget}</div>,
         },
         },

+ 3 - 3
dashboard/src/components/article/ArticleList.tsx

@@ -507,7 +507,7 @@ const ArticleListWidget = ({
                 key: "my",
                 key: "my",
                 label: (
                 label: (
                   <span>
                   <span>
-                    此工作室的
+                    {intl.formatMessage({ id: "labels.this-studio" })}
                     {renderBadge(myNumber, activeKey === "my")}
                     {renderBadge(myNumber, activeKey === "my")}
                   </span>
                   </span>
                 ),
                 ),
@@ -516,7 +516,7 @@ const ArticleListWidget = ({
                 key: "collaboration",
                 key: "collaboration",
                 label: (
                 label: (
                   <span>
                   <span>
-                    协作
+                    {intl.formatMessage({ id: "labels.collaboration" })}
                     {renderBadge(
                     {renderBadge(
                       collaborationNumber,
                       collaborationNumber,
                       activeKey === "collaboration"
                       activeKey === "collaboration"
@@ -538,7 +538,7 @@ const ArticleListWidget = ({
       <Modal
       <Modal
         destroyOnClose={true}
         destroyOnClose={true}
         width={700}
         width={700}
-        title="协作"
+        title={intl.formatMessage({ id: "labels.collaboration" })}
         open={isModalOpen}
         open={isModalOpen}
         onOk={handleOk}
         onOk={handleOk}
         onCancel={handleCancel}
         onCancel={handleCancel}

+ 9 - 1
dashboard/src/components/article/ToolButtonToc.tsx

@@ -6,6 +6,7 @@ import { ArticleType } from "./Article";
 import PaliTextToc from "./PaliTextToc";
 import PaliTextToc from "./PaliTextToc";
 import ToolButton from "./ToolButton";
 import ToolButton from "./ToolButton";
 import TextBookToc from "../anthology/TextBookToc";
 import TextBookToc from "../anthology/TextBookToc";
+import { useIntl } from "react-intl";
 
 
 interface IWidget {
 interface IWidget {
   type?: ArticleType;
   type?: ArticleType;
@@ -23,6 +24,7 @@ const ToolButtonTocWidget = ({
   channels,
   channels,
   onSelect,
   onSelect,
 }: IWidget) => {
 }: IWidget) => {
+  const intl = useIntl();
   //TODO 都放return里面
   //TODO 都放return里面
   let tocWidget = <></>;
   let tocWidget = <></>;
   if (type === "chapter" || type === "para") {
   if (type === "chapter" || type === "para") {
@@ -72,7 +74,13 @@ const ToolButtonTocWidget = ({
   }
   }
 
 
   return (
   return (
-    <ToolButton title="目录" icon={<MenuOutlined />} content={tocWidget} />
+    <ToolButton
+      title={intl.formatMessage({
+        id: "labels.table-of-content",
+      })}
+      icon={<MenuOutlined />}
+      content={tocWidget}
+    />
   );
   );
 };
 };
 
 

+ 2 - 2
dashboard/src/components/channel/ChannelTable.tsx

@@ -513,7 +513,7 @@ const ChannelTableWidget = ({
                 key: "my",
                 key: "my",
                 label: (
                 label: (
                   <span>
                   <span>
-                    此工作室的
+                    {intl.formatMessage({ id: "labels.this-studio" })}
                     {renderBadge(myNumber, activeKey === "my")}
                     {renderBadge(myNumber, activeKey === "my")}
                   </span>
                   </span>
                 ),
                 ),
@@ -522,7 +522,7 @@ const ChannelTableWidget = ({
                 key: "collaboration",
                 key: "collaboration",
                 label: (
                 label: (
                   <span>
                   <span>
-                    协作
+                    {intl.formatMessage({ id: "labels.collaboration" })}
                     {renderBadge(
                     {renderBadge(
                       collaborationNumber,
                       collaborationNumber,
                       activeKey === "collaboration"
                       activeKey === "collaboration"

+ 3 - 1
dashboard/src/components/share/ShareModal.tsx

@@ -1,6 +1,7 @@
 import { useState } from "react";
 import { useState } from "react";
 import { Modal } from "antd";
 import { Modal } from "antd";
 import Share, { EResType } from "./Share";
 import Share, { EResType } from "./Share";
+import { useIntl } from "react-intl";
 
 
 interface IWidget {
 interface IWidget {
   resId: string;
   resId: string;
@@ -9,6 +10,7 @@ interface IWidget {
 }
 }
 const ShareModalWidget = ({ resId, resType, trigger }: IWidget) => {
 const ShareModalWidget = ({ resId, resType, trigger }: IWidget) => {
   const [isModalOpen, setIsModalOpen] = useState(false);
   const [isModalOpen, setIsModalOpen] = useState(false);
+  const intl = useIntl();
   const showModal = () => {
   const showModal = () => {
     setIsModalOpen(true);
     setIsModalOpen(true);
   };
   };
@@ -27,7 +29,7 @@ const ShareModalWidget = ({ resId, resType, trigger }: IWidget) => {
       <Modal
       <Modal
         destroyOnClose={true}
         destroyOnClose={true}
         width={700}
         width={700}
-        title="协作"
+        title={intl.formatMessage({ id: "labels.collaboration" })}
         open={isModalOpen}
         open={isModalOpen}
         onOk={handleOk}
         onOk={handleOk}
         onCancel={handleCancel}
         onCancel={handleCancel}

+ 1 - 1
dashboard/src/components/studio/LeftSider.tsx

@@ -165,7 +165,7 @@ const LeftSiderWidget = ({ selectedKeys = "" }: IWidgetHeadBar) => {
       ],
       ],
     },
     },
     {
     {
-      label: "协作",
+      label: intl.formatMessage({ id: "labels.collaboration" }),
       key: "collaboration",
       key: "collaboration",
       icon: <TeamOutlined />,
       icon: <TeamOutlined />,
       children: [
       children: [

+ 9 - 7
dashboard/src/components/transfer/TransferList.tsx

@@ -59,8 +59,8 @@ const TransferListWidget = ({ studioName }: IWidget) => {
     const data: ITransferRequest = {
     const data: ITransferRequest = {
       status: status,
       status: status,
     };
     };
-    put<ITransferRequest, ITransferResponse>(`/v2/transfer/${id}`, data).then(
-      (json) => {
+    put<ITransferRequest, ITransferResponse>(`/v2/transfer/${id}`, data)
+      .then((json) => {
         if (json.ok) {
         if (json.ok) {
           ref.current?.reload();
           ref.current?.reload();
           openNotification(
           openNotification(
@@ -69,8 +69,10 @@ const TransferListWidget = ({ studioName }: IWidget) => {
         } else {
         } else {
           message.error(json.message);
           message.error(json.message);
         }
         }
-      }
-    );
+      })
+      .catch((e) => {
+        console.error(e);
+      });
   };
   };
   return (
   return (
     <>
     <>
@@ -106,9 +108,9 @@ const TransferListWidget = ({ studioName }: IWidget) => {
             render(dom, entity, index, action, schema) {
             render(dom, entity, index, action, schema) {
               return (
               return (
                 <Space>
                 <Space>
-                  <UserName {...entity.transferor} />
-                  {"transfer at"}
-                  <TimeShow createdAt={entity.created_at} />
+                  <UserName key={"user"} {...entity.transferor} />
+                  <span key="text">{"transfer at"}</span>
+                  <TimeShow key={"time"} createdAt={entity.created_at} />
                 </Space>
                 </Space>
               );
               );
             },
             },

+ 3 - 3
dashboard/src/components/users/SignUp.tsx

@@ -60,7 +60,7 @@ const SingUpWidget = () => {
         name="welcome"
         name="welcome"
         title="注册"
         title="注册"
         stepProps={{
         stepProps={{
-          description: "注册wikipali教育版",
+          description: "注册wikipali基础版",
         }}
         }}
         onFinish={async () => {
         onFinish={async () => {
           return true;
           return true;
@@ -128,10 +128,10 @@ const SingUpWidget = () => {
         <ProFormCheckbox.Group
         <ProFormCheckbox.Group
           name="checkbox"
           name="checkbox"
           layout="horizontal"
           layout="horizontal"
-          options={["我已经了解教育版的功能限制"]}
+          options={["我已经了解基础版的功能限制"]}
           fieldProps={{
           fieldProps={{
             onChange(checkedValue) {
             onChange(checkedValue) {
-              if (checkedValue.includes("我已经了解教育版的功能限制")) {
+              if (checkedValue.length > 0) {
                 setAgree(true);
                 setAgree(true);
               } else {
               } else {
                 setAgree(false);
                 setAgree(false);

+ 3 - 0
dashboard/src/locales/en-US/label.ts

@@ -7,6 +7,7 @@ const items = {
   "labels.week.5": "Fri",
   "labels.week.5": "Fri",
   "labels.week.6": "Sat",
   "labels.week.6": "Sat",
   "labels.collaborators": "collaborators",
   "labels.collaborators": "collaborators",
+  "labels.collaboration": "collaboration",
   "labels.link": "link",
   "labels.link": "link",
   "labels.upload": "upload",
   "labels.upload": "upload",
   "labels.first-term": "first term",
   "labels.first-term": "first term",
@@ -38,6 +39,8 @@ const items = {
   "labels.curr.paragraph.cart.tpl": "Add to Cart",
   "labels.curr.paragraph.cart.tpl": "Add to Cart",
   "labels.software.edition.basic": "basic",
   "labels.software.edition.basic": "basic",
   "labels.software.edition.pro": "pro",
   "labels.software.edition.pro": "pro",
+  "labels.table-of-content": "table of content",
+  "labels.this-studio": "this studio",
 };
 };
 
 
 export default items;
 export default items;

+ 4 - 1
dashboard/src/locales/zh-Hans/label.ts

@@ -7,6 +7,7 @@ const items = {
   "labels.week.5": "星期五",
   "labels.week.5": "星期五",
   "labels.week.6": "星期六",
   "labels.week.6": "星期六",
   "labels.collaborators": "协作者",
   "labels.collaborators": "协作者",
+  "labels.collaboration": "协作",
   "labels.link": "链接",
   "labels.link": "链接",
   "labels.upload": "上传",
   "labels.upload": "上传",
   "labels.first-term": "第一个术语",
   "labels.first-term": "第一个术语",
@@ -41,8 +42,10 @@ const items = {
   "labels.dict.pass.2": "查词干",
   "labels.dict.pass.2": "查词干",
   "labels.dict.pass.3": "查衍生",
   "labels.dict.pass.3": "查衍生",
   "labels.dict.pass.4": "查二次衍生",
   "labels.dict.pass.4": "查二次衍生",
-  "labels.software.edition.basic": "基版",
+  "labels.software.edition.basic": "基版",
   "labels.software.edition.pro": "增强版",
   "labels.software.edition.pro": "增强版",
+  "labels.table-of-content": "目录",
+  "labels.this-studio": "此工作室",
 };
 };
 
 
 export default items;
 export default items;

+ 8 - 1
dashboard/src/pages/library/article/show.tsx

@@ -53,6 +53,7 @@ import ChannelAlert from "../../../components/channel/ChannelAlert";
 import PrPull from "../../../components/corpus/PrPull";
 import PrPull from "../../../components/corpus/PrPull";
 import NotificationIcon from "../../../components/notification/NotificationIcon";
 import NotificationIcon from "../../../components/notification/NotificationIcon";
 import SentCart from "../../../components/template/SentEdit/SentCart";
 import SentCart from "../../../components/template/SentEdit/SentCart";
+import { useIntl } from "react-intl";
 
 
 export const scrollToTop = () => {
 export const scrollToTop = () => {
   document.getElementById("article-root")?.scrollIntoView();
   document.getElementById("article-root")?.scrollIntoView();
@@ -84,6 +85,7 @@ const Widget = () => {
   const [recentModalOpen, setRecentModalOpen] = useState(false);
   const [recentModalOpen, setRecentModalOpen] = useState(false);
   const [loadedArticleData, setLoadedArticleData] =
   const [loadedArticleData, setLoadedArticleData] =
     useState<IArticleDataResponse>();
     useState<IArticleDataResponse>();
+  const intl = useIntl();
 
 
   const paraChange = useAppSelector(paraParam);
   const paraChange = useAppSelector(paraParam);
 
 
@@ -220,7 +222,12 @@ const Widget = () => {
                   setSearchParams(output);
                   setSearchParams(output);
                 }}
                 }}
               />
               />
-              <Tooltip title="文章目录" placement="bottomLeft">
+              <Tooltip
+                title={intl.formatMessage({
+                  id: "labels.table-of-content",
+                })}
+                placement="bottomLeft"
+              >
                 <Button
                 <Button
                   style={{ display: "block", color: "white" }}
                   style={{ display: "block", color: "white" }}
                   icon={<UnorderedListOutlined />}
                   icon={<UnorderedListOutlined />}

+ 3 - 1
dashboard/src/pages/studio/anthology/edit.tsx

@@ -61,7 +61,9 @@ const Widget = () => {
             },
             },
             {
             {
               key: "toc",
               key: "toc",
-              label: `目录`,
+              label: intl.formatMessage({
+                id: "labels.table-of-content",
+              }),
               children: (
               children: (
                 <EditableTocTree
                 <EditableTocTree
                   studioName={anthologyInfo?.studio.realName}
                   studioName={anthologyInfo?.studio.realName}

+ 2 - 2
dashboard/src/pages/studio/group/list.tsx

@@ -293,7 +293,7 @@ const Widget = () => {
                 key: "my",
                 key: "my",
                 label: (
                 label: (
                   <span>
                   <span>
-                    此工作室的
+                    {intl.formatMessage({ id: "labels.this-studio" })}
                     {renderBadge(myNumber, activeKey === "my")}
                     {renderBadge(myNumber, activeKey === "my")}
                   </span>
                   </span>
                 ),
                 ),
@@ -302,7 +302,7 @@ const Widget = () => {
                 key: "collaboration",
                 key: "collaboration",
                 label: (
                 label: (
                   <span>
                   <span>
-                    我加入的
+                    {intl.formatMessage({ id: "labels.collaboration" })}
                     {renderBadge(
                     {renderBadge(
                       collaborationNumber,
                       collaborationNumber,
                       activeKey === "collaboration"
                       activeKey === "collaboration"