diff --git a/src/assets/style.css b/src/assets/style.css
index 3a008d5..26f4275 100644
--- a/src/assets/style.css
+++ b/src/assets/style.css
@@ -123,10 +123,6 @@ code {
background-color: #ffffff;
}
-.top-version-tip {
- margin: 10px 0 !important;
-}
-
.el-header {
--el-header-padding: 0 20px;
--el-header-height: 20px !important;
diff --git a/src/components/publish/form/PublishTips.vue b/src/components/publish/form/PublishTips.vue
index ae41d83..551eaeb 100644
--- a/src/components/publish/form/PublishTips.vue
+++ b/src/components/publish/form/PublishTips.vue
@@ -27,7 +27,7 @@
-
+
diff --git a/src/components/set/PublishSetting.vue b/src/components/set/PublishSetting.vue
index 77ceb38..ce5e4d4 100644
--- a/src/components/set/PublishSetting.vue
+++ b/src/components/set/PublishSetting.vue
@@ -26,7 +26,7 @@
-
-
-
+
+
+
-
-
+
+
+
-
+
{{ formData.dynCfg.platformKey }}
+
+
+
+
-
-
+
+
-
+
@@ -117,4 +234,8 @@ const submitForm = async (formEl) => {
-
+
diff --git a/src/components/set/publish/PlatformQuickAdd.vue b/src/components/set/publish/PlatformQuickAdd.vue
index f00daf6..fb96367 100644
--- a/src/components/set/publish/PlatformQuickAdd.vue
+++ b/src/components/set/publish/PlatformQuickAdd.vue
@@ -48,22 +48,24 @@ const formData = reactive({
})
// methods
-const handleAddPlatform = () => {
+const handleAddPlatform = (cfg?: DynamicConfig) => {
const type = params.type
- router.push({
+ const query = {
path: `/setting/platform/add/${type}`,
query: {
showBack: "true",
+ key: cfg?.platformKey,
+ sub: cfg?.subPlatformType,
},
- })
+ }
+
+ router.push(query)
}
const initPage = () => {
const type = params.type as PlatformType
formData.ptype = getPlatformType(type)
formData.pre = getPrePlatformList(type)
-
- console.log("formDta=>", formData)
}
initPage()
@@ -80,7 +82,7 @@ initPage()
-
+
@@ -89,7 +91,9 @@ initPage()
- 添加自定义通用平台对接
+
+ 添加自定义 {{ formData.ptype.title }} 对接
+
diff --git a/src/components/set/publish/platform/dynamicConfig.ts b/src/components/set/publish/platform/dynamicConfig.ts
index f299630..82cb5a9 100644
--- a/src/components/set/publish/platform/dynamicConfig.ts
+++ b/src/components/set/publish/platform/dynamicConfig.ts
@@ -28,16 +28,6 @@ import idUtil from "~/src/utils/idUtil.ts"
import { StrUtil } from "zhi-common"
export class DynamicConfig {
- /**
- * 用于文章绑定的临时变量
- */
- posid?: any
-
- /**
- * 用于平台开关的临时变量
- */
- modelValue?: any
-
/**
* 动态平台类型(通用类型)
*/
@@ -92,7 +82,8 @@ export class DynamicConfig {
platformKey: string,
platformName: string,
subPlatformType?: SubPlatformType,
- platformIcon?: string
+ platformIcon?: string,
+ yamlConverter?: YamlConvertAdaptor
) {
this.platformType = platformType
this.platformKey = platformKey
@@ -103,6 +94,7 @@ export class DynamicConfig {
this.subPlatformType = subPlatformType
this.platformIcon = platformIcon
+ this.yamlConverter = yamlConverter
}
}
@@ -151,6 +143,11 @@ export enum PlatformType {
* @author terwer
*/
export enum SubPlatformType {
+ // Common
+ Common_Zhihu = "Zhihu",
+ Common_CSDN = "CSDN",
+ Common_Yuque = "Yuque",
+
// Github 子平台
Github_Hugo = "Hugo",
Github_Hexo = "Hexo",
@@ -160,15 +157,16 @@ export enum SubPlatformType {
Github_Nuxt = "Nuxt",
Github_Next = "Next",
- // Common
- Common_Zhihu = "Zhihu",
- Common_CSDN = "CSDN",
- Common_Yuque = "Yuque",
-
// Metaweblog
Metaweblog_Cnblogs = "Cnblogs",
Metaweblog_Typecho = "Typecho",
+ // WordPress
+ Wordpress_Wordpress = "Wordpress",
+
+ // Custom
+ Custom_Custom = "Custom",
+
NONE = "none",
}
@@ -177,9 +175,11 @@ export enum SubPlatformType {
*/
export interface DynamicJsonCfg {
totalCfg: DynamicConfig[]
+ commonCfg: DynamicConfig[]
githubCfg: DynamicConfig[]
metaweblogCfg: DynamicConfig[]
wordpressCfg: DynamicConfig[]
+ customCfg: DynamicConfig[]
}
/**
@@ -189,25 +189,30 @@ export function getSubtypeList(ptype: PlatformType): SubPlatformType[] {
const subtypeList: SubPlatformType[] = []
switch (ptype) {
+ case PlatformType.Common:
+ subtypeList.push(SubPlatformType.Common_Zhihu)
+ subtypeList.push(SubPlatformType.Common_CSDN)
+ subtypeList.push(SubPlatformType.Common_Yuque)
+ break
case PlatformType.Github:
- subtypeList.push(SubPlatformType.Github_Hugo)
subtypeList.push(SubPlatformType.Github_Hexo)
+ subtypeList.push(SubPlatformType.Github_Hugo)
subtypeList.push(SubPlatformType.Github_Jekyll)
- // subtypeList.push(SubPlatformType.Github_giteePages)
- // subtypeList.push(SubPlatformType.Github_codingPages)
subtypeList.push(SubPlatformType.Github_Vuepress)
subtypeList.push(SubPlatformType.Github_Vitepress)
subtypeList.push(SubPlatformType.Github_Nuxt)
subtypeList.push(SubPlatformType.Github_Next)
break
- case PlatformType.Common:
- subtypeList.push(SubPlatformType.Common_Zhihu)
- subtypeList.push(SubPlatformType.Common_CSDN)
- subtypeList.push(SubPlatformType.Common_Yuque)
- break
case PlatformType.Metaweblog:
+ subtypeList.push(SubPlatformType.Metaweblog_Cnblogs)
subtypeList.push(SubPlatformType.Metaweblog_Typecho)
break
+ case PlatformType.Wordpress:
+ subtypeList.push(SubPlatformType.Wordpress_Wordpress)
+ break
+ case PlatformType.Custom:
+ subtypeList.push(SubPlatformType.Custom_Custom)
+ break
default:
break
}
@@ -222,13 +227,18 @@ export function getSubtypeList(ptype: PlatformType): SubPlatformType[] {
*/
export function setDynamicJsonCfg(dynamicConfigArray: DynamicConfig[]): DynamicJsonCfg {
const totalCfg: DynamicConfig[] = dynamicConfigArray
+ const commonCfg: DynamicConfig[] = []
const githubCfg: DynamicConfig[] = []
const metaweblogCfg: DynamicConfig[] = []
const wordpressCfg: DynamicConfig[] = []
+ const customCfg: DynamicConfig[] = []
// 按照类型组装便于后面数据使用
totalCfg.forEach((item) => {
switch (item.platformType) {
+ case PlatformType.Common:
+ commonCfg.push(item)
+ break
case PlatformType.Github:
githubCfg.push(item)
break
@@ -238,6 +248,9 @@ export function setDynamicJsonCfg(dynamicConfigArray: DynamicConfig[]): DynamicJ
case PlatformType.Wordpress:
wordpressCfg.push(item)
break
+ case PlatformType.Custom:
+ customCfg.push(item)
+ break
default:
break
}
@@ -245,9 +258,11 @@ export function setDynamicJsonCfg(dynamicConfigArray: DynamicConfig[]): DynamicJ
const dynamicJsonCfg: DynamicJsonCfg = {
totalCfg,
+ commonCfg,
githubCfg,
metaweblogCfg,
wordpressCfg,
+ customCfg
}
return dynamicJsonCfg
@@ -289,25 +304,6 @@ export function isDynamicKeyExists(dynamicConfigArray: DynamicConfig[], key: str
return flag
}
-/**
- * 生成默认的平台名
- * @param ptype 平台
- * @param subtype 子平台
- * @param isShowSubtype 是否显示子平台
- */
-export function getDefaultPlatformName(ptype: PlatformType, subtype: SubPlatformType, isShowSubtype: boolean): string {
- if (PlatformType.Github === ptype && SubPlatformType.NONE === subtype) {
- return ""
- }
-
- let pname: string = ptype
- if (isShowSubtype) {
- pname = subtype
- }
- pname = pname + "-1"
- return pname
-}
-
// =====================
// 动态平台开关key规则
// =====================
diff --git a/src/locales/zh_CN.ts b/src/locales/zh_CN.ts
index 67098d2..81a4d59 100644
--- a/src/locales/zh_CN.ts
+++ b/src/locales/zh_CN.ts
@@ -250,7 +250,7 @@ export default {
"setting.common.password": "密码",
"setting.blog.platform.support.common": "您当前操作的平台是:",
"platform.must.select.one":
- "哇哦,离使用就差一步啦 o(╥﹏╥)o ,您必须启用至少一个平台。如果上面列出的平台没有你想要的,可以在新增平台动态添加,支持Wordpress和Metaweblog API(例如博客园、oschina、51cto等)。有任何疑问欢迎邮件 youweics#163.com ",
+ "哇哦,离使用就差一步啦 o(╥﹏╥)o ,您必须添加并启用至少一个平台。如果列出的平台没有你想要的,可以点击新增按钮添加。有任何疑问欢迎邮件 youweics#163.com ",
"blog.list.toptip": "温馨提示:单击表格行可以进入文章详情页,详情页有发布按钮哦! (〃'▽'〃)",
"config.error.msg": "配置错误,请前往对应发布配置修改",
"config.platform.none": "没有启用的发布平台,请前往服务开关开启",
diff --git a/src/utils/import/pre.ts b/src/utils/import/pre.ts
index f8ae884..6cd2944 100644
--- a/src/utils/import/pre.ts
+++ b/src/utils/import/pre.ts
@@ -1,4 +1,9 @@
-import { DynamicConfig, PlatformType, SubPlatformType } from "~/src/components/set/publish/platform/dynamicConfig.ts"
+import {
+ AuthMode,
+ DynamicConfig,
+ PlatformType,
+ SubPlatformType,
+} from "~/src/components/set/publish/platform/dynamicConfig.ts"
import { svgIcons } from "~/src/utils/svgIcons.ts"
export const pre = {
@@ -9,6 +14,8 @@ export const pre = {
platformKey: "commonZhihu-1u5c1v",
platformName: "知乎",
platformIcon: svgIcons.iconIFZhihu,
+ authMode: AuthMode.WEBSITE,
+ isEnabled: false
},
],
githubCfg: [
@@ -47,20 +54,20 @@ export const pre = {
subPlatformType: SubPlatformType.Metaweblog_Cnblogs,
platformKey: "Cnblogs",
platformName: "Cnblogs",
- platformIcon: svgIcons.iconIFCnblogs
+ platformIcon: svgIcons.iconIFCnblogs,
},
{
platformType: PlatformType.Metaweblog,
subPlatformType: SubPlatformType.Metaweblog_Typecho,
platformKey: "metaweblog-22pamt",
platformName: "Typecho",
- platformIcon: svgIcons.iconIFTypecho
+ platformIcon: svgIcons.iconIFTypecho,
},
],
wordpressCfg: [
{
platformType: PlatformType.Wordpress,
- subPlatformType: SubPlatformType.NONE,
+ subPlatformType: SubPlatformType.Wordpress_Wordpress,
platformKey: "Wordpress",
platformName: "Wordpress",
platformIcon: svgIcons.iconIFWordpress,