Selaa lähdekoodia

Merge pull request #1369 from visuddhinanda/agile

:bug: 巴利文黑体有些没显示出来。
visuddhinanda 2 vuotta sitten
vanhempi
sitoutus
8dc0794b0f

+ 12 - 1
dashboard/src/components/template/Wbw/WbwPali.tsx

@@ -192,7 +192,18 @@ const WbwPaliWidget = ({ data, mode, display, onSave }: IWidget) => {
         <TagTwoTone twoToneColor={color} />
         <TagTwoTone twoToneColor={color} />
       </Popover>
       </Popover>
     ) : undefined;
     ) : undefined;
-  const classPali = data.style?.value === "note" ? "wbw_note" : "pali";
+  let classPali: string;
+  switch (data.style?.value) {
+    case "note":
+      classPali = "wbw_note";
+      break;
+    case "bld":
+      classPali = "wbw_bold";
+      break;
+    default:
+      classPali = "pali";
+      break;
+  }
   let padding: string;
   let padding: string;
   if (typeof data.real !== "undefined" && data.real.value !== "") {
   if (typeof data.real !== "undefined" && data.real.value !== "") {
     padding = "4px";
     padding = "4px";

+ 3 - 0
dashboard/src/components/template/Wbw/wbw.css

@@ -67,6 +67,9 @@
 .wbw_note {
 .wbw_note {
   color: #177ddc;
   color: #177ddc;
 }
 }
+.wbw_bold {
+  font-weight: 700;
+}
 .block_wbw .wbw_note {
 .block_wbw .wbw_note {
   font-weight: 500;
   font-weight: 500;
 }
 }

+ 63 - 22
dashboard/src/pages/library/download/Download.tsx

@@ -1,15 +1,30 @@
 import { Button, Card, Typography } from "antd";
 import { Button, Card, Typography } from "antd";
 
 
 import { useEffect, useState } from "react";
 import { useEffect, useState } from "react";
-import { Link } from "react-router-dom";
 import { GithubOutlined } from "@ant-design/icons";
 import { GithubOutlined } from "@ant-design/icons";
 
 
 import bg_png from "../../../assets/library/images/download_bg.png";
 import bg_png from "../../../assets/library/images/download_bg.png";
 import Marked from "../../../components/general/Marked";
 import Marked from "../../../components/general/Marked";
+import { get } from "../../../request";
+
 const { Paragraph } = Typography;
 const { Paragraph } = Typography;
 
 
+function serverLink(url: string): string {
+  return process.env.REACT_APP_API_HOST
+    ? process.env.REACT_APP_API_HOST + url
+    : window.location.origin + url;
+}
+interface IOfflineIndex {
+  filename: string;
+  url: string;
+  create_at: string;
+  chapter: number;
+  filesize: number;
+}
 const ChapterNewWidget = () => {
 const ChapterNewWidget = () => {
   const [github, setGithub] = useState<string>("loading");
   const [github, setGithub] = useState<string>("loading");
+  const [offlineIndex, setOfflineIndex] = useState<IOfflineIndex[]>();
+
   const githubLink =
   const githubLink =
     "https://raw.githubusercontent.com/ariyamaggika/wikipali-app/master/version.txt";
     "https://raw.githubusercontent.com/ariyamaggika/wikipali-app/master/version.txt";
   const giteeLink =
   const giteeLink =
@@ -35,36 +50,38 @@ const ChapterNewWidget = () => {
       .catch((err) => {
       .catch((err) => {
         console.log("请求错误", err);
         console.log("请求错误", err);
       });
       });
+
+    get<IOfflineIndex[]>("/v2/offline-index")
+      .then((json) => {
+        console.log("offline", json);
+        setOfflineIndex(json);
+        return json;
+      })
+      .catch((err) => {
+        console.log("请求错误", err);
+      });
   }, []);
   }, []);
   return (
   return (
     <Paragraph>
     <Paragraph>
       <div>
       <div>
         <img alt="code" src={bg_png} />
         <img alt="code" src={bg_png} />
       </div>
       </div>
-      <Card
-        title={"中国大陆"}
-        style={{ margin: 10, borderRadius: 8 }}
-        hoverable
-      >
+      <Card title={"App下载"} style={{ margin: 10, borderRadius: 8 }}>
         <Paragraph>
         <Paragraph>
-          <Link to={giteeRelease} target="_blank">
-            Gitee
-          </Link>
-        </Paragraph>
-      </Card>
-      <Card
-        title={"其他地区"}
-        style={{ margin: 10, borderRadius: 8 }}
-        hoverable
-      >
-        <Paragraph>
-          <Button icon={<GithubOutlined />} type="text">
-            <Link
-              to="https://github.com/gohugoio/hugo/releases"
+          {"点链接打开网站下载安卓App安装包"}
+          <Button type="link" size="large" icon={<GithubOutlined />}>
+            <a
+              href="https://github.com/gohugoio/hugo/releases"
               target="_blank"
               target="_blank"
+              rel="noreferrer"
             >
             >
-              Github
-            </Link>
+              Github下载
+            </a>
+          </Button>
+          <Button type="link" size="large">
+            <a href={giteeRelease} target="_blank" rel="noreferrer">
+              Gitee下载
+            </a>
           </Button>
           </Button>
         </Paragraph>
         </Paragraph>
 
 
@@ -72,6 +89,30 @@ const ChapterNewWidget = () => {
           <Marked text={github} />
           <Marked text={github} />
         </Paragraph>
         </Paragraph>
       </Card>
       </Card>
+      <Card title={"离线数据包"} style={{ margin: 10, borderRadius: 8 }}>
+        <Paragraph>
+          {"点链接下载离线数据包"}
+          {offlineIndex?.map((item, id) => {
+            return (
+              <ul key={id}>
+                <li>
+                  {"文件名:"}
+                  {item.filename}
+                </li>
+                <li>
+                  {"文件大小:"}
+                  {item.filesize}
+                </li>
+                <li>
+                  <Button type="primary">
+                    <a href={item.url}>下载</a>
+                  </Button>
+                </li>
+              </ul>
+            );
+          })}
+        </Paragraph>
+      </Card>
     </Paragraph>
     </Paragraph>
   );
   );
 };
 };