diff --git a/app/layout.tsx b/app/layout.tsx index df7158c..f32386a 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -17,7 +17,7 @@ import { IconStar, IconSun, IconVideoListStroked, - IconHome, + IconHome, IconSetting, } from "@douyinfe/semi-icons"; export default function RootLayout({ @@ -139,12 +139,23 @@ export default function RootLayout({ ), }, - // { - // text: '任务平台', - // icon: , - // itemKey: 'Job', - // items: [{itemKey: 'About', text: '任务管理'}, {itemKey: 'Dashboard', text: '用户任务查询'}], - // }, + { + text: '任务平台', + icon:
+ +
, + itemKey: 'status', + // items: [{itemKey: 'About', text: '任务管理'}, {itemKey: 'Dashboard', text: '用户任务查询'}], + }, ].map((value: any) => { value.text = (
value.itemKey === key ) || (selectedKeys.some((key: string) => - openKeys.some((o: string | number) => - isSub(key, o) - ) + openKeys.some((o: string | number) => + isSub(key, o) + ) ) && openKeys.some( (key: any) => value.itemKey === key @@ -182,6 +193,7 @@ export default function RootLayout({ streamers: "/streamers", "upload-manager": "/upload-manager", job: "/job", + status: "/status", }; if (!routerMap[props.itemKey]) { return itemElement; diff --git a/app/lib/use-streamers.ts b/app/lib/use-streamers.ts index 097b516..45c02b5 100644 --- a/app/lib/use-streamers.ts +++ b/app/lib/use-streamers.ts @@ -28,7 +28,7 @@ export function useBiliUsers() { const updateList = async (item: User) => { try { const res = await fetcher(`/bili/space/myinfo?user=${item.value}`, undefined); - const pRes = await proxy(`/bili/proxy?url=${res.data.face}`); + const pRes = await proxy(`/bili/proxy?url=${res.data?.face}`); const myBlob = await pRes.blob(); return { diff --git a/app/status/page.tsx b/app/status/page.tsx new file mode 100644 index 0000000..4a3efb4 --- /dev/null +++ b/app/status/page.tsx @@ -0,0 +1,44 @@ +'use client' + +import { Layout, Nav, Spin, Typography } from "@douyinfe/semi-ui"; +import useSWR from "swr"; +import {fetcher} from "@/app/lib/api-streamer"; +import {IconCustomerSupport, IconSearch, IconSetting, IconVideoListStroked} from "@douyinfe/semi-icons"; +import {JSONTree} from "react-json-tree"; + +export default function Home() { + const {Header, Footer, Sider, Content} = Layout; + const {data: data, error, isLoading} = useSWR("/v1/status", fetcher); + + + if (isLoading) { + return (); + } + return (<> +
+ +
+ +
+ +
+
+ ); +} diff --git a/app/upload-manager/page.tsx b/app/upload-manager/page.tsx index 7c8bce0..0e91693 100644 --- a/app/upload-manager/page.tsx +++ b/app/upload-manager/page.tsx @@ -6,18 +6,18 @@ import { List, Nav, Popconfirm, - Notification, + Notification, Typography, Modal, Transfer, } from "@douyinfe/semi-ui"; import { IconCloudStroked, IconPlusCircle, IconUserListStroked } from "@douyinfe/semi-icons"; -import { useState } from "react"; +import { SetStateAction, useState} from "react"; import Link from "next/link"; -import { Card } from '@douyinfe/semi-ui'; -import { IconEdit2Stroked, IconSendStroked, IconDeleteStroked } from '@douyinfe/semi-icons'; -import {fetcher, requestDelete, StudioEntity} from "../lib/api-streamer"; +import {Card} from '@douyinfe/semi-ui'; +import {IconEdit2Stroked, IconSendStroked, IconDeleteStroked} from '@douyinfe/semi-icons'; +import {fetcher, FileList, requestDelete, sendRequest, StudioEntity} from "../lib/api-streamer"; import useSWR from "swr"; import {useRouter} from "next/navigation"; import UserList from "../ui/UserList"; @@ -25,12 +25,13 @@ import useSWRMutation from "swr/mutation"; import {useBiliUsers} from "../lib/use-streamers"; export default function Union() { - const { Meta } = Card; - const { Header, Content } = Layout; + const {Meta} = Card; + const {Paragraph, Title, Text} = Typography; + const {Header, Content} = Layout; const [visible, setVisible] = useState(false); const router = useRouter(); const {trigger: deleteUpload} = useSWRMutation('/v1/upload/streamers', requestDelete); - const { data: templates, error, isLoading } = useSWR("/v1/upload/streamers", fetcher); + const {data: templates, error, isLoading} = useSWR("/v1/upload/streamers", fetcher); const {biliUsers} = useBiliUsers(); const handleAddLinkClick = (event: React.MouseEvent) => { if (biliUsers.length === 0) { @@ -51,8 +52,57 @@ export default function Union() { const onConfirm = async (id: number) => { await deleteUpload(id); } + + + const [visibleModal, setVisibleModal] = useState(false); + const [selectFiles, setSelectFiles] = useState<(string | number)[]>([]); + const [selectEntity, setSelectEntity] = useState(); + const showDialog = (entity: StudioEntity) => { + setSelectEntity(entity); + setVisibleModal(true); + }; + const handleOk = async () => { + await sendRequest('/v1/uploads', { arg: { + files: selectFiles, + params: selectEntity + }}) + setVisibleModal(false); + }; + const handleCancel = () => { + setVisibleModal(false); + console.log('Cancel button clicked'); + }; + const handleAfterClose = () => { + console.log('After Close callback executed'); + }; + const { data: fileList} = useSWR("/v1/videos", fetcher); + const data = fileList?.map((v) => { + return { + label: v.name, + value: v.name, + disabled: false, + key: v.key, + }; + }); return (<> + =1.16.0 + onCancel={handleCancel} + closeOnEsc={true} + > + setSelectFiles(values)} + /> +