Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pagePlugin): 删除文件夹添加节流,避免多次出现无法删除弹窗 #74

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 28 additions & 28 deletions packages/plugins/page/src/PageFolderSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { Button, Collapse, CollapseItem } from '@opentiny/vue'
import { PluginSetting, SvgButton, ButtonGroup } from '@opentiny/tiny-engine-common'
import { usePage, useModal, useApp, useNotify } from '@opentiny/tiny-engine-controller'
import { isEqual } from '@opentiny/vue-renderless/common/object'
import throttle from '@opentiny/vue-renderless/common/deps/throttle'
import PageGeneral from './PageGeneral.vue'
import http from './http.js'

Expand Down Expand Up @@ -158,40 +159,39 @@ export default {
type: 'error',
message: '此文件夹不是空文件夹,不能删除!'
})
return false
} else {
confirm({
title: '提示',
message: '您是否要删除文件夹?',
exec: () => {
const id = pageSettingState.currentPageData?.id || ''

requestDeletePage(id)
.then(() => {
pageSettingState.updateTreeData()
closeFolderSettingPanel()
useNotify({
type: 'success',
message: '删除文件夹成功!'
})
})
.catch((error) => {
useNotify({
type: 'success',
title: '删除文件夹失败!',
message: JSON.stringify(error?.message || error)
})
})
}
})

return
}

return undefined
confirm({
title: '提示',
message: '您是否要删除文件夹?',
exec: () => {
const id = pageSettingState.currentPageData?.id || ''

requestDeletePage(id)
.then(() => {
pageSettingState.updateTreeData()
closeFolderSettingPanel()
useNotify({
type: 'success',
message: '删除文件夹成功!'
})
})
.catch((error) => {
useNotify({
type: 'success',
title: '删除文件夹失败!',
message: JSON.stringify(error?.message || error)
})
})
}
})
}

return {
saveFolderSetting,
deleteFolder,
deleteFolder: throttle(5000, true, deleteFolder),
folderGeneralRef,
closeFolderSettingPanel,
isShow,
Expand Down