فهرست منبع

用新的组件TermEdit 代替旧的

visuddhinanda 3 سال پیش
والد
کامیت
a59213fb98
3فایلهای تغییر یافته به همراه12 افزوده شده و 12 حذف شده
  1. 3 3
      dashboard/src/components/article/TermShell.tsx
  2. 5 7
      dashboard/src/components/template/Term.tsx
  3. 4 2
      dashboard/src/reducers/command.ts

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

@@ -3,10 +3,10 @@ import { useEffect, useState } from "react";
 import { useAppSelector } from "../../hooks";
 import { useAppSelector } from "../../hooks";
 import { message } from "../../reducers/command";
 import { message } from "../../reducers/command";
 
 
-import TermCreate, { IWidgetDictCreate } from "../term/TermCreate";
+import TermEdit, { ITerm } from "../term/TermEdit";
 
 
 const Widget = () => {
 const Widget = () => {
-  const [termProps, setTermProps] = useState<IWidgetDictCreate>();
+  const [termProps, setTermProps] = useState<ITerm>();
   //接收术语消息
   //接收术语消息
   const commandMsg = useAppSelector(message);
   const commandMsg = useAppSelector(message);
   useEffect(() => {
   useEffect(() => {
@@ -17,7 +17,7 @@ const Widget = () => {
   }, [commandMsg]);
   }, [commandMsg]);
   return (
   return (
     <div>
     <div>
-      <TermCreate type="inline" {...termProps} />
+      <TermEdit {...termProps} />
     </div>
     </div>
   );
   );
 };
 };

+ 5 - 7
dashboard/src/components/template/Term.tsx

@@ -3,9 +3,10 @@ import { Typography } from "antd";
 import { SearchOutlined } from "@ant-design/icons";
 import { SearchOutlined } from "@ant-design/icons";
 import { ProCard } from "@ant-design/pro-components";
 import { ProCard } from "@ant-design/pro-components";
 
 
-import TermCreate, { IWidgetDictCreate } from "../term/TermCreate";
 import { command } from "../../reducers/command";
 import { command } from "../../reducers/command";
 import store from "../../store";
 import store from "../../store";
+import TermModal from "../term/TermModal";
+import { ITerm } from "../term/TermEdit";
 
 
 const { Text, Link } = Typography;
 const { Text, Link } = Typography;
 
 
@@ -29,12 +30,9 @@ const TermCtl = ({ id, word, meaning, meaning2, channel }: IWidgetTermCtl) => {
   const editButton = (
   const editButton = (
     <Button
     <Button
       onClick={() => {
       onClick={() => {
-        const it: IWidgetDictCreate = {
-          studio: "string",
-          isCreate: true,
+        const it: ITerm = {
           word: word,
           word: word,
-          channel: channel,
-          type: "inline",
+          channelId: channel,
         };
         };
         store.dispatch(command({ prop: it, type: "term" }));
         store.dispatch(command({ prop: it, type: "term" }));
       }}
       }}
@@ -57,7 +55,7 @@ const TermCtl = ({ id, word, meaning, meaning2, channel }: IWidgetTermCtl) => {
           editButton,
           editButton,
         ]}
         ]}
       >
       >
-        <div>{id ? "" : <TermCreate isCreate={true} word={word} />}</div>
+        <div>{id ? "" : <TermModal trigger="新建" word={word} />}</div>
       </ProCard>
       </ProCard>
     </>
     </>
   );
   );

+ 4 - 2
dashboard/src/reducers/command.ts

@@ -3,12 +3,14 @@
  */
  */
 import { createSlice, PayloadAction } from "@reduxjs/toolkit";
 import { createSlice, PayloadAction } from "@reduxjs/toolkit";
 import { IWidgetDict } from "../components/dict/DictComponent";
 import { IWidgetDict } from "../components/dict/DictComponent";
-import { IWidgetDictCreate } from "../components/term/TermCreate";
+import { ITerm } from "../components/term/TermEdit";
 
 
 import type { RootState } from "../store";
 import type { RootState } from "../store";
 
 
+export interface ITermCommand {}
+
 export interface ICommand {
 export interface ICommand {
-  prop?: IWidgetDictCreate | IWidgetDict;
+  prop?: ITerm | IWidgetDict;
   type?: "term" | "dict";
   type?: "term" | "dict";
 }
 }
 interface IState {
 interface IState {