Przeglądaj źródła

段落标题用数字

visuddhinanda 2 lat temu
rodzic
commit
7970530260
1 zmienionych plików z 13 dodań i 5 usunięć
  1. 13 5
      dashboard/src/components/article/TypePali.tsx

+ 13 - 5
dashboard/src/components/article/TypePali.tsx

@@ -103,10 +103,10 @@ const TypePaliWidget = ({
     }
 
     setLoading(true);
-    console.log("url", url);
+    console.info("TypePali api request", url);
     get<IArticleResponse>(url)
       .then((json) => {
-        console.log("article", json);
+        console.debug("TypePali api response ", json);
         if (json.ok) {
           setArticleData(json.data);
           if (json.data.html) {
@@ -198,9 +198,17 @@ const TypePaliWidget = ({
     return;
   };
 
-  const title = articleData?.title_text
-    ? articleData?.title_text
-    : articleData?.title;
+  let title = "";
+  if (articleData) {
+    if (type === "chapter") {
+      title = articleData.title_text
+        ? articleData.title_text
+        : articleData.title;
+    } else {
+      const id = articleId?.split("-");
+      title = id ? (id.length > 1 ? id[1] : "unknown") : "unknown";
+    }
+  }
 
   let fullPath: ITocPathNode[] = [];
   if (articleData && articleData.path && articleData.path.length > 0) {