Skip to content

Commit

Permalink
feat: 新增支持细粒度配置的常规发布-平台选择
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Aug 2, 2023
1 parent a0a1b64 commit 2c8c47c
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 35 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@
"vue-router": "^4.2.4",
"xmlbuilder2": "^3.1.1",
"zhi-blog-api": "^1.20.1",
"zhi-common": "^1.11.5",
"zhi-common": "^1.11.6",
"zhi-device": "^2.3.0",
"zhi-fetch-middleware": "^0.2.5",
"zhi-github-middleware": "^0.1.2",
"zhi-fetch-middleware": "^0.2.6",
"zhi-github-middleware": "^0.1.3",
"zhi-lib-base": "^0.4.2",
"zhi-siyuan-api": "^1.29.0",
"zhi-xmlrpc-middleware": "^0.4.0"
"zhi-siyuan-api": "^1.29.1",
"zhi-xmlrpc-middleware": "^0.4.1"
}
}
48 changes: 24 additions & 24 deletions pnpm-lock.yaml

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

26 changes: 20 additions & 6 deletions src/components/publish/SinglePublishSelectPlatform.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { onMounted, reactive } from "vue"
import { useVueI18n } from "~/src/composables/useVueI18n.ts"
import { useRouter } from "vue-router"
import { createAppLogger } from "~/src/utils/appLogger.ts"
import { DynamicConfig, DynamicJsonCfg } from "~/src/components/set/publish/platform/dynamicConfig.ts"
import { HtmlUtil, JsonUtil } from "zhi-common"
import { DynamicConfig, DynamicJsonCfg, getDynPostidKey } from "~/src/components/set/publish/platform/dynamicConfig.ts"
import { HtmlUtil, JsonUtil, StrUtil } from "zhi-common"
import { DYNAMIC_CONFIG_KEY } from "~/src/utils/constants.ts"
import { useSettingStore } from "~/src/stores/useSettingStore.ts"
Expand All @@ -51,6 +51,8 @@ const { getSetting } = useSettingStore()
// datas
const formData = reactive({
dynamicConfigArray: [] as DynamicConfig[],
postMeta: {} as any,
})
// methods
Expand All @@ -66,10 +68,18 @@ const handleSingleDoPublish = (key: string) => {
router.push(query)
}
const checkHasPublished = (key: string) => {
const postidKey = getDynPostidKey(key)
const postMetaValue = formData.postMeta[postidKey]
return !StrUtil.isEmptyString(postMetaValue)
}
const initPage = async () => {
const setting = await getSetting()
const dynJsonCfg = JsonUtil.safeParse<DynamicJsonCfg>(setting[DYNAMIC_CONFIG_KEY], {} as DynamicJsonCfg)
formData.dynamicConfigArray = dynJsonCfg?.totalCfg || []
formData.postMeta = setting[props.id]
}
onMounted(async () => {
Expand All @@ -86,20 +96,24 @@ onMounted(async () => {

<el-row :gutter="20" class="row-box">
<el-col
:span="12"
:span="8"
:title="cfg.platformName"
class="platform-select-card"
v-for="cfg in formData.dynamicConfigArray"
@click="handleSingleDoPublish(cfg.platformKey)"
>
<el-card class="card-item">
<div class="icon-list">
<el-badge type="danger" value="未发布" class="item">
<el-badge
:type="checkHasPublished(cfg.platformKey) ? 'success' : 'danger'"
:value="checkHasPublished(cfg.platformKey) ? '已发布' : '未发布'"
class="item"
>
<el-text class="define-item">
<i class="el-icon">
<span v-html="cfg?.platformIcon"></span>
</i>
{{ HtmlUtil.parseHtml(cfg.platformName, 12) }}
{{ HtmlUtil.parseHtml(cfg.platformName, 11) }}
</el-text>
</el-badge>
</div>
Expand Down Expand Up @@ -135,7 +149,7 @@ $icon_size = 32px
font-weight 600
margin-bottom 12px
.icon-list
text-align center
text-align left
gap 10px
.define-item
color var(--el-color-primary)
Expand Down

0 comments on commit 2c8c47c

Please sign in to comment.