Skip to content

Commit

Permalink
fix: #133 支持Github系列-修复Jekyll平台预览路径问题
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Dec 13, 2022
1 parent 9bdbd19 commit 07e51a7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 29 deletions.
30 changes: 4 additions & 26 deletions components/publish/PublishService.vue
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@
<platform-setting :is-reload="isReloadServiceTab" />
</el-tab-pane>
<el-tab-pane name="post-bind" :label="$t('service.tab.post.bind')">
<PostBind :is-reload="isReloadSettingTab" :page-id="props.pageId" />
<PostBind :is-reload="isReloadServiceTab" :page-id="props.pageId" />
</el-tab-pane>
<el-tab-pane
name="service-switch"
:label="$t('service.tab.service.switch')"
>
<service-switch :is-reload="isReloadServiceSwitchTab" />
<service-switch :is-reload="isReloadServiceTab" />
</el-tab-pane>
<el-tab-pane name="dynamic-platform" :label="$t('dynamic.platform.new')">
<dynamic-platform />
</el-tab-pane>
<el-tab-pane :label="$t('service.tab.change.local')" name="general-setting">
<general-setting :is-reload="isReloadCommonSettingTab" />
<general-setting :is-reload="isReloadServiceTab" />
</el-tab-pane>
</el-tabs>
</template>
Expand All @@ -75,10 +75,6 @@ const logger = LogFactory.getLogger("components/publish/PublishService.vue")
const defaultTab = ref("platform-main")
const isReloadServiceTab = ref(false)
const isReloadSettingTab = ref(false)
const isReloadPostBindTab = ref(false)
const isReloadServiceSwitchTab = ref(false)
const isReloadCommonSettingTab = ref(false)
const props = defineProps({
isReload: {
Expand All @@ -94,25 +90,7 @@ const props = defineProps({
const serviceTabChange = (name) => {
const paneName = name.paneName
logger.debug("serviceTabChange=>", paneName)
if (paneName === "platform-main") {
isReloadServiceTab.value = !isReloadServiceTab.value
}
if (paneName === "platform-setting") {
isReloadSettingTab.value = !isReloadSettingTab.value
}
if (paneName === "post-bind") {
isReloadPostBindTab.value = !isReloadPostBindTab.value
}
if (paneName === "service-switch") {
isReloadServiceSwitchTab.value = !isReloadServiceSwitchTab.value
}
if (paneName === "general-setting") {
isReloadCommonSettingTab.value = !isReloadCommonSettingTab.value
}
isReloadServiceTab.value = !isReloadServiceTab.value
}
</script>

Expand Down
2 changes: 0 additions & 2 deletions components/publish/tab/ServiceSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,6 @@ import {
} from "~/utils/platform/dynamicConfig"
import { LogFactory } from "~/utils/logUtil"
const logger = LogFactory.getLogger("components/publish/tab/ServiceSwitch.vue")
// use
const {
tabCountStore,
Expand Down
7 changes: 6 additions & 1 deletion composables/publish/initPublishCom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,12 @@ export const useInitPublish = (props, deps, otherArgs?) => {
const docPath = githubPagesMethods.getGithubPagesData().publishPath
const categories =
initPublishMethods.convertDocPathToCategories(docPath)
url = url.replace(/\[cats]/, categories.join("/"))
// 处理分类
if (categories.length > 0) {
url = url.replace(/\[cats]/, categories.join("/"))
} else {
url = url.replace(/\/\[cats]/, "")
}
}
initPublishData.previewUrl = pathJoin(home, url)
}
Expand Down
1 change: 1 addition & 0 deletions utils/platform/github/jekyll/jekyllCfg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class JekyllCfg extends GithubCfg {

this.defaultPath = "_posts"
this.posidKey = POSTID_KEY_CONSTANTS.JEKYLL_POSTID_KEY
this.previewMdUrl = "/[user]/[repo]/blob/[branch]/[docpath]"
this.previewUrl = "/[cats]/[yyyy]/[mm]/[dd]/[postid].html"
this.mdFilenameRule = "[yyyy]-[mm]-[dd]-[slug].md"
}
Expand Down

0 comments on commit 07e51a7

Please sign in to comment.