From 3d88b14d47f819916de4071f68591ee8922f6141 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=87=8C=E7=9A=84=E6=B0=B8?= =?UTF-8?q?=E5=B9=B3?= Date: Wed, 23 Jul 2025 18:04:00 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E6=9C=AC=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=A6=82=E4=B8=8B?= =?UTF-8?q?=20=E5=9F=BA=E7=A1=80=E8=AE=BE=E7=BD=AE=E5=81=9A=E5=A5=BD?= =?UTF-8?q?=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nkebao/src/api/common.ts | 55 +++++++++---------- .../plan/new/steps/BasicSettings.tsx | 6 +- 2 files changed, 28 insertions(+), 33 deletions(-) diff --git a/nkebao/src/api/common.ts b/nkebao/src/api/common.ts index 6e675d3b7..ebe966eb5 100644 --- a/nkebao/src/api/common.ts +++ b/nkebao/src/api/common.ts @@ -1,28 +1,27 @@ -import request from "./request"; -/** - * 通用文件上传方法(支持图片、文件) - * @param {File} file - 要上传的文件对象 - * @param {string} [uploadUrl='/v1/attachment/upload'] - 上传接口地址 - * @returns {Promise} - 上传成功后返回文件url - */ -export async function uploadFile( - file: File, - uploadUrl: string = "/v1/attachment/upload" -): Promise { - try { - // 创建 FormData 对象用于文件上传 - const formData = new FormData(); - formData.append("file", file); - - // 使用 request 方法上传文件,设置正确的 Content-Type - const res = await request(uploadUrl, formData, "POST", { - headers: { - "Content-Type": "multipart/form-data", - }, - }); - - return res.url; - } catch (e: any) { - throw new Error(e?.message || "文件上传失败"); - } -} +import request from "./request"; +/** + * 通用文件上传方法(支持图片、文件) + * @param {File} file - 要上传的文件对象 + * @param {string} [uploadUrl='/v1/attachment/upload'] - 上传接口地址 + * @returns {Promise} - 上传成功后返回文件url + */ +export async function uploadFile( + file: File, + uploadUrl: string = "/v1/attachment/upload" +): Promise { + try { + // 创建 FormData 对象用于文件上传 + const formData = new FormData(); + formData.append("file", file); + + // 使用 request 方法上传文件,设置正确的 Content-Type + const res = await request(uploadUrl, formData, "POST", { + headers: { + "Content-Type": "multipart/form-data", + }, + }); + return res.url; + } catch (e: any) { + throw new Error(e?.message || "文件上传失败"); + } +} diff --git a/nkebao/src/pages/scenarios/plan/new/steps/BasicSettings.tsx b/nkebao/src/pages/scenarios/plan/new/steps/BasicSettings.tsx index abc55a503..e2d0ba35f 100644 --- a/nkebao/src/pages/scenarios/plan/new/steps/BasicSettings.tsx +++ b/nkebao/src/pages/scenarios/plan/new/steps/BasicSettings.tsx @@ -598,6 +598,7 @@ const BasicSettings: React.FC = ({ onChange={async (e) => { const file = e.target.files?.[0]; if (file) { + // 直接上传 try { const url = await uploadFile(file); const newPoster = { @@ -606,14 +607,9 @@ const BasicSettings: React.FC = ({ type: "poster", preview: url, }; - console.log(newPoster); - setCustomPosters((prev) => [...prev, newPoster]); - setSelectedMaterials([newPoster]); - onChange({ ...formData, materials: [newPoster] }); } catch (err) { // 可加toast提示 - log; } e.target.value = ""; } From bd833828be903b047de946fad4f67e6d4f38816b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=87=8C=E7=9A=84=E6=B0=B8?= =?UTF-8?q?=E5=B9=B3?= Date: Wed, 23 Jul 2025 18:33:53 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E6=9C=AC=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=A6=82=E4=B8=8B?= =?UTF-8?q?=20=E5=9C=BA=E6=99=AF=E8=AE=A1=E5=88=92-=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE-=E5=8D=A1=E7=89=87=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E5=A4=84=E7=90=86=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plan/new/steps/FriendRequestSettings.tsx | 288 ++++++++---------- .../plan/new/steps/MessageSettings.tsx | 75 +++-- .../plan/new/steps/friend.module.scss | 48 +++ .../plan/new/steps/messages.module.scss | 60 ++++ 4 files changed, 276 insertions(+), 195 deletions(-) create mode 100644 nkebao/src/pages/scenarios/plan/new/steps/friend.module.scss create mode 100644 nkebao/src/pages/scenarios/plan/new/steps/messages.module.scss diff --git a/nkebao/src/pages/scenarios/plan/new/steps/FriendRequestSettings.tsx b/nkebao/src/pages/scenarios/plan/new/steps/FriendRequestSettings.tsx index 16e458d2e..1c7b11e8a 100644 --- a/nkebao/src/pages/scenarios/plan/new/steps/FriendRequestSettings.tsx +++ b/nkebao/src/pages/scenarios/plan/new/steps/FriendRequestSettings.tsx @@ -1,19 +1,10 @@ "use client"; import React, { useState, useEffect } from "react"; -import { - Form, - Input, - Button, - Checkbox, - Modal, - Alert, - Select, - message, -} from "antd"; -import { QuestionCircleOutlined, MessageOutlined } from "@ant-design/icons"; +import { Input, Button, Modal, Alert, Select } from "antd"; +import { MessageOutlined } from "@ant-design/icons"; import DeviceSelection from "@/components/DeviceSelection"; -import Layout from "@/components/Layout/Layout"; +import styles from "./friend.module.scss"; interface FriendRequestSettingsProps { formData: any; @@ -46,8 +37,8 @@ const FriendRequestSettings: React.FC = ({ }) => { const [isTemplateDialogOpen, setIsTemplateDialogOpen] = useState(false); const [hasWarnings, setHasWarnings] = useState(false); - const [selectedDevices, setSelectedDevices] = useState( - formData.selectedDevices || [] + const [selectedDevices, setSelectedDevices] = useState( + formData.device || [] ); const [showRemarkTip, setShowRemarkTip] = useState(false); @@ -97,171 +88,156 @@ const FriendRequestSettings: React.FC = ({ }; return ( - <> - -
- - -
- - } - > -
-
- 选择设备 -
- d.id)} - onSelect={(deviceIds) => { - const newSelectedDevices = deviceIds.map((id) => ({ - id, - name: `设备 ${id}`, - status: "online", - })); - setSelectedDevices(newSelectedDevices); - onChange({ ...formData, device: deviceIds }); - }} - placeholder="选择设备" - /> -
-
+
+ {/* 选择设备区块 */} +
选择设备
+
+ { + setSelectedDevices(deviceIds); + onChange({ ...formData, device: deviceIds }); + }} + placeholder="选择设备" + /> +
-
-
- 好友备注 - setShowRemarkTip(true)} - onMouseLeave={() => setShowRemarkTip(false)} - onClick={() => setShowRemarkTip((v) => !v)} - > - ? - - {showRemarkTip && ( -
-
设置添加好友时的备注格式
-
- 备注格式预览: -
-
- {formData.remarkType === "phone" && - `138****1234+${getScenarioTitle()}`} - {formData.remarkType === "nickname" && - `小红书用户2851+${getScenarioTitle()}`} - {formData.remarkType === "source" && - `抖音直播+${getScenarioTitle()}`} -
-
- )} + {/* 好友备注区块 */} +
好友备注
+
+ + setShowRemarkTip(true)} + onMouseLeave={() => setShowRemarkTip(false)} + > + ? + + {showRemarkTip && ( +
+
设置添加好友时的备注格式
+
+ 备注格式预览:
- onChange({ ...formData, greeting: e.target.value })} + placeholder="请输入招呼语" + suffix={ +
+ 参考模板 + + } + /> +
-
-
- 招呼语 - -
- - onChange({ ...formData, greeting: e.target.value }) - } - placeholder="请输入招呼语" - className="mt-2" - /> -
+ {/* 添加间隔区块 */} +
添加间隔
+
+ + onChange({ + ...formData, + addFriendInterval: Number(e.target.value), + }) + } + style={{ width: 100 }} + /> + 分钟 +
-
- 添加间隔 -
- - onChange({ - ...formData, - addFriendInterval: Number(e.target.value), - }) - } - /> -
分钟
-
-
+ {/* 允许加人时间段区块 */} +
允许加人的时间段
+
+ + onChange({ ...formData, addFriendTimeStart: e.target.value }) + } + style={{ width: 120 }} + /> + + + onChange({ ...formData, addFriendTimeEnd: e.target.value }) + } + style={{ width: 120 }} + /> +
-
- 允许加人的时间段 -
- - onChange({ ...formData, addFriendTimeStart: e.target.value }) - } - className="w-32" - /> - - - onChange({ ...formData, addFriendTimeEnd: e.target.value }) - } - className="w-32" - /> -
-
+ {hasWarnings && ( + + )} - {hasWarnings && ( - - )} -
- + {/* 底部按钮 */} +
+ + +
+ {/* 招呼语模板弹窗 */} setIsTemplateDialogOpen(false)} footer={null} > -
+
{greetingTemplates.map((template, index) => ( ))}
- +
); }; diff --git a/nkebao/src/pages/scenarios/plan/new/steps/MessageSettings.tsx b/nkebao/src/pages/scenarios/plan/new/steps/MessageSettings.tsx index a3a34c24b..9d2c795a0 100644 --- a/nkebao/src/pages/scenarios/plan/new/steps/MessageSettings.tsx +++ b/nkebao/src/pages/scenarios/plan/new/steps/MessageSettings.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Form, Input, Button, Tabs, Modal, Alert, Upload, message } from "antd"; +import { Input, Button, Tabs, Modal, Alert, message } from "antd"; import { PlusOutlined, CloseOutlined, @@ -13,7 +13,7 @@ import { LinkOutlined, TeamOutlined, } from "@ant-design/icons"; -import Layout from "@/components/Layout/Layout"; +import styles from "./messages.module.scss"; interface MessageContent { id: string; @@ -194,9 +194,9 @@ const MessageSettings: React.FC = ({ key: plan.day.toString(), label: plan.day === 0 ? "即时消息" : `第${plan.day}天`, children: ( -
+
{plan.messages.map((message, messageIndex) => ( -
+
{plan.day === 0 ? ( @@ -524,7 +524,10 @@ const MessageSettings: React.FC = ({
))} - @@ -533,31 +536,24 @@ const MessageSettings: React.FC = ({ })); return ( - <> - -
- - -
-
- } - > -
-
-

消息设置

- -
- - -
- - +
+
+

消息设置

+ +
+ +
+ + +
{/* 添加天数计划弹窗 */} = ({ }} >

选择要添加的消息计划类型

-
- {/* 选择群聊弹窗 */} = ({ setIsGroupSelectOpen(false); }} > -
+
{mockGroups.map((group) => (
handleSelectGroup(group.id)} >
{group.name}
@@ -603,7 +600,7 @@ const MessageSettings: React.FC = ({ ))}
- +
); }; diff --git a/nkebao/src/pages/scenarios/plan/new/steps/friend.module.scss b/nkebao/src/pages/scenarios/plan/new/steps/friend.module.scss new file mode 100644 index 000000000..0c0f11386 --- /dev/null +++ b/nkebao/src/pages/scenarios/plan/new/steps/friend.module.scss @@ -0,0 +1,48 @@ +.friend-container { + padding: 12px; +} +.friend-label { + margin-bottom: 12px; + font-weight: 500; +} +.friend-block { + margin-bottom: 16px; +} +.friend-remark-tip { + position: absolute; + right: 0; + top: 36px; + z-index: 10; + background: #fff; + border: 1px solid #eee; + border-radius: 6px; + padding: 12px; + width: 220px; + box-shadow: 0 2px 8px rgba(0,0,0,0.08); +} +.friend-remark-q { + position: absolute; + right: 8px; + top: 8px; + cursor: pointer; + color: #888; +} +.friend-interval-row { + display: flex; + align-items: center; + gap: 8px; +} +.friend-time-row { + display: flex; + align-items: center; + gap: 8px; +} +.friend-footer { + display: flex; + justify-content: space-between; + margin-top: 32px; +} +.friend-modal-btn { + width: 100%; + margin-bottom: 8px; +} diff --git a/nkebao/src/pages/scenarios/plan/new/steps/messages.module.scss b/nkebao/src/pages/scenarios/plan/new/steps/messages.module.scss new file mode 100644 index 000000000..37ff9a1db --- /dev/null +++ b/nkebao/src/pages/scenarios/plan/new/steps/messages.module.scss @@ -0,0 +1,60 @@ +.messages-container { + padding: 16px; +} +.messages-header { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 16px; +} +.messages-title { + font-size: 18px; + font-weight: 600; +} +.messages-tab { + margin-bottom: 16px; +} +.messages-day-panel { + background: #fafbfc; + border-radius: 10px; + padding: 16px; + margin-bottom: 16px; +} +.messages-message-card { + background: #fff; + border-radius: 8px; + box-shadow: 0 2px 8px rgba(0,0,0,0.03); + padding: 16px; + margin-bottom: 16px; +} +.messages-message-type-btns { + display: flex; + gap: 8px; + margin-bottom: 8px; +} +.messages-add-message-btn { + width: 100%; + margin-top: 8px; +} +.messages-footer { + display: flex; + justify-content: space-between; + margin-top: 32px; +} +.messages-modal-btn { + width: 100%; + margin-bottom: 8px; +} +.messages-group-select-item { + padding: 16px; + border-radius: 8px; + cursor: pointer; + background: #fff; + margin-bottom: 8px; + border: 1px solid #eee; + transition: border 0.2s, background 0.2s; +} +.messages-group-select-item.selected { + background: #e6f7ff; + border: 1.5px solid #1677ff; +} From 1323ebb21743feebe8bb785df9e4dc520609d089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AC=94=E8=AE=B0=E6=9C=AC=E9=87=8C=E7=9A=84=E6=B0=B8?= =?UTF-8?q?=E5=B9=B3?= Date: Wed, 23 Jul 2025 19:05:18 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=E6=9C=AC=E6=AC=A1=E6=8F=90?= =?UTF-8?q?=E4=BA=A4=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9=E5=A6=82=E4=B8=8B?= =?UTF-8?q?=20=E8=87=AA=E5=8A=A8=E7=82=B9=E8=B5=9E=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/FriendSelection/index.tsx | 15 ++++++++++--- .../pages/workspace/auto-like/list/index.tsx | 21 ++++++------------- nkebao/src/router/module/workspace.tsx | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/nkebao/src/components/FriendSelection/index.tsx b/nkebao/src/components/FriendSelection/index.tsx index 0cf9e06fc..8048e8b66 100644 --- a/nkebao/src/components/FriendSelection/index.tsx +++ b/nkebao/src/components/FriendSelection/index.tsx @@ -150,9 +150,18 @@ export default function FriendSelection({ }; // 获取已选好友详细信息 - const selectedFriendObjs = friends.filter((friend) => - selectedFriends.includes(friend.id) - ); + const selectedFriendObjs = [ + ...friends.filter((friend) => selectedFriends.includes(friend.id)), + ...selectedFriends + .filter((id) => !friends.some((friend) => friend.id === id)) + .map((id) => ({ + id, + nickname: id, + wechatId: id, + avatar: "", + customer: "", + })), + ]; // 删除已选好友 const handleRemoveFriend = (id: string) => { diff --git a/nkebao/src/pages/workspace/auto-like/list/index.tsx b/nkebao/src/pages/workspace/auto-like/list/index.tsx index e70fc26a0..d95988280 100644 --- a/nkebao/src/pages/workspace/auto-like/list/index.tsx +++ b/nkebao/src/pages/workspace/auto-like/list/index.tsx @@ -1,6 +1,7 @@ import React, { useState, useEffect, useRef } from "react"; import { useNavigate } from "react-router-dom"; -import { NavBar, Button, Toast, SpinLoading, Dialog, Card } from "antd-mobile"; +import { Button, Toast, SpinLoading, Dialog, Card } from "antd-mobile"; +import NavCommon from "@/components/NavCommon"; import { Input } from "antd"; import { PlusOutlined, @@ -230,25 +231,15 @@ const AutoLike: React.FC = () => { - - navigate(-1)} - /> -
- } + navigate("/workspace")} right={ } - > - 自动点赞 - + /> {/* 搜索栏 */}
diff --git a/nkebao/src/router/module/workspace.tsx b/nkebao/src/router/module/workspace.tsx index 85282d918..ee4ca0c51 100644 --- a/nkebao/src/router/module/workspace.tsx +++ b/nkebao/src/router/module/workspace.tsx @@ -40,7 +40,7 @@ const workspaceRoutes = [ auth: true, }, { - path: "/workspace/auto-like/:id/edit", + path: "/workspace/auto-like/edit/:id", element: , auth: true, },