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: add error handlers and fix some misspelling of word #1036

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
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
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
Loading