Skip to content

Commit

Permalink
feat: #1076 #1077 优化发布配置、平台导入、插件商店使用体验 - 优化文章绑定,历史元数据导入
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Mar 7, 2024
1 parent e2e134c commit 5099c12
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/components/set/preference/PostBind.vue
Expand Up @@ -36,6 +36,7 @@ import { usePublishSettingStore } from "~/src/stores/usePublishSettingStore.ts"
import { createAppLogger } from "~/src/utils/appLogger.ts"
import { getSiyuanPageId } from "~/src/utils/siyuanUtils.ts"
import { Utils } from "~/src/utils/utils.ts"
import { useSiyuanApi } from "~/src/composables/useSiyuanApi.ts"
const logger = createAppLogger("post-bind")
Expand All @@ -44,16 +45,19 @@ const { t } = useVueI18n()
const { query } = useRoute()
const { getPublishCfg } = usePublishConfig()
const { updateSetting } = usePublishSettingStore()
const { kernelApi } = useSiyuanApi()
// datas
const ruleFormRef = ref()
const ruleForm = reactive({})
const rules = reactive<FormRules>({})
const formData = reactive({
pageId: "",
siyuanPost: {} as any,
dynamicConfigArray: [] as DynamicConfig[],
postIdMap: {} as any,
})
const alertTitle = ref(`将对文章「${formData.pageId}」进行修复`)
// methods
const submitForm = async (formEl: any) => {
Expand Down Expand Up @@ -91,6 +95,11 @@ onMounted(async () => {
const id = Utils.emptyOrDefault(query.id as string, getWidgetId())
const siyuanPageId = await getSiyuanPageId(id)
formData.pageId = siyuanPageId
if (!StrUtil.isEmptyString(formData.pageId)) {
formData.siyuanPost = await kernelApi.getBlockByID(formData.pageId)
const title = Utils.emptyOrDefault(formData.siyuanPost?.content, formData.pageId)
alertTitle.value = `将对文章「${title}」(${formData.pageId}) 进行修复`
}
const publishCfg = await getPublishCfg()
const setting = publishCfg.setting
Expand Down Expand Up @@ -129,12 +138,7 @@ onMounted(async () => {
:rules="rules"
status-icon
>
<el-alert
class="top-tip"
:title="'将为文章「' + formData.pageId + '」进行修复'"
type="warning"
:closable="false"
/>
<el-alert class="top-tip" :title="alertTitle" type="warning" :closable="false" />
<!-- 动态配置 -->
<div v-if="formData.dynamicConfigArray.length > 0">
<el-form-item
Expand Down

0 comments on commit 5099c12

Please sign in to comment.