From 409af1ddaf559c51fc0dac77f40929d00e34b671 Mon Sep 17 00:00:00 2001 From: Bruce CHEN <805899926@qq.com> Date: Wed, 6 Mar 2024 13:22:00 +0800 Subject: [PATCH] # add link --- src/layout/Header.tsx | 10 ++++----- src/menu/index.tsx | 6 +++++ src/util/basic.ts | 4 ++++ src/view/cf-best/cdn/index.tsx | 40 +++++++++++++++++++++------------- 4 files changed, 40 insertions(+), 20 deletions(-) diff --git a/src/layout/Header.tsx b/src/layout/Header.tsx index bf57ecb..be63d40 100644 --- a/src/layout/Header.tsx +++ b/src/layout/Header.tsx @@ -1,8 +1,8 @@ import React from "react"; -import {Layout, Menu} from 'antd'; -import {Link} from "react-router-dom"; -import menus, {MenuModel} from "@/menu"; +import { Layout, Menu } from 'antd'; +import { Link } from "react-router-dom"; +import menus, { MenuModel } from "@/menu"; function recursiveMenu(menus: MenuModel[]) { @@ -26,7 +26,7 @@ function recursiveMenu(menus: MenuModel[]) { {t.icon} {t.name} - {t.path && } + {t.path && } ) }) @@ -45,7 +45,7 @@ export default class Header extends React.Component { alignItems: 'center', }} > - + {recursiveMenu(menus)} diff --git a/src/menu/index.tsx b/src/menu/index.tsx index 52e7e58..5edcb6f 100644 --- a/src/menu/index.tsx +++ b/src/menu/index.tsx @@ -5,6 +5,7 @@ export interface MenuModel { path?: string icon?: React.ReactNode children?: Array + redirect?: boolean } const menus: MenuModel[] = [ @@ -20,6 +21,11 @@ const menus: MenuModel[] = [ path: "cf-best/server" } ] + }, + { + name: "IT-Tools", + path: "https://it-tools.tech/", + redirect: true } ]; export default menus \ No newline at end of file diff --git a/src/util/basic.ts b/src/util/basic.ts index 7ca4f05..e8ab89a 100644 --- a/src/util/basic.ts +++ b/src/util/basic.ts @@ -10,6 +10,10 @@ interface URI { path: string } +export function validateForm(form: Promise, successCallback: (value: any) => void, errorCallback?: (err: any) => void) { + form.then(value => successCallback(value)).catch(err => errorCallback && errorCallback(err)) +} + export function matchUrl(url: string): URI { let ret: any = urlPattern.exec(url) console.log(ret) diff --git a/src/view/cf-best/cdn/index.tsx b/src/view/cf-best/cdn/index.tsx index 21d4e61..f61df1a 100644 --- a/src/view/cf-best/cdn/index.tsx +++ b/src/view/cf-best/cdn/index.tsx @@ -1,6 +1,6 @@ import React from "react"; import stub from "@/init" -import {Form, Table, TreeSelect} from "antd"; +import {Button, Form, Table, TreeSelect} from "antd"; const columns = [ { @@ -40,6 +40,9 @@ const columns = [ }, ]; +const locationOnChange = (value: any, label: any, extra: any) => { + console.log(extra) +} const CFBestCDN: React.FC = () => { const [data, setData] = stub.ref.react.useState({}) @@ -55,26 +58,33 @@ const CFBestCDN: React.FC = () => { setQuery(q) stub.api.post("cf-best/cdn/page", stub.ref.lodash.omit(q, "total")).then((t: any) => setData(t.data.data)) } - + const [filter] = stub.ref.antd.Form.useForm(); return (
- + + + + + +