fix(bug): fix router

This commit is contained in:
zhangheng
2026-03-27 15:13:41 +08:00
parent 764d0a726f
commit 72f1610fc3
7 changed files with 35 additions and 30 deletions

View File

@@ -156,7 +156,7 @@ const TopTools = (
isLabelTask,
renderPolygons,
} = props
const { backUrl } = useBackUrlStore()
const { backUrl, basePath } = useBackUrlStore()
const { mode, loadingData } = usePaperStore()
const router = useRouter()
const user_id = usePermissionStore.getState().user_id
@@ -1091,9 +1091,9 @@ const TopTools = (
useObjectStore.getState().resetPathAndOperationStatus()
} else {
// 无id返回时跳转回任务列表页
const url = backUrl || "/"
router.push(url)
// window.location.href = url
const url = backUrl ? basePath + backUrl : "/"
// router.push(url)
window.location.href = url
// 重置图片比例及选中标注对象
usePaperStore.getState().resetRasterScale()
useObjectStore.getState().resetPathAndOperationStatus()
@@ -1757,9 +1757,9 @@ const TopTools = (
c="dark"
onClick={() => {
if (isView) {
const url = backUrl || "/"
router.push(url)
// window.location.href = url
const url = backUrl ? basePath + backUrl : "/"
// router.push(url)
window.location.href = url
// handleBackup("auto_backup");
// 重置图片比例及选中标注对象
usePaperStore.getState().resetRasterScale()
@@ -2450,9 +2450,9 @@ const TopTools = (
return
}
setConfirmOpen(false)
const url = backUrl || "/"
router.push(url)
// window.location.href = url
const url = backUrl ? basePath + backUrl : "/"
// router.push(url)
window.location.href = url
// 重置图片比例及选中标注对象
usePaperStore.getState().resetRasterScale()
useObjectStore.getState().resetPathAndOperationStatus()
@@ -2461,9 +2461,9 @@ const TopTools = (
try {
setConfirmOpen(false)
handleBackup("auto_backup")
const url = backUrl || "/"
router.push(url)
// window.location.href = url
const url = backUrl ? basePath + backUrl : "/"
// router.push(url)
window.location.href = url
// 重置图片比例及选中标注对象
usePaperStore.getState().resetRasterScale()
useObjectStore.getState().resetPathAndOperationStatus()

View File

@@ -1,8 +1,8 @@
import { ALL_CODE } from "../utils/constants"
import dayjs from "dayjs"
import { create } from "zustand"
import { persist } from "zustand/middleware"
import { storage } from "../store"
import dayjs from "dayjs"
import { ALL_CODE } from "../utils/constants"
const initUserInfo = {
user_id: null,
@@ -263,8 +263,13 @@ export const useBackUrlStore = create(
(set) => ({
backUrl: null,
backTitle: null,
setBackProps: (url: string, title?: string) =>
set({ backUrl: url, backTitle: title || null }),
basePath: "",
setBackProps: (url: string, title?: string, basePath?: string) =>
set({
backUrl: url,
backTitle: title || null,
basePath: basePath || "",
}),
}),
{
name: "back_url",

View File

@@ -35,11 +35,11 @@ export const componentList: MenuItem[] = [
url: "video",
icon: "SystemIcon",
},
{
title: "点云标注",
url: "lidar",
icon: "SystemIcon",
},
// {
// title: "点云标注",
// url: "lidar",
// icon: "SystemIcon",
// },
{
title: "管理中心",
url: "mgt",