feat:对返回上一页做了处理

This commit is contained in:
许永平
2025-07-05 21:09:28 +08:00
parent 7b29660a51
commit 0385a4cfa9
13 changed files with 317 additions and 23 deletions

View File

@@ -1,5 +1,6 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { smartGoBack, getBackButtonText } from '@/utils/navigation';
import { ChevronLeft, Smartphone, Battery, Wifi, MessageCircle, Users, Settings, History, RefreshCw, Loader2 } from 'lucide-react';
import { devicesApi, fetchDeviceDetail, fetchDeviceRelatedAccounts, fetchDeviceHandleLogs, updateDeviceTaskConfig } from '@/api/devices';
import { useToast } from '@/components/ui/toast';
@@ -443,11 +444,11 @@ export default function DeviceDetail() {
ID为 "{id}"
</div>
<button
onClick={() => navigate(-1)}
onClick={() => smartGoBack(navigate)}
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg flex items-center gap-2 transition-colors"
>
<ChevronLeft className="h-4 w-4" />
{getBackButtonText()}
</button>
</div>
</div>
@@ -462,7 +463,7 @@ export default function DeviceDetail() {
<div className="flex items-center gap-3">
<button
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
onClick={() => navigate(-1)}
onClick={() => smartGoBack(navigate)}
>
<ChevronLeft className="h-5 w-5" />
</button>

View File

@@ -1,5 +1,6 @@
import React, { useState, useEffect, useRef, useCallback } from 'react';
import { useNavigate } from 'react-router-dom';
import { smartGoBack } from '@/utils/navigation';
import { ChevronLeft, Plus, Search, RefreshCw, QrCode, Smartphone, Loader2, AlertTriangle, Trash2, X } from 'lucide-react';
import { devicesApi } from '@/api';
import { useToast } from '@/components/ui/toast';
@@ -381,7 +382,7 @@ export default function Devices() {
<div className="flex items-center gap-3">
<button
className="p-2 hover:bg-gray-100 rounded-lg transition-colors"
onClick={() => navigate(-1)}
onClick={() => smartGoBack(navigate)}
>
<ChevronLeft className="h-5 w-5" />
</button>