feat: 本次提交更新内容如下
存一版
This commit is contained in:
@@ -128,7 +128,11 @@ function App() {
|
||||
{/* 场景计划开始 */}
|
||||
<Route path="/scenarios" element={<Scenarios />} />
|
||||
<Route path="/scenarios/new" element={<NewPlan />} />
|
||||
<Route path="/scenarios/edit/:id" element={<NewPlan />} />
|
||||
<Route
|
||||
path="/scenarios/new/:scenarioId"
|
||||
element={<NewPlan />}
|
||||
/>
|
||||
<Route path="/scenarios/edit/:planId" element={<NewPlan />} />
|
||||
<Route
|
||||
path="/scenarios/list/:scenarioId/:scenarioName"
|
||||
element={<ScenarioList />}
|
||||
|
||||
@@ -50,12 +50,73 @@ export interface Task {
|
||||
trend: { date: string; customers: number }[];
|
||||
}
|
||||
|
||||
// 消息内容类型
|
||||
export interface MessageContent {
|
||||
id: string;
|
||||
type: string; // "text" | "image" | "video" | "file" | "miniprogram" | "link" | "group" 等
|
||||
content?: string;
|
||||
intervalUnit?: "seconds" | "minutes";
|
||||
sendInterval?: number;
|
||||
// 其他可选字段
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// 每天的消息计划
|
||||
export interface MessagePlan {
|
||||
day: number;
|
||||
messages: MessageContent[];
|
||||
}
|
||||
|
||||
// 海报类型
|
||||
export interface Poster {
|
||||
id: string;
|
||||
name: string;
|
||||
type: string;
|
||||
preview: string;
|
||||
}
|
||||
|
||||
// 标签类型
|
||||
export interface Tag {
|
||||
id: string;
|
||||
name: string;
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
// textUrl类型
|
||||
export interface TextUrl {
|
||||
apiKey: string;
|
||||
originalString?: string;
|
||||
sign?: string;
|
||||
fullUrl: string;
|
||||
}
|
||||
|
||||
// 计划详情类型
|
||||
export interface PlanDetail {
|
||||
id: number;
|
||||
name: string;
|
||||
planName: string;
|
||||
scenario: string;
|
||||
scenarioTags: Tag[];
|
||||
customTags: Tag[];
|
||||
posters: Poster[];
|
||||
device: string[];
|
||||
enabled: boolean;
|
||||
addInterval: number;
|
||||
remarkFormat: string;
|
||||
planNameEdited: boolean;
|
||||
endTime: string;
|
||||
greeting: string;
|
||||
startTime: string;
|
||||
remarkType: string;
|
||||
addFriendInterval: number;
|
||||
messagePlans: MessagePlan[];
|
||||
sceneId: number | string;
|
||||
userId: number;
|
||||
companyId: number;
|
||||
status: number;
|
||||
apiKey: string;
|
||||
textUrl: {
|
||||
fullUrl: string;
|
||||
};
|
||||
wxMinAppSrc?: any;
|
||||
textUrl: TextUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,8 +9,7 @@ import {
|
||||
Calendar,
|
||||
Copy,
|
||||
Trash2,
|
||||
Play,
|
||||
Pause,
|
||||
Edit,
|
||||
Settings,
|
||||
Loader2,
|
||||
Code,
|
||||
@@ -308,7 +307,7 @@ export default function ScenarioDetail() {
|
||||
};
|
||||
|
||||
const handleCreateNewPlan = () => {
|
||||
navigate(`/scenarios/new?scenario=${scenarioId}`);
|
||||
navigate(`/scenarios/new/${scenarioId}`);
|
||||
};
|
||||
|
||||
const getStatusColor = (status: number) => {
|
||||
@@ -496,20 +495,14 @@ export default function ScenarioDetail() {
|
||||
|
||||
<div className="flex items-center space-x-2">
|
||||
<button
|
||||
onClick={() =>
|
||||
handleStatusChange(task.id, task.status === 1 ? 0 : 1)
|
||||
}
|
||||
onClick={() => navigate(`/scenarios/edit/${task.id}`)}
|
||||
className={`p-2 rounded-md ${
|
||||
task.status === 1
|
||||
? "text-yellow-600 hover:bg-yellow-50"
|
||||
: "text-green-600 hover:bg-green-50"
|
||||
}`}
|
||||
>
|
||||
{task.status === 1 ? (
|
||||
<Pause className="h-4 w-4" />
|
||||
) : (
|
||||
<Play className="h-4 w-4" />
|
||||
)}
|
||||
<Edit className="h-4 w-4" />
|
||||
</button>
|
||||
|
||||
<button
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useState, useEffect } from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { ChevronLeft } from "lucide-react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Toast } from "tdesign-mobile-react";
|
||||
@@ -8,7 +8,12 @@ import { BasicSettings } from "./steps/BasicSettings";
|
||||
import { FriendRequestSettings } from "./steps/FriendRequestSettings";
|
||||
import { MessageSettings } from "./steps/MessageSettings";
|
||||
import Layout from "@/components/Layout";
|
||||
import { getPlanScenes, createScenarioPlan } from "@/api/scenarios";
|
||||
import {
|
||||
getPlanScenes,
|
||||
createScenarioPlan,
|
||||
fetchPlanDetail,
|
||||
PlanDetail,
|
||||
} from "@/api/scenarios";
|
||||
|
||||
// 步骤定义 - 只保留三个步骤
|
||||
const steps = [
|
||||
@@ -22,7 +27,7 @@ export default function NewPlan() {
|
||||
const [currentStep, setCurrentStep] = useState(1);
|
||||
const [formData, setFormData] = useState({
|
||||
planName: "",
|
||||
scenario: "haibao",
|
||||
scenario: 1,
|
||||
posters: [],
|
||||
device: [],
|
||||
remarkType: "phone",
|
||||
@@ -38,15 +43,42 @@ export default function NewPlan() {
|
||||
});
|
||||
const [sceneList, setSceneList] = useState<any[]>([]);
|
||||
const [sceneLoading, setSceneLoading] = useState(true);
|
||||
|
||||
const { scenarioId, planId } = useParams<{
|
||||
scenarioId: string;
|
||||
planId: string;
|
||||
}>();
|
||||
const [isEdit, setIsEdit] = useState(false);
|
||||
useEffect(() => {
|
||||
loadData();
|
||||
}, []);
|
||||
|
||||
const loadData = async () => {
|
||||
setSceneLoading(true);
|
||||
//获取场景类型
|
||||
getPlanScenes()
|
||||
.then((res) => {
|
||||
setSceneList(res?.data || []);
|
||||
})
|
||||
.finally(() => setSceneLoading(false));
|
||||
}, []);
|
||||
if (planId) {
|
||||
setIsEdit(true);
|
||||
//获取计划详情
|
||||
const res = await fetchPlanDetail(planId);
|
||||
if (res.code === 200) {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
...{ scenario: Number(res?.data?.scenario) },
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
if (scenarioId) {
|
||||
setFormData((prev) => ({
|
||||
...prev,
|
||||
...{ scenario: Number(scenarioId) || 1 },
|
||||
}));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// 更新表单数据
|
||||
const onChange = (data: any) => {
|
||||
@@ -60,7 +92,7 @@ export default function NewPlan() {
|
||||
console.log(result);
|
||||
if (result.code === 200) {
|
||||
Toast({ message: "获客计划已创建", theme: "success" });
|
||||
// router("/scenarios/1?name=海报获客");
|
||||
router(`/scenarios/list/${scenarioId}/`);
|
||||
} else {
|
||||
Toast({
|
||||
message: result.msg,
|
||||
|
||||
@@ -11,160 +11,6 @@ import {
|
||||
import EyeIcon from "@/components/icons/EyeIcon";
|
||||
import { uploadFile } from "@/api/utils";
|
||||
|
||||
const phoneCallTags = [
|
||||
{ id: "tag-1", name: "咨询", color: "bg-blue-100 text-blue-800" },
|
||||
{ id: "tag-2", name: "投诉", color: "bg-red-100 text-red-800" },
|
||||
{ id: "tag-3", name: "合作", color: "bg-green-100 text-green-800" },
|
||||
{ id: "tag-4", name: "价格", color: "bg-orange-100 text-orange-800" },
|
||||
{ id: "tag-5", name: "售后", color: "bg-purple-100 text-purple-800" },
|
||||
{ id: "tag-6", name: "订单", color: "bg-yellow-100 text-yellow-800" },
|
||||
{ id: "tag-7", name: "物流", color: "bg-teal-100 text-teal-800" },
|
||||
];
|
||||
|
||||
// 不同场景的预设标签
|
||||
const scenarioTags = {
|
||||
haibao: [
|
||||
{
|
||||
id: "poster-tag-1",
|
||||
name: "活动推广",
|
||||
color: "bg-blue-100 text-blue-800",
|
||||
},
|
||||
{
|
||||
id: "poster-tag-2",
|
||||
name: "产品宣传",
|
||||
color: "bg-green-100 text-green-800",
|
||||
},
|
||||
{
|
||||
id: "poster-tag-3",
|
||||
name: "品牌展示",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
{ id: "poster-tag-4", name: "优惠促销", color: "bg-red-100 text-red-800" },
|
||||
{
|
||||
id: "poster-tag-5",
|
||||
name: "新品发布",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
],
|
||||
order: [
|
||||
{ id: "order-tag-1", name: "新订单", color: "bg-green-100 text-green-800" },
|
||||
{ id: "order-tag-2", name: "复购客户", color: "bg-blue-100 text-blue-800" },
|
||||
{
|
||||
id: "order-tag-3",
|
||||
name: "高价值订单",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
{
|
||||
id: "order-tag-4",
|
||||
name: "待付款",
|
||||
color: "bg-yellow-100 text-yellow-800",
|
||||
},
|
||||
{ id: "order-tag-5", name: "已完成", color: "bg-gray-100 text-gray-800" },
|
||||
],
|
||||
douyin: [
|
||||
{ id: "douyin-tag-1", name: "短视频", color: "bg-pink-100 text-pink-800" },
|
||||
{ id: "douyin-tag-2", name: "直播", color: "bg-red-100 text-red-800" },
|
||||
{
|
||||
id: "douyin-tag-3",
|
||||
name: "带货",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
{
|
||||
id: "douyin-tag-4",
|
||||
name: "粉丝互动",
|
||||
color: "bg-blue-100 text-blue-800",
|
||||
},
|
||||
{
|
||||
id: "douyin-tag-5",
|
||||
name: "热门话题",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
],
|
||||
xiaohongshu: [
|
||||
{ id: "xhs-tag-1", name: "种草笔记", color: "bg-red-100 text-red-800" },
|
||||
{ id: "xhs-tag-2", name: "美妆", color: "bg-pink-100 text-pink-800" },
|
||||
{ id: "xhs-tag-3", name: "穿搭", color: "bg-purple-100 text-purple-800" },
|
||||
{ id: "xhs-tag-4", name: "生活方式", color: "bg-green-100 text-green-800" },
|
||||
{
|
||||
id: "xhs-tag-5",
|
||||
name: "好物推荐",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
],
|
||||
phone: phoneCallTags,
|
||||
gongzhonghao: [
|
||||
{ id: "gzh-tag-1", name: "文章推送", color: "bg-blue-100 text-blue-800" },
|
||||
{ id: "gzh-tag-2", name: "活动通知", color: "bg-green-100 text-green-800" },
|
||||
{
|
||||
id: "gzh-tag-3",
|
||||
name: "产品介绍",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
{
|
||||
id: "gzh-tag-4",
|
||||
name: "用户服务",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
{ id: "gzh-tag-5", name: "品牌故事", color: "bg-gray-100 text-gray-800" },
|
||||
],
|
||||
weixinqun: [
|
||||
{ id: "wxq-tag-1", name: "群活动", color: "bg-green-100 text-green-800" },
|
||||
{ id: "wxq-tag-2", name: "产品分享", color: "bg-blue-100 text-blue-800" },
|
||||
{
|
||||
id: "wxq-tag-3",
|
||||
name: "用户交流",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
{ id: "wxq-tag-4", name: "优惠信息", color: "bg-pink-100 text-pink-800" },
|
||||
{
|
||||
id: "wxq-tag-5",
|
||||
name: "答疑解惑",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
{
|
||||
id: "wxq-tag-6",
|
||||
name: "新人欢迎",
|
||||
color: "bg-yellow-100 text-yellow-800",
|
||||
},
|
||||
{ id: "wxq-tag-7", name: "群规通知", color: "bg-gray-100 text-gray-800" },
|
||||
{
|
||||
id: "wxq-tag-8",
|
||||
name: "活跃互动",
|
||||
color: "bg-indigo-100 text-indigo-800",
|
||||
},
|
||||
],
|
||||
payment: [
|
||||
{ id: "pay-tag-1", name: "扫码支付", color: "bg-green-100 text-green-800" },
|
||||
{ id: "pay-tag-2", name: "线下门店", color: "bg-blue-100 text-blue-800" },
|
||||
{
|
||||
id: "pay-tag-3",
|
||||
name: "活动收款",
|
||||
color: "bg-purple-100 text-purple-800",
|
||||
},
|
||||
{
|
||||
id: "pay-tag-4",
|
||||
name: "服务费用",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
{
|
||||
id: "pay-tag-5",
|
||||
name: "会员充值",
|
||||
color: "bg-yellow-100 text-yellow-800",
|
||||
},
|
||||
],
|
||||
api: [
|
||||
{ id: "api-tag-1", name: "系统对接", color: "bg-blue-100 text-blue-800" },
|
||||
{ id: "api-tag-2", name: "数据同步", color: "bg-green-100 text-green-800" },
|
||||
{ id: "api-tag-3", name: "自动化", color: "bg-purple-100 text-purple-800" },
|
||||
{
|
||||
id: "api-tag-4",
|
||||
name: "第三方平台",
|
||||
color: "bg-orange-100 text-orange-800",
|
||||
},
|
||||
{ id: "api-tag-5", name: "实时推送", color: "bg-gray-100 text-gray-800" },
|
||||
],
|
||||
};
|
||||
|
||||
interface BasicSettingsProps {
|
||||
formData: any;
|
||||
onChange: (data: any) => void;
|
||||
@@ -584,9 +430,9 @@ export function BasicSettings({
|
||||
<input
|
||||
className="w-full"
|
||||
type="text"
|
||||
value={formData.planName}
|
||||
value={formData.name}
|
||||
onChange={(e) =>
|
||||
onChange({ ...formData, planName: String(e.target.value) })
|
||||
onChange({ ...formData, name: String(e.target.value) })
|
||||
}
|
||||
placeholder="请输入计划名称"
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user