Skip to content
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
24 changes: 18 additions & 6 deletions packages/common/component/BlockDeployDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
:modal="false"
:fullscreen="true"
:append-to-body="true"
title="Schema 本地与线上差异"
title="Schema 线上与本地差异"
>
<vue-monaco
v-if="state.compareVisible"
Expand Down Expand Up @@ -82,8 +82,9 @@ import {
FormItem as TinyFormItem
} from '@opentiny/vue'
import { theme } from '@opentiny/tiny-engine-controller/adapter'
import { useLayout } from '@opentiny/tiny-engine-controller'
import { useLayout, useNotify } from '@opentiny/tiny-engine-controller'
import { getSchema, setSchema } from '@opentiny/tiny-engine-canvas'
import { constants } from '@opentiny/tiny-engine-utils'
import VueMonaco from './VueMonaco.vue'

export default {
Expand All @@ -106,6 +107,7 @@ export default {
},
emits: ['update:visible'],
setup(props, { emit, attrs }) {
const { COMPONENT_NAME } = constants
const formState = reactive({
deployInfo: '',
version: '',
Expand Down Expand Up @@ -212,10 +214,20 @@ export default {
}

const save = () => {
const pageSchema = JSON.parse(state.newCode)
setSchema(pageSchema)

close()
if (!state.newCode) {
close()
return
}
try {
const pageSchema = JSON.parse(state.newCode)
setSchema({ ...pageSchema, componentName: COMPONENT_NAME.Block })
close()
} catch (err) {
useNotify({
type: 'error',
message: '代码静态检查有错误,请先修改后再保存'
})
}
}

return {
Expand Down