fix: improve workspace ID assignment and use const for lastIndex

--bug=1057324 --user=刘瑞斌 【资源授权】企业版-进入资源授权页面显示工作空间-默认应该显示用户所在的工作空间 https://www.tapd.cn/62980211/s/1724719
This commit is contained in:
CaptainB 2025-07-07 17:04:14 +08:00
parent da8a12cae7
commit 114c2985c0

View File

@ -199,7 +199,7 @@ const settingTags = reactive([
// ///
const activeData = computed(() => {
var lastIndex = route.path.lastIndexOf('/')
const lastIndex = route.path.lastIndexOf('/')
const currentPathType = route.path.substring(lastIndex + 1).toUpperCase()
return settingTags.filter((item) => {
return item.type === currentPathType
@ -430,7 +430,7 @@ const currentWorkspace = computed(() => {
async function getWorkspaceList() {
const res = await loadPermissionApi('workspace').getSystemWorkspaceList(loading)
workspaceList.value = res.data
currentWorkspaceId.value = 'default'
currentWorkspaceId.value = user.getWorkspaceId() as string || 'default'
}
function changeWorkspace(item: WorkspaceItem) {