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

Merge pull request #2309 from visuddhinanda/development

Development
visuddhinanda 9 месяцев назад
Родитель
Сommit
5008ac8d6c

+ 3 - 39
dashboard-v4/dashboard/src/components/ai/AiModelList.tsx

@@ -1,12 +1,11 @@
 import { Link } from "react-router-dom";
 import { useIntl } from "react-intl";
-import { Button, Popover, Modal, message, Tag, Space } from "antd";
+import { Button, Popover, Tag, Space } from "antd";
 import { ActionType, ProList } from "@ant-design/pro-components";
-import { PlusOutlined, ExclamationCircleOutlined } from "@ant-design/icons";
+import { PlusOutlined } from "@ant-design/icons";
 
-import { delete_, get } from "../../request";
+import { get } from "../../request";
 
-import { IDeleteResponse } from "../../components/api/Article";
 import { useRef, useState } from "react";
 
 import { getSorterUrl } from "../../utils";
@@ -25,41 +24,6 @@ const AiModelList = ({ studioName }: IWidget) => {
 
   const [openCreate, setOpenCreate] = useState(false);
 
-  const showDeleteConfirm = (id: string, title: string) => {
-    Modal.confirm({
-      icon: <ExclamationCircleOutlined />,
-      title:
-        intl.formatMessage({
-          id: "message.delete.confirm",
-        }) +
-        intl.formatMessage({
-          id: "message.irrevocable",
-        }),
-
-      content: title,
-      okText: intl.formatMessage({
-        id: "buttons.delete",
-      }),
-      okType: "danger",
-      cancelText: intl.formatMessage({
-        id: "buttons.no",
-      }),
-      onOk() {
-        console.log("delete", id);
-        return delete_<IDeleteResponse>(`/v2/group/${id}`)
-          .then((json) => {
-            if (json.ok) {
-              message.success("删除成功");
-              ref.current?.reload();
-            } else {
-              message.error(json.message);
-            }
-          })
-          .catch((e) => console.log("Oops errors!", e));
-      },
-    });
-  };
-
   const ref = useRef<ActionType>();
 
   return (

+ 14 - 14
dashboard-v4/dashboard/src/components/article/TypePali.tsx

@@ -25,8 +25,6 @@ import { TaskBuilderChapterModal } from "../task/TaskBuilderChapter";
 import { useAppSelector } from "../../hooks";
 import { currentUser } from "../../reducers/current-user";
 import { ArticleTplModal } from "../template/Builder/ArticleTpl";
-import { IPayload, ITokenCreate, ITokenCreateResponse } from "../api/token";
-import TokenModal from "./TokenModal";
 
 interface IWidget {
   type?: ArticleType;
@@ -76,6 +74,7 @@ const TypePaliWidget = ({
 
   const srcDataMode = mode === "edit" || mode === "wbw" ? "edit" : "read";
 
+  console.debug("articleId", articleId);
   useEffect(() => {
     const parts = focus?.split("-");
     if (parts?.length === 2) {
@@ -222,20 +221,21 @@ const TypePaliWidget = ({
       title = id ? (id.length > 1 ? id[1] : "unknown") : "unknown";
     }
   }
-  let mBook = "",
-    mPara = "";
+
+  let mBook = "0",
+    mPara = "0";
+  if (typeof articleId === "string") {
+    [mBook, mPara] = articleId.split("-");
+  }
   let fullPath: ITocPathNode[] = [];
   if (articleData && articleData.path && articleData.path.length > 0) {
-    if (typeof articleId === "string") {
-      [mBook, mPara] = articleId.split("-");
-      const currNode: ITocPathNode = {
-        book: parseInt(mBook),
-        paragraph: parseInt(mPara),
-        title: title ?? "",
-        level: articleData.path[articleData.path.length - 1].level + 1,
-      };
-      fullPath = [...articleData.path, currNode];
-    }
+    const currNode: ITocPathNode = {
+      book: parseInt(mBook),
+      paragraph: parseInt(mPara),
+      title: title ?? "",
+      level: articleData.path[articleData.path.length - 1].level + 1,
+    };
+    fullPath = [...articleData.path, currNode];
   }
 
   return (