Skip to content

Let's use AI to Earn!

feat: 调整页面

yikaJasonMic9f6eb9adfac3
diff --git a/electron/plat/Kwai/index.ts b/electron/plat/Kwai/index.ts
index 4af318a4..d1aea4de 100644
--- a/electron/plat/Kwai/index.ts
+++ b/electron/plat/Kwai/index.ts
@@ -419,9 +419,6 @@ class KwaiPub {
replyTo?: number; // 798319351;
},
) {
- console.log('----------- photoId', photoId);
- console.log('----------- content', content);
-
const res = await this.requestApi<CommentAddResponse>({
cookie: cookie,
url: '/rest/cp/creator/comment/add',
diff --git a/src/icp/autoRun.ts b/src/icp/autoRun.ts
index f6febd8e..08c5d487 100644
--- a/src/icp/autoRun.ts
+++ b/src/icp/autoRun.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-23 15:48:14
- * @LastEditTime: 2025-03-19 07:50:43
+ * @LastEditTime: 2025-03-20 20:28:02
* @LastEditors: nevin
* @Description: 自动进程
*/
@@ -51,6 +51,7 @@ export interface AutoRunRecord {
*/
export async function ipcCreateAutoRun(data: {
accountId: number;
+ dataId: number;
type: AutoRunType;
cycleType: string;
}) {
diff --git a/src/icp/reply.ts b/src/icp/reply.ts
index 1ea339d8..eed85484 100644
--- a/src/icp/reply.ts
+++ b/src/icp/reply.ts
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-01-23 15:48:14
- * @LastEditTime: 2025-02-14 22:36:25
+ * @LastEditTime: 2025-03-20 21:28:10
* @LastEditors: nevin
* @Description:
*/
@@ -28,6 +28,7 @@ export type CommentData = {
nikeName?: string;
headUrl?: string;
data: any; // 原数据
+ subCommentList: CommentData[]; // 子数据
};
export enum PageType {
@@ -125,3 +126,21 @@ export async function icpCreateCommentList(accountId: number, dataId: string) {
);
return res;
}
+
+/**
+ * 创建一键回复自动进程
+ * @param data
+ */
+export async function ipcCreateAutoRunOfReply(
+ accountId: number,
+ dataId: string, // 作品ID
+ cycleType: string,
+) {
+ const res: string = await window.ipcRenderer.invoke(
+ 'ICP_AUTO_RUN_CREATE_REPLY',
+ accountId,
+ dataId,
+ cycleType,
+ );
+ return res;
+}
diff --git a/src/views/reply/components/addAutoRun.tsx b/src/views/reply/components/addAutoRun.tsx
new file mode 100644
index 00000000..793fb3b3
--- /dev/null
+++ b/src/views/reply/components/addAutoRun.tsx
@@ -0,0 +1,74 @@
+/*
+ * @Author: nevin
+ * @Date: 2025-03-18 21:02:38
+ * @LastEditTime: 2025-03-20 20:38:47
+ * @LastEditors: nevin
+ * @Description: 添加自动运行
+ */
+import { ipcCreateAutoRunOfReply } from '@/icp/reply';
+import { Button, Input, Modal } from 'antd';
+import { forwardRef, useImperativeHandle, useState } from 'react';
+
+export interface AddAutoRunRef {
+ init: (accountId: number, dataId: string) => Promise<void>;
+}
+
+const Com = forwardRef<AddAutoRunRef>((props: any, ref) => {
+ const [isModalOpen, setIsModalOpen] = useState(false);
+ const [accountId, setAccountId] = useState<number>(0);
+ const [dataId, setDataId] = useState<string>('');
+ // '周期类型 天 day-22 (例:每天22时) 周 week-2 (例:每周周二,周日0) 月 month-22 (例:每月22号)',
+ const [cycleType, setCycleType] = useState<string>('');
+ async function init(accountId: number, dataId: string) {
+ setAccountId(accountId);
+ setDataId(dataId);
+ setIsModalOpen(true);
+ }
+
+ useImperativeHandle(ref, () => ({
+ init: init,
+ }));
+
+ function handleCancel() {
+ setIsModalOpen(false);
+ }
+
+ async function onFinish() {
+ console.log('-------- accountId', accountId);
+ console.log('-------- dataId', dataId);
+ console.log('-------- cycleType', cycleType);
+
+ const res = await ipcCreateAutoRunOfReply(accountId, dataId, cycleType);
+ console.log('-------- res', res);
+ }
+
+ return (
+ <>
+ <Modal
+ title="创建自动回复评论任务"
+ open={isModalOpen}
+ onCancel={handleCancel}
+ footer={null}
+ width={800}
+ >
+ <p>账号ID{accountId}</p>
+ <p>账号ID{accountId}</p>
+ <p>
+ 周期类型 天 day-22 例:每天22时 周 week-2 例:每周周二,周日0 月 month-22
+ 例:每月22号
+ </p>
+
+ <Input
+ onChange={(e) => {
+ setCycleType(e.target.value);
+ }}
+ />
+
+ <Button type="primary" onClick={onFinish}>
+ 创建
+ </Button>
+ </Modal>
+ </>
+ );
+});
+export default Com;
diff --git a/src/views/reply/index.tsx b/src/views/reply/index.tsx
index 213718ff..2d1c3991 100644
--- a/src/views/reply/index.tsx
+++ b/src/views/reply/index.tsx
@@ -1,7 +1,7 @@
/*
* @Author: nevin
* @Date: 2025-02-10 22:20:15
- * @LastEditTime: 2025-02-28 21:36:53
+ * @LastEditTime: 2025-03-20 21:28:52
* @LastEditors: nevin
* @Description: 评论页面 reply
*/
@@ -19,13 +19,14 @@ import styles from './reply.module.scss';
import Meta from 'antd/es/card/Meta';
import ReplyWorks, { ReplyWorksRef } from './components/replyWorks';
import ReplyComment, { ReplyCommentRef } from './components/replyComment';
+import AddAutoRun, { AddAutoRunRef } from './components/addAutoRun';
export default function Page() {
const [wordList, setWordList] = useState<WorkData[]>([]);
const [commentList, setCommentList] = useState<CommentData[]>([]);
const [activeAccountId, setActiveAccountId] = useState<number>(-1);
-
const Ref_ReplyWorks = useRef<ReplyWorksRef>(null);
+ const Ref_AddAutoRun = useRef<AddAutoRunRef>(null);
const Ref_ReplyComment = useRef<ReplyCommentRef>(null);
async function getCreatorList() {
@@ -44,6 +45,8 @@ export default function Page() {
*/
async function getCommentList(dataId: string) {
const res = await icpGetCommentList(activeAccountId, dataId);
+ console.log('------ res', res);
+
setCommentList(res.list);
}
@@ -71,6 +74,14 @@ export default function Page() {
Ref_ReplyComment.current?.init(activeAccountId, data);
}
+ /**
+ * 打开创建自动任务
+ * @param data
+ */
+ function openAddAutoRun(data: WorkData) {
+ Ref_AddAutoRun.current?.init(activeAccountId, data.dataId);
+ }
+
return (
<div className={styles.reply}>
<Row>
@@ -91,7 +102,7 @@ export default function Page() {
{wordList.map((item) => (
<Card
key={item.dataId}
- style={{ width: 300 }}
+ style={{ width: 500 }}
cover={<img alt="example" src={item.coverUrl} />}
actions={[
<Button
@@ -116,6 +127,14 @@ export default function Page() {
>
一键AI评论
</Button>,
+ <Button
+ type="primary"
+ onClick={() => {
+ openAddAutoRun(item);
+ }}
+ >
+ 创建自动任务
+ </Button>,
]}
>
<Meta title={item.title} />
@@ -136,6 +155,15 @@ export default function Page() {
]}
>
{item.content}
+ {item.subCommentList.map((subItem) => (
+ <div key={subItem.commentId}>
+ {subItem.content}
+ <Meta
+ avatar={<Avatar src={subItem.headUrl} />}
+ description={subItem.nikeName}
+ />
+ </div>
+ ))}
<Meta
avatar={<Avatar src={item.headUrl} />}
description={item.nikeName}
@@ -148,6 +176,7 @@ export default function Page() {
<ReplyWorks ref={Ref_ReplyWorks} />
<ReplyComment ref={Ref_ReplyComment} />
+ <AddAutoRun ref={Ref_AddAutoRun} />
</div>
);
}