feat: 本次提交更新内容如下
bugfix
This commit is contained in:
@@ -172,7 +172,7 @@ export default function DeviceDetail() {
|
||||
}, [id]);
|
||||
|
||||
// 获取设备关联微信账号
|
||||
const fetchRelatedAccounts = async (page = 1) => {
|
||||
const fetchRelatedAccounts = useCallback(async (page = 1) => {
|
||||
if (!id || accountsLoading) return;
|
||||
|
||||
try {
|
||||
@@ -213,10 +213,10 @@ export default function DeviceDetail() {
|
||||
} finally {
|
||||
setAccountsLoading(false);
|
||||
}
|
||||
};
|
||||
}, [id, accountsLoading, accountsPerPage, toast]);
|
||||
|
||||
// 获取操作记录
|
||||
const fetchHandleLogs = async () => {
|
||||
const fetchHandleLogs = useCallback(async () => {
|
||||
if (!id || logsLoading) return;
|
||||
|
||||
try {
|
||||
@@ -250,7 +250,7 @@ export default function DeviceDetail() {
|
||||
} finally {
|
||||
setLogsLoading(false);
|
||||
}
|
||||
};
|
||||
}, [id, logsLoading, logPage, logsPerPage, toast]);
|
||||
|
||||
// 加载更多操作记录
|
||||
const loadMoreLogs = useCallback(() => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useState, useCallback } from 'react';
|
||||
import { useParams, useNavigate, useSearchParams } from 'react-router-dom';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import Layout from '@/components/Layout';
|
||||
@@ -135,7 +135,7 @@ export default function ScenarioDetail() {
|
||||
}, [scenarioId]);
|
||||
|
||||
// 获取场景名称 - 优先使用URL查询参数,其次使用映射
|
||||
const getScenarioName = () => {
|
||||
const getScenarioName = useCallback(() => {
|
||||
// 优先使用URL查询参数中的name
|
||||
const urlName = searchParams.get('name');
|
||||
if (urlName) {
|
||||
@@ -144,17 +144,21 @@ export default function ScenarioDetail() {
|
||||
|
||||
// 如果没有URL参数,使用映射
|
||||
return getChannelName(scenarioId || '');
|
||||
};
|
||||
}, [searchParams, scenarioId]);
|
||||
|
||||
// 更新场景数据中的名称
|
||||
useEffect(() => {
|
||||
if (scenario) {
|
||||
setScenario(prev => prev ? {
|
||||
...prev,
|
||||
name: getScenarioName()
|
||||
name: (() => {
|
||||
const urlName = searchParams.get('name');
|
||||
if (urlName) return urlName;
|
||||
return getChannelName(scenarioId || '');
|
||||
})()
|
||||
} : null);
|
||||
}
|
||||
}, [searchParams, scenarioId, scenario, getScenarioName]);
|
||||
}, [searchParams, scenarioId, scenario]);
|
||||
|
||||
// const handleEditPlan = (taskId: string) => {
|
||||
// navigate(`/scenarios/${scenarioId}/edit/${taskId}`);
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React, { useEffect, useState, useMemo } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { Plus, TrendingUp, Loader2 } from 'lucide-react';
|
||||
import PageHeader from '@/components/PageHeader';
|
||||
import Layout from '@/components/Layout';
|
||||
import BottomNav from '@/components/BottomNav';
|
||||
import { fetchScenes, type SceneItem } from '@/api/scenarios';
|
||||
import { useToast } from '@/components/ui/toast';
|
||||
import '@/components/Layout.css';
|
||||
|
||||
interface Scenario {
|
||||
@@ -20,22 +19,21 @@ interface Scenario {
|
||||
|
||||
export default function Scenarios() {
|
||||
const navigate = useNavigate();
|
||||
// const { toast } = useToast();
|
||||
const [scenarios, setScenarios] = useState<Scenario[]>([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [error, setError] = useState('');
|
||||
|
||||
// 场景描述映射
|
||||
const scenarioDescriptions: Record<string, string> = {
|
||||
'douyin': '通过抖音平台进行精准获客',
|
||||
'xiaohongshu': '利用小红书平台进行内容营销获客',
|
||||
'gongzhonghao': '通过微信公众号进行获客',
|
||||
'haibao': '通过海报分享进行获客',
|
||||
'phone': '通过电话营销进行获客',
|
||||
'weixinqun': '通过微信群进行获客',
|
||||
'payment': '通过付款码进行获客',
|
||||
'api': '通过API接口进行获客',
|
||||
};
|
||||
const scenarioDescriptions: Record<string, string> = useMemo(() => ({
|
||||
douyin: '通过抖音平台进行精准获客',
|
||||
xiaohongshu: '利用小红书平台进行内容营销获客',
|
||||
gongzhonghao: '通过微信公众号进行获客',
|
||||
haibao: '通过海报分享进行获客',
|
||||
phone: '通过电话营销进行获客',
|
||||
weixinqun: '通过微信群进行获客',
|
||||
payment: '通过付款码进行获客',
|
||||
api: '通过API接口进行获客',
|
||||
}), []);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchScenarios = async () => {
|
||||
|
||||
@@ -80,7 +80,7 @@ export default function WechatAccountDetail() {
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const { currentAccount, clearCurrentAccount } = useWechatAccount();
|
||||
const { currentAccount } = useWechatAccount();
|
||||
|
||||
const [accountSummary, setAccountSummary] = useState<WechatAccountSummary | null>(null);
|
||||
const [showRestrictions, setShowRestrictions] = useState(false);
|
||||
|
||||
@@ -45,7 +45,7 @@ interface Conversation {
|
||||
}
|
||||
|
||||
export default function AIAssistant() {
|
||||
// const navigate = useNavigate();
|
||||
const navigate = useNavigate();
|
||||
const { toast } = useToast();
|
||||
const [conversations, setConversations] = useState<Conversation[]>([]);
|
||||
const [currentConversation, setCurrentConversation] = useState<Conversation | null>(null);
|
||||
|
||||
@@ -17,8 +17,8 @@ import {
|
||||
Calendar,
|
||||
Users,
|
||||
Share2,
|
||||
CheckCircle,
|
||||
XCircle,
|
||||
// CheckCircle,
|
||||
// XCircle,
|
||||
} from 'lucide-react';
|
||||
import { Card } from '@/components/ui/card';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
Reference in New Issue
Block a user