Skip to content

Let's use AI to Earn!

feat: demo

Nevin78047ec66ecf
diff --git a/src/api/publish.ts b/src/api/publish.ts
index 59649a86..3fd1787c 100644
--- a/src/api/publish.ts
+++ b/src/api/publish.ts
@@ -7,10 +7,8 @@ export interface PublishParams {
desc: string;
accountId: number;
videoPath?: string;
- imagePath?: string;
timingTime?: string;
coverPath?: string;
- commonCoverPath?: string;
publishTime?: string;
status?: number;
}
@@ -25,7 +23,7 @@ export interface PublishListResponse {
}
// 获取发布列表
-export const getPublishListApi = (pageNo: number, pageSize: number) => {
+export const apiGetPublishList = (pageNo: number, pageSize: number) => {
return request<PublishListResponse>({
url: `/publish/list/${pageNo}/${pageSize}`,
method: "GET",
@@ -33,7 +31,7 @@ export const getPublishListApi = (pageNo: number, pageSize: number) => {
};
// 获取草稿箱列表
-export const getDraftsListApi = (pageNo: number, pageSize: number) => {
+export const apiGetDraftsList = (pageNo: number, pageSize: number) => {
return request<PublishListResponse>({
url: `/publish/drafts/list/${pageNo}/${pageSize}`,
method: "GET",
@@ -41,7 +39,7 @@ export const getDraftsListApi = (pageNo: number, pageSize: number) => {
};
// 创建发布
-export const createPublishApi = (data: PublishParams) => {
+export const apiCreatePublish = (data: PublishParams) => {
return request({
url: "/publish",
method: "POST",
diff --git a/src/app/[lng]/demo/demoPublish.tsx b/src/app/[lng]/demo/demoPublish.tsx
new file mode 100644
index 00000000..428b9382
--- /dev/null
+++ b/src/app/[lng]/demo/demoPublish.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { useTransClient } from "@/app/i18n/client";
+import { useAccountStore } from "@/store/account";
+import { useEffect, useState } from "react";
+import { apiInitBilibiliVideo, apiUploadBilibilivideo } from "@/api/bilibili";
+import { getAccountListApi } from "@/api/account";
+import { apiCreatePublish } from "@/api/publish";
+
+interface Account {
+ id: string;
+ type: string;
+ nickname: string;
+ avatar: string;
+}
+
+export const DemoPublish = () => {
+ const { t } = useTransClient("demo");
+ const [accounts, setAccounts] = useState<Account[]>([]);
+ const [uploadToken, setUploadToken] = useState<string>("");
+
+ useEffect(() => {
+ const fetchAccounts = async () => {
+ const result = await getAccountListApi();
+ console.log("accountList", result);
+ if (result?.code === 0 && result?.data) {
+ setAccounts(result.data);
+ }
+ };
+ fetchAccounts();
+ }, []);
+
+ const createPublish = async () => {
+ try {
+ // const res: any = await apiCreatePublish({
+ // name: "files.mp4",
+ // });
+ // if (res?.data?.data) {
+ // setUploadToken(res.data.data);
+ // console.log("获取上传token成功:", res.data.data);
+ // }
+ } catch (error) {
+ console.error("获取上传token失败:", error);
+ }
+ };
+
+ return (
+ <div>
+ <div>{t("demoText")}</div>
+ <div></div>
+ </div>
+ );
+};
diff --git a/src/app/[lng]/demo/page.tsx b/src/app/[lng]/demo/page.tsx
index 049a0822..dd86d3b3 100644
--- a/src/app/[lng]/demo/page.tsx
+++ b/src/app/[lng]/demo/page.tsx
@@ -3,6 +3,7 @@ import { PageParams } from "@/app/globals";
import * as React from "react";
import { getMetadata } from "@/utils/general";
import { DemoPageCore } from "@/app/[lng]/demo/demoPageCore";
+import { DemoPublish } from "@/app/[lng]/demo/demoPublish";
export async function generateMetadata({ params }: PageParams) {
const { lng } = await params;
@@ -23,6 +24,7 @@ export default async function Page({ params }: PageParams) {
<>
<div>{t("demoText")} 1</div>
<DemoPageCore />
+ <DemoPublish />
</>
);
}