Skip to content

Commit

Permalink
feat: 支持文章分类-多选分类
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 18, 2023
1 parent 8b9076e commit 3d031b9
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 57 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@
"vue-i18n": "^9.2.2",
"vue-router": "^4.2.4",
"xmlbuilder2": "^3.1.1",
"zhi-blog-api": "^1.26.0",
"zhi-blog-api": "^1.27.0",
"zhi-common": "^1.20.0",
"zhi-device": "^2.3.1",
"zhi-fetch-middleware": "^0.2.29",
"zhi-github-middleware": "^0.2.9",
"zhi-lib-base": "^0.4.4",
"zhi-notion-markdown": "^0.1.4",
"zhi-siyuan-api": "^2.3.1",
"zhi-siyuan-api": "^2.3.2",
"zhi-xmlrpc-middleware": "^0.4.23"
}
}
20 changes: 10 additions & 10 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/adaptors/api/cnblogs/useCnblogsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { AppInstance } from "~/src/appInstance.ts"
import { useSettingStore } from "~/src/stores/useSettingStore.ts"
import { JsonUtil, ObjectUtil, StrUtil } from "zhi-common"
import { getDynPostidKey } from "~/src/platforms/dynamicConfig.ts"
import { CategoryTypeEnum } from "zhi-blog-api"

/**
* 使用Cnblogs API的自定义hook
Expand Down Expand Up @@ -86,6 +87,10 @@ export const useCnblogsApi = async (key?: string, newCfg?: CnblogsConfig) => {
}
}

// 知乎使用单选分类作为专栏
cfg.categoryType = CategoryTypeEnum.CategoryType_Multi
cfg.cateAllowChange = true

// 创建Cnblogs API适配器
const blogApi = new CnblogsApiAdaptor(appInstance, cfg)

Expand Down
1 change: 1 addition & 0 deletions src/adaptors/api/yuque/useYuqueApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ const useYuqueApi = async (key: string, newCfg?: YuqueConfig) => {

// Yuque 使用单选分类作为知识空间
cfg.categoryType = CategoryTypeEnum.CategoryType_Single
cfg.cateAllowChange = false
// 启用知识库作为分类
cfg.enableKnowledgeSpace = true
cfg.placeholder.cateReadonlyModeTip =
Expand Down
1 change: 1 addition & 0 deletions src/adaptors/web/zhihu/useZhihuWeb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const useZhihuWeb = async (key?: string, newCfg?: ZhihuConfig) => {

// 知乎使用单选分类作为专栏
cfg.categoryType = CategoryTypeEnum.CategoryType_Single
cfg.cateAllowChange = false
// 启用专栏作为分类
cfg.enableKnowledgeSpace = true
cfg.placeholder.cateReadonlyModeTip =
Expand Down
2 changes: 1 addition & 1 deletion src/components/publish/SinglePublishDoPublish.vue
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ onMounted(async () => {
const cfg = formData.publishCfg.cfg as BlogConfig
formData.categoryConfig = {
cateEnabled: true,
readonlyMode: formData.method === MethodEnum.METHOD_EDIT,
readonlyMode: formData.method === MethodEnum.METHOD_EDIT && !cfg.cateAllowChange,
readonlyModeTip: cfg.placeholder.cateReadonlyModeTip,
apiType: key,
cfg: cfg,
Expand Down
3 changes: 0 additions & 3 deletions src/components/publish/form/PublishCategories.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,5 @@ const syncPubCates = (cates: string[], cateSlugs: string[]) => {
<div v-else-if="formData.categoryType === CategoryTypeEnum.CategoryType_Tree_Single">
<tree-single-category v-model:category-config="formData.categoryConfig as ITreeSingleCategoryConfig" />
</div>
<div v-else-if="formData.categoryType === CategoryTypeEnum.CategoryType_Tree_Multi">
<tree-multi-categories v-model:category-config="formData.categoryConfig as ITreeMultiCategoriesConfig" />
</div>
<div v-else></div>
</template>
41 changes: 0 additions & 41 deletions src/components/publish/form/category/TreeMultiCategories.vue

This file was deleted.

0 comments on commit 3d031b9

Please sign in to comment.