支持自定义表格字段值

This commit is contained in:
tangly1024.com
2023-02-13 18:29:29 +08:00
parent 768c259d9d
commit d3255ae625
2 changed files with 26 additions and 3 deletions

View File

@@ -69,10 +69,28 @@ export default async function getPageProperties(id, block, schema, authToken, ta
})
}
// type\status是下拉选框 取数组第一个
properties.type = properties.type?.[0]
properties.status = properties.status?.[0]
if (properties.type === 'Post') {
// 映射值用户个性化type和status字段后在此映射回代码的英文标识
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
properties.type = 'Post'
}
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_page) {
properties.type = 'Page'
}
if (properties?.type === BLOG.NOTION_PROPERTY_NAME.type_notice) {
properties.type = 'Notice'
}
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_publish) {
properties.status = 'Published'
}
if (properties?.status === BLOG.NOTION_PROPERTY_NAME.status_invisible) {
properties.status = 'Invisible'
}
if (properties.type === BLOG.NOTION_PROPERTY_NAME.type_post) {
properties.slug = BLOG.POST_URL_PREFIX ? (BLOG.POST_URL_PREFIX + '/' + (properties.slug ?? properties.id)) : (properties.slug ?? properties.id)
} else {
properties.slug = (properties.slug ?? properties.id)