Skip to content

Commit

Permalink
fix: add error handlers and fix some misspelling of word (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
gene9831 authored Jan 14, 2025
1 parent 3b99bf9 commit 8a2e34e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/canvas/route-bar/src/CanvasRouteBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ watch(
routes.value = []
return
}
const ancestors = await getAncestors(value, true)
const ancestors = (await getAncestors(value, true)) || []
routes.value = ancestors.concat(value).map((id) => {
const { route, isPage } = pageSettingState.treeDataMapping[id]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
<script setup lang="jsx">
import { usePage } from '@opentiny/tiny-engine-meta-register'
import { Select as TinySelect } from '@opentiny/vue'
import { computed, defineEmits, defineProps, reactive, watch } from 'vue'
import { computed, defineEmits, defineProps, onMounted, reactive, watch } from 'vue'
const props = defineProps({
modelValue: {
type: [String, Array],
type: String,
default: () => ''
}
})
Expand All @@ -43,9 +43,11 @@ const pages = computed(() =>
pageSettingState.pages[STATIC_PAGE_GROUP_ID].data.concat(pageSettingState.pages[COMMON_PAGE_GROUP_ID].data)
)
if (!Array.isArray(pages.value)) {
getPageList()
}
onMounted(() => {
if (!Array.isArray(pages.value)) {
getPageList()
}
})
const pageToTreeData = (page) => {
const { id, name, isPage, children } = page
Expand Down
34 changes: 21 additions & 13 deletions packages/plugins/page/src/PageTree.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<span class="title">{{ groupItem.groupName }}</span>
</template>
<div class="app-manage-tree">
<draggble-tree
<draggable-tree
:data="groupItem.data"
label-key="name"
:active="state.currentNodeData.id"
Expand Down Expand Up @@ -49,7 +49,7 @@
</tiny-popover>
</div>
</template>
</draggble-tree>
</draggable-tree>
</div>
</tiny-collapse-item>
</tiny-collapse>
Expand All @@ -75,7 +75,7 @@ import { constants } from '@opentiny/tiny-engine-utils'
import { closePageSettingPanel } from './PageSetting.vue'
import { closeFolderSettingPanel } from './PageFolderSetting.vue'
import http from './http.js'
import DraggbleTree from './Tree.vue'
import DraggableTree from './Tree.vue'
import { SvgButton } from '@opentiny/tiny-engine-common'
const { PAGE_STATUS } = constants
Expand All @@ -87,7 +87,7 @@ export default {
TinyCollapseItem: CollapseItem,
TinyIconSearch: IconSearch(),
TinyPopover: Popover,
DraggbleTree,
DraggableTree,
SvgButton
},
props: {
Expand Down Expand Up @@ -316,18 +316,26 @@ export default {
changeTreeData(newParent.id, dragged.parentId)
resetPageData()
// TODO 页面更换父节点后,原来每次变更需要填写变更信息
fetchPageDetail(dragged.id).then((pageDetail) => {
pageDetail.parentId = newParent.id
if (pageDetail.isPage) {
updatePage(pageDetail)
} else {
updateFolder(pageDetail)
}
})
fetchPageDetail(dragged.id)
.then((pageDetail) => {
pageDetail.parentId = newParent.id
if (pageDetail.isPage) {
updatePage(pageDetail)
} else {
updateFolder(pageDetail)
}
})
.catch((error) => {
useNotify({
type: 'error',
title: '移动页面文件/文件夹失败',
message: JSON.stringify(error?.message || error)
})
})
} else {
confirm({
title: '提示',
message: '更改关未保存,是否要放弃这些更改?',
message: '更改尚未保存,是否要放弃这些更改?',
exec: () => {
if (!pageSettingState.isNew) {
changeTreeData(pageSettingState.oldParentId, pageSettingState.currentPageData.parentId)
Expand Down

0 comments on commit 8a2e34e

Please sign in to comment.