Skip to content

Let's use AI to Earn!

发布记录的接口

daoyian29b7e25a200d
diff --git a/src/api/apiReq.ts b/src/api/apiReq.ts
index 3928de78..363ffe81 100644
--- a/src/api/apiReq.ts
+++ b/src/api/apiReq.ts
@@ -25,45 +25,45 @@ export interface RegistCheckParams {
// 获取用户信息
export const getUserInfoApi = () => {
- return sxRequest.get<UserInfo>("user/mine");
+ return sxRequest.get<UserInfo>("/user/mine");
};
// 更新用户信息
export const updateUserInfoApi = (data: { name: string }) => {
- return sxRequest.put<UserInfo>("user/info/update", data);
+ return sxRequest.put<UserInfo>("/user/info/update", data);
};
export const getMoneyStampApi = () => {
- return sxRequest.get<any>("cfg/money/stamp");
+ return sxRequest.get<any>("/cfg/money/stamp");
};
export const fluxSchnellApi = (data: any) => {
- return sxRequest.post<any>("experience-ai/text2image/flux_schnell", data);
+ return sxRequest.post<any>("/experience-ai/text2image/flux_schnell", data);
};
// 邮箱登录接口
export const loginWithMailApi = (data: { mail: string; password: string }) => {
- return sxRequest.post<LoginResponse>("user/login/mail", data);
+ return sxRequest.post<LoginResponse>("/user/login/mail", data);
};
// 获取注册链接
export const getRegistUrlApi = (mail: string) => {
- return sxRequest.get<LoginResponse>(`user/login/mail/regist/url?mail=${mail}`);
+ return sxRequest.get<LoginResponse>(`/user/login/mail/regist/url?mail=${mail}`);
};
// 检查注册状态 post!!
export const checkRegistStatusApi = (data: RegistCheckParams) => {
- return sxRequest.post<LoginResponse>(`user/login/mail/regist/back`, data);
+ return sxRequest.post<LoginResponse>(`/user/login/mail/regist/back`, data);
};
// 发送重置密码邮件
export const sendResetPasswordMailApi = (data: { mail: string }) => {
- return sxRequest.post<LoginResponse>("user/login/repassword/mail", data);
+ return sxRequest.post<LoginResponse>("/user/login/repassword/mail", data);
};
// 重置密码
export const resetPasswordApi = (data: { code: string; mail: string; password: string }) => {
- return sxRequest.post<LoginResponse>("user/login/repassword/mail/back", data);
+ return sxRequest.post<LoginResponse>("/user/login/repassword/mail/back", data);
};
// 三方账户类型定义
@@ -92,22 +92,22 @@ export interface SocialAccount {
// 创建或更新账户
export const createOrUpdateAccountApi = (data: Omit<SocialAccount, 'id'>) => {
- return sxRequest.post<SocialAccount>("account/login", data);
+ return sxRequest.post<SocialAccount>("/account/login", data);
};
// 更新账户状态
export const updateAccountStatusApi = (data: { id: number; status: number }) => {
- return sxRequest.post<SocialAccount>("account/status", data);
+ return sxRequest.post<SocialAccount>("/account/status", data);
};
// 获取账户列表
export const getAccountListApi = () => {
- return sxRequest.get<SocialAccount[]>("account/list/all");
+ return sxRequest.get<SocialAccount[]>("/account/list/all");
};
// 获取账户详情
export const getAccountDetailApi = (id: number) => {
- return sxRequest.get<SocialAccount>(`account/${id}`);
+ return sxRequest.get<SocialAccount>(`/account/${id}`);
};
// 更新账户统计数据
@@ -123,12 +123,12 @@ export interface UpdateAccountStatisticsParams {
}
export const updateAccountStatisticsApi = (data: UpdateAccountStatisticsParams) => {
- return sxRequest.post<SocialAccount>("account/statistics/update", data);
+ return sxRequest.post<SocialAccount>("/account/statistics/update", data);
};
// 删除账户
export const deleteAccountApi = (id: number) => {
- return sxRequest.post<SocialAccount>(`account/delete/${id}`);
+ return sxRequest.post<SocialAccount>(`/account/delete/${id}`);
};
// Google 登录参数
@@ -139,5 +139,5 @@ export interface GoogleLoginParams {
// Google 登录
export const googleLoginApi = (data: GoogleLoginParams) => {
- return sxRequest.post<LoginResponse>("account/login/google", data);
+ return sxRequest.post<LoginResponse>("/account/login/google", data);
};
diff --git a/src/api/publish.ts b/src/api/publish.ts
new file mode 100644
index 00000000..0a6a948f
--- /dev/null
+++ b/src/api/publish.ts
@@ -0,0 +1,67 @@
+import { request } from '@/utils/request';
+import { PubType, PublishType, PubStatus } from '@/types/publish';
+
+export interface PublishParams {
+ type: PublishType;
+ title: string;
+ desc: string;
+ accountId: number;
+ videoPath?: string;
+ imagePath?: string;
+ timingTime?: string;
+ coverPath?: string;
+ commonCoverPath?: string;
+ publishTime?: string;
+ status?: number;
+}
+
+export interface PublishListResponse {
+ code: number;
+ data: {
+ list: any[];
+ total: number;
+ };
+ msg: string;
+}
+
+// 获取发布列表
+export const getPublishListApi = (pageNo: number, pageSize: number) => {
+ return request<PublishListResponse>({
+ url: `/publish/list/${pageNo}/${pageSize}`,
+ method: 'GET'
+ });
+};
+
+// 获取草稿箱列表
+export const getDraftsListApi = (pageNo: number, pageSize: number) => {
+ return request<PublishListResponse>({
+ url: `/publish/drafts/list/${pageNo}/${pageSize}`,
+ method: 'GET'
+ });
+};
+
+// 创建发布
+export const createPublishApi = (data: PublishParams) => {
+ return request({
+ url: '/publish',
+ method: 'POST',
+ data
+ });
+};
+
+// 更新发布状态
+export const updatePublishStatusApi = (id: number, status: number) => {
+ return request({
+ url: `/publish/status/${id}`,
+ method: 'POST',
+ data: { status }
+ });
+};
+
+// 删除发布
+export const deletePublishApi = (id: number) => {
+ return request({
+ url: `/publish/${id}`,
+ method: 'DELETE'
+ });
+};
\ No newline at end of file
diff --git a/src/app/[lng]/accounts/page.tsx b/src/app/[lng]/accounts/page.tsx
index cfd4ea76..cd9a72b3 100644
--- a/src/app/[lng]/accounts/page.tsx
+++ b/src/app/[lng]/accounts/page.tsx
@@ -4,6 +4,7 @@ import { useEffect, useState } from "react";
import { Card, Table, Button, message, Modal, Form, Input, Select, InputNumber, Space, Tag, Descriptions } from "antd";
import { useRouter } from "next/navigation";
import { useUserStore } from "@/store/user";
+import { useAccountStore } from "@/store/account";
import {
SocialAccount,
createOrUpdateAccountApi,
@@ -29,34 +30,12 @@ const PLATFORM_TYPES = [
export default function AccountsPage() {
const router = useRouter();
const { token } = useUserStore();
- const [loading, setLoading] = useState(true);
- const [accounts, setAccounts] = useState<SocialAccount[]>([]);
+ const { accounts, loading, fetchAccounts } = useAccountStore();
const [isModalOpen, setIsModalOpen] = useState(false);
const [isDetailModalOpen, setIsDetailModalOpen] = useState(false);
const [currentAccount, setCurrentAccount] = useState<SocialAccount | null>(null);
const [form] = Form.useForm();
- // 获取账户列表
- const fetchAccounts = async () => {
- try {
- const response: any = await getAccountListApi();
- if (!response) {
- message.error('获取账户列表失败');
- return;
- }
-
- if (response.code === 0 && response.data) {
- setAccounts(response.data);
- } else {
- message.error(response.msg || '获取账户列表失败');
- }
- } catch (error) {
- message.error('获取账户列表失败');
- } finally {
- setLoading(false);
- }
- };
-
useEffect(() => {
if (!token) {
message.error('请先登录');
@@ -64,7 +43,7 @@ export default function AccountsPage() {
return;
}
fetchAccounts();
- }, [token, router]);
+ }, [token, router, fetchAccounts]);
// 处理账户状态更新
const handleStatusChange = async (id: number, status: number) => {
diff --git a/src/app/[lng]/publish/components/CreatePublish.tsx b/src/app/[lng]/publish/components/CreatePublish.tsx
new file mode 100644
index 00000000..7955b523
--- /dev/null
+++ b/src/app/[lng]/publish/components/CreatePublish.tsx
@@ -0,0 +1,197 @@
+"use client";
+
+import { useState, useEffect } from 'react';
+import { Modal, Form, Input, Button, message, DatePicker, Select } from 'antd';
+import { createPublishApi } from '@/api/publish';
+import type { PublishParams } from '@/api/publish';
+import { useAccountStore } from '@/store/account';
+import { PubType, PublishType, PubStatus } from '@/types/publish';
+import dayjs from 'dayjs';
+
+const { Option } = Select;
+
+interface CreatePublishProps {
+ visible: boolean;
+ type: PublishType;
+ onClose: () => void;
+}
+
+export default function CreatePublish({ visible, type, onClose }: CreatePublishProps) {
+ const [form] = Form.useForm();
+ const [loading, setLoading] = useState(false);
+ const { accounts, fetchAccounts } = useAccountStore();
+
+ useEffect(() => {
+ if (visible) {
+ fetchAccounts();
+ }
+ }, [visible, fetchAccounts]);
+
+ const handleSubmit = async (values: any) => {
+ try {
+ setLoading(true);
+ const params: PublishParams = {
+ type,
+ title: values.title,
+ desc: values.desc,
+ accountId: values.accountId,
+ videoPath: values.videoPath,
+ timingTime: values.timingTime ? dayjs(values.timingTime).toISOString() : undefined,
+ coverPath: values.coverPath,
+ commonCoverPath: values.commonCoverPath,
+ publishTime: values.publishTime ? dayjs(values.publishTime).toISOString() : undefined,
+ status: values.status || PubStatus.UNPUBLISH,
+ };
+
+ const response = await createPublishApi(params);
+ if (response?.code === 0) {
+ message.success('创建成功');
+ onClose();
+ form.resetFields();
+ } else {
+ message.error(response?.msg || '创建失败');
+ }
+ } catch (error) {
+ message.error('创建失败');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ const getTitle = () => {
+ switch (type) {
+ case PubType.VIDEO:
+ return '视频';
+ case PubType.ARTICLE:
+ return '文章';
+ case PubType.IMAGE_TEXT:
+ return '图文';
+ default:
+ return '';
+ }
+ };
+
+ return (
+ <Modal
+ title={`创建${getTitle()}发布`}
+ open={visible}
+ onCancel={onClose}
+ footer={null}
+ width={600}
+ >
+ <Form
+ form={form}
+ layout="vertical"
+ onFinish={handleSubmit}
+ >
+ <Form.Item
+ name="accountId"
+ label="选择账户"
+ rules={[{ required: true, message: '请选择账户' }]}
+ >
+ <Select placeholder="请选择账户">
+ {accounts.map(account => (
+ <Option key={account.id} value={account.id}>
+ {account.nickname} ({account.type})
+ </Option>
+ ))}
+ </Select>
+ </Form.Item>
+
+ <Form.Item
+ name="title"
+ label="标题"
+ rules={[{ required: true, message: '请输入标题' }]}
+ >
+ <Input placeholder="请输入标题" />
+ </Form.Item>
+
+ <Form.Item
+ name="desc"
+ label="描述"
+ rules={[{ required: true, message: '请输入描述' }]}
+ >
+ <Input.TextArea rows={4} placeholder="请输入描述" />
+ </Form.Item>
+
+ {type === PubType.VIDEO && (
+ <>
+ <Form.Item
+ name="videoPath"
+ label="视频路径"
+ rules={[{ required: true, message: '请输入视频路径' }]}
+ >
+ <Input placeholder="请输入视频路径" />
+ </Form.Item>
+
+ <Form.Item
+ name="coverPath"
+ label="封面路径"
+ rules={[{ required: true, message: '请输入封面路径' }]}
+ >
+ <Input placeholder="请输入封面路径" />
+ </Form.Item>
+
+ <Form.Item
+ name="commonCoverPath"
+ label="通用封面路径"
+ >
+ <Input placeholder="请输入通用封面路径" />
+ </Form.Item>
+ </>
+ )}
+
+ {type === PubType.IMAGE_TEXT && (
+ <Form.Item
+ name="imagePath"
+ label="图片路径"
+ rules={[{ required: true, message: '请输入图片路径' }]}
+ >
+ <Input placeholder="请输入图片路径" />
+ </Form.Item>
+ )}
+
+ <Form.Item
+ name="status"
+ label="发布状态"
+ initialValue={PubStatus.UNPUBLISH}
+ >
+ <Select placeholder="请选择发布状态">
+ <Option value={PubStatus.UNPUBLISH}>未发布</Option>
+ <Option value={PubStatus.RELEASED}>已发布</Option>
+ <Option value={PubStatus.FAIL}>发布失败</Option>
+ <Option value={PubStatus.PART_SUCCESS}>部分成功</Option>
+ </Select>
+ </Form.Item>
+
+ <Form.Item
+ name="timingTime"
+ label="定时发布时间"
+ >
+ <DatePicker
+ showTime
+ placeholder="请选择定时发布时间"
+ style={{ width: '100%' }}
+ />
+ </Form.Item>
+
+ <Form.Item
+ name="publishTime"
+ label="发布时间"
+ >
+ <DatePicker
+ showTime
+ placeholder="请选择发布时间"
+ style={{ width: '100%' }}
+ />
+ </Form.Item>
+
+ <Form.Item>
+ <Button type="primary" htmlType="submit" loading={loading} block>
+ 提交
+ </Button>
+ </Form.Item>
+ </Form>
+ </Modal>
+ );
+}
\ No newline at end of file
diff --git a/src/app/[lng]/publish/components/DraftList.tsx b/src/app/[lng]/publish/components/DraftList.tsx
new file mode 100644
index 00000000..47b73635
--- /dev/null
+++ b/src/app/[lng]/publish/components/DraftList.tsx
@@ -0,0 +1,124 @@
+"use client";
+
+import { useEffect, useState } from 'react';
+import { Table, message, Tag } from 'antd';
+import type { ColumnsType } from 'antd/es/table';
+import { getDraftsListApi } from '@/api/publish';
+import { PubType, PubStatus } from '@/types/publish';
+
+interface DraftItem {
+ id: number;
+ title: string;
+ type: string;
+ status: number;
+ createTime: string;
+ updateTime: string;
+}
+
+export default function DraftList() {
+ const [loading, setLoading] = useState(false);
+ const [data, setData] = useState<DraftItem[]>([]);
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0,
+ });
+
+ const getStatusTag = (status: number) => {
+ switch (status) {
+ case PubStatus.UNPUBLISH:
+ return <Tag color="default">未发布</Tag>;
+ case PubStatus.RELEASED:
+ return <Tag color="success">已发布</Tag>;
+ case PubStatus.FAIL:
+ return <Tag color="error">发布失败</Tag>;
+ case PubStatus.PART_SUCCESS:
+ return <Tag color="warning">部分成功</Tag>;
+ default:
+ return <Tag>未知状态</Tag>;
+ }
+ };
+
+ const getTypeText = (type: string) => {
+ switch (type) {
+ case PubType.VIDEO:
+ return '视频';
+ case PubType.ARTICLE:
+ return '文章';
+ case PubType.IMAGE_TEXT:
+ return '图文';
+ default:
+ return type;
+ }
+ };
+
+ const columns: ColumnsType<DraftItem> = [
+ {
+ title: '标题',
+ dataIndex: 'title',
+ key: 'title',
+ },
+ {
+ title: '类型',
+ dataIndex: 'type',
+ key: 'type',
+ render: (type) => getTypeText(type),
+ },
+ {
+ title: '状态',
+ dataIndex: 'status',
+ key: 'status',
+ render: (status) => getStatusTag(status),
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createTime',
+ key: 'createTime',
+ },
+ {
+ title: '更新时间',
+ dataIndex: 'updateTime',
+ key: 'updateTime',
+ },
+ ];
+
+ const fetchData = async (page = 1, pageSize = 10) => {
+ try {
+ setLoading(true);
+ const response: any = await getDraftsListApi(page, pageSize);
+ if (response?.code === 0) {
+ setData(response.data.list);
+ setPagination({
+ ...pagination,
+ current: page,
+ total: response.data.total,
+ });
+ } else {
+ message.error(response?.msg || '获取草稿列表失败');
+ }
+ } catch (error) {
+ message.error('获取草稿列表失败');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ useEffect(() => {
+ fetchData();
+ }, []);
+
+ const handleTableChange = (newPagination: any) => {
+ fetchData(newPagination.current, newPagination.pageSize);
+ };
+
+ return (
+ <Table
+ columns={columns}
+ dataSource={data}
+ rowKey="id"
+ pagination={pagination}
+ loading={loading}
+ onChange={handleTableChange}
+ />
+ );
+}
\ No newline at end of file
diff --git a/src/app/[lng]/publish/components/PublishList.tsx b/src/app/[lng]/publish/components/PublishList.tsx
new file mode 100644
index 00000000..fd4d4ab1
--- /dev/null
+++ b/src/app/[lng]/publish/components/PublishList.tsx
@@ -0,0 +1,182 @@
+"use client";
+
+import { useEffect, useState } from 'react';
+import { Table, message, Tag, Space, Button, Popconfirm } from 'antd';
+import type { ColumnsType } from 'antd/es/table';
+import { getPublishListApi, updatePublishStatusApi, deletePublishApi } from '@/api/publish';
+import { PubType, PubStatus } from '@/types/publish';
+
+interface PublishItem {
+ id: number;
+ title: string;
+ type: string;
+ status: number;
+ createTime: string;
+ publishTime: string;
+}
+
+export default function PublishList() {
+ const [loading, setLoading] = useState(false);
+ const [data, setData] = useState<PublishItem[]>([]);
+ const [pagination, setPagination] = useState({
+ current: 1,
+ pageSize: 10,
+ total: 0,
+ });
+
+ const getStatusTag = (status: number) => {
+ switch (status) {
+ case PubStatus.UNPUBLISH:
+ return <Tag color="default">未发布</Tag>;
+ case PubStatus.RELEASED:
+ return <Tag color="success">已发布</Tag>;
+ case PubStatus.FAIL:
+ return <Tag color="error">发布失败</Tag>;
+ case PubStatus.PART_SUCCESS:
+ return <Tag color="warning">部分成功</Tag>;
+ default:
+ return <Tag>未知状态</Tag>;
+ }
+ };
+
+ const getTypeText = (type: string) => {
+ switch (type) {
+ case PubType.VIDEO:
+ return '视频';
+ case PubType.ARTICLE:
+ return '文章';
+ case PubType.IMAGE_TEXT:
+ return '图文';
+ default:
+ return type;
+ }
+ };
+
+ const handleUpdateStatus = async (id: number, status: number) => {
+ try {
+ const response = await updatePublishStatusApi(id, status);
+ if (response?.code === 0) {
+ message.success('状态更新成功');
+ fetchData(pagination.current, pagination.pageSize);
+ } else {
+ message.error(response?.msg || '状态更新失败');
+ }
+ } catch (error) {
+ message.error('状态更新失败');
+ }
+ };
+
+ const handleDelete = async (id: number) => {
+ try {
+ const response = await deletePublishApi(id);
+ if (response?.code === 0) {
+ message.success('删除成功');
+ fetchData(pagination.current, pagination.pageSize);
+ } else {
+ message.error(response?.msg || '删除失败');
+ }
+ } catch (error) {
+ message.error('删除失败');
+ }
+ };
+
+ const columns: ColumnsType<PublishItem> = [
+ {
+ title: '标题',
+ dataIndex: 'title',
+ key: 'title',
+ },
+ {
+ title: '类型',
+ dataIndex: 'type',
+ key: 'type',
+ render: (type) => getTypeText(type),
+ },
+ {
+ title: '状态',
+ dataIndex: 'status',
+ key: 'status',
+ render: (status) => getStatusTag(status),
+ },
+ {
+ title: '创建时间',
+ dataIndex: 'createTime',
+ key: 'createTime',
+ },
+ {
+ title: '发布时间',
+ dataIndex: 'publishTime',
+ key: 'publishTime',
+ },
+ {
+ title: '操作',
+ key: 'action',
+ render: (_, record) => (
+ <Space size="middle">
+ <Button
+ type="link"
+ onClick={() => handleUpdateStatus(record.id, PubStatus.RELEASED)}
+ disabled={record.status === PubStatus.RELEASED}
+ >
+ 发布
+ </Button>
+ <Button
+ type="link"
+ onClick={() => handleUpdateStatus(record.id, PubStatus.UNPUBLISH)}
+ disabled={record.status === PubStatus.UNPUBLISH}
+ >
+ 取消发布
+ </Button>
+ <Popconfirm
+ title="确定要删除这条记录吗?"
+ onConfirm={() => handleDelete(record.id)}
+ okText="确定"
+ cancelText="取消"
+ >
+ <Button type="link" danger>删除</Button>
+ </Popconfirm>
+ </Space>
+ ),
+ },
+ ];
+
+ const fetchData = async (page = 1, pageSize = 10) => {
+ try {
+ setLoading(true);
+ const response: any = await getPublishListApi(page, pageSize);
+ if (response?.code === 0) {
+ setData(response.data.list);
+ setPagination({
+ ...pagination,
+ current: page,
+ total: response.data.total,
+ });
+ } else {
+ message.error(response?.msg || '获取列表失败');
+ }
+ } catch (error) {
+ message.error('获取列表失败');
+ } finally {
+ setLoading(false);
+ }
+ };
+
+ useEffect(() => {
+ fetchData();
+ }, []);
+
+ const handleTableChange = (newPagination: any) => {
+ fetchData(newPagination.current, newPagination.pageSize);
+ };
+
+ return (
+ <Table
+ columns={columns}
+ dataSource={data}
+ rowKey="id"
+ pagination={pagination}
+ loading={loading}
+ onChange={handleTableChange}
+ />
+ );
+}
\ No newline at end of file
diff --git a/src/app/[lng]/publish/page.tsx b/src/app/[lng]/publish/page.tsx
new file mode 100644
index 00000000..86e7b93a
--- /dev/null
+++ b/src/app/[lng]/publish/page.tsx
@@ -0,0 +1,77 @@
+"use client";
+
+import { useState } from 'react';
+import { Button, Tabs } from 'antd';
+import styles from './publish.module.css';
+import PublishList from './components/PublishList';
+import DraftList from './components/DraftList';
+import CreatePublish from './components/CreatePublish';
+import { PubType, PublishType } from '@/types/publish';
+
+export default function PublishPage() {
+ const [activeTab, setActiveTab] = useState('1');
+ const [isCreateModalVisible, setIsCreateModalVisible] = useState(false);
+ const [createType, setCreateType] = useState<PublishType>(PubType.VIDEO);
+
+ const handleCreateClick = (type: PublishType) => {
+ setCreateType(type);
+ setIsCreateModalVisible(true);
+ };
+
+ const items = [
+ {
+ key: '1',
+ label: '发布列表',
+ children: <PublishList />,
+ },
+ {
+ key: '2',
+ label: '草稿箱',
+ children: <DraftList />,
+ },
+ ];
+
+ return (
+ <div className={styles.container}>
+ <div className={styles.header}>
+ <h1>内容发布</h1>
+ <div className={styles.actions}>
+ <Button
+ type="primary"
+ onClick={() => handleCreateClick(PubType.IMAGE_TEXT)}
+ className={styles.createButton}
+ >
+ 创建图文发布
+ </Button>
+ <Button
+ type="primary"
+ onClick={() => handleCreateClick(PubType.VIDEO)}
+ className={styles.createButton}
+ >
+ 创建视频发布
+ </Button>
+ <Button
+ type="primary"
+ onClick={() => handleCreateClick(PubType.ARTICLE)}
+ className={styles.createButton}
+ >
+ 创建文章发布
+ </Button>
+ </div>
+ </div>
+
+ <Tabs
+ activeKey={activeTab}
+ onChange={setActiveTab}
+ items={items}
+ className={styles.tabs}
+ />
+
+ <CreatePublish
+ visible={isCreateModalVisible}
+ type={createType}
+ onClose={() => setIsCreateModalVisible(false)}
+ />
+ </div>
+ );
+}
\ No newline at end of file
diff --git a/src/app/[lng]/publish/publish.module.css b/src/app/[lng]/publish/publish.module.css
new file mode 100644
index 00000000..6cd995b9
--- /dev/null
+++ b/src/app/[lng]/publish/publish.module.css
@@ -0,0 +1,34 @@
+.container {
+ padding: 24px;
+ max-width: 1200px;
+ margin: 0 auto;
+}
+
+.header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ margin-bottom: 24px;
+}
+
+.header h1 {
+ margin: 0;
+ font-size: 24px;
+ font-weight: 600;
+}
+
+.actions {
+ display: flex;
+ gap: 16px;
+}
+
+.createButton {
+ min-width: 120px;
+}
+
+.tabs {
+ background: #fff;
+ padding: 16px;
+ border-radius: 8px;
+ box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
+}
\ No newline at end of file
diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.ts
index 0d43b641..17d04a8d 100644
--- a/src/app/layout/routerData.ts
+++ b/src/app/layout/routerData.ts
@@ -24,6 +24,10 @@ export const routerData: IRouterDataItem[] = [
name: "账户",
path: "/accounts",
},
+ {
+ name: "发布",
+ path: "/publish",
+ },
];
const recursion = (
diff --git a/src/constant.ts b/src/constant.ts
index 751c8f01..2daf028b 100644
--- a/src/constant.ts
+++ b/src/constant.ts
@@ -1,3 +1,3 @@
// api url
-// export const API_BASE_URL = "https://api.yikart.cn/api/";
-export const API_BASE_URL = "http://localhost:3000/api/";
+// export const API_BASE_URL = "https://api.yikart.cn/api";
+export const API_BASE_URL = "http://localhost:3000/api";
diff --git a/src/store/account.ts b/src/store/account.ts
new file mode 100644
index 00000000..3c6396f6
--- /dev/null
+++ b/src/store/account.ts
@@ -0,0 +1,26 @@
+import { create } from 'zustand';
+import { SocialAccount, getAccountListApi } from '@/api/apiReq';
+
+interface AccountState {
+ accounts: SocialAccount[];
+ loading: boolean;
+ fetchAccounts: () => Promise<void>;
+}
+
+export const useAccountStore = create<AccountState>((set) => ({
+ accounts: [],
+ loading: false,
+ fetchAccounts: async () => {
+ try {
+ set({ loading: true });
+ const response: any = await getAccountListApi();
+ if (response?.code === 0 && response.data) {
+ set({ accounts: response.data });
+ }
+ } catch (error) {
+ console.error('获取账户列表失败:', error);
+ } finally {
+ set({ loading: false });
+ }
+ },
+}));
\ No newline at end of file
diff --git a/src/types/publish.ts b/src/types/publish.ts
new file mode 100644
index 00000000..6f6f23fa
--- /dev/null
+++ b/src/types/publish.ts
@@ -0,0 +1,15 @@
+export enum PubType {
+ VIDEO = 'video', // 视频
+ ARTICLE = 'article', // 文章
+ IMAGE_TEXT = 'image-text', // 图文
+}
+
+export enum PubStatus {
+ UNPUBLISH = 0, // 未发布/草稿
+ RELEASED = 1, // 已发布
+ FAIL = 2, // 发布失败
+ PART_SUCCESS = 3, // 部分成功
+}
+
+export type PublishType = `${PubType}`;
+export type PublishStatus = `${PubStatus}`;
\ No newline at end of file