Skip to content

Commit

Permalink
feat:#85 Google插件扩展-数据适配
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Sep 25, 2022
1 parent e1b449c commit 83a3693
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 11 deletions.
8 changes: 6 additions & 2 deletions src/components/tab/main/CommonBlogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,10 @@ const initPage = async () => {
siyuanData.pageId = pageId;
siyuanData.meta = await getPageAttrs(pageId)
const page = await getPage(pageId)
if (!page) {
ElMessage.error(t('config.error.msg') + "_" + props.apiType)
throw new Error(t('config.error.msg') + "_" + props.apiType)
}
logUtil.logInfo("CommonblogMain初始化页面,meta=>", siyuanData.meta);
// 表单数据
Expand Down Expand Up @@ -498,7 +502,7 @@ const doPublish = async () => {
let content = md
if (PageType.Html == commonblogCfg.pageType) {
content = mdToHtml(md)
}else{
} else {
content = removeMdWidgetTag(content)
}
// ===============================
Expand Down Expand Up @@ -614,7 +618,7 @@ export default {
</script>

<style scoped>
.common-main{
.common-main {
padding: 0;
}
</style>
7 changes: 6 additions & 1 deletion src/components/tab/main/MetaweblogMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@
</el-form-item>
</el-form>
</el-main>
<el-skeleton :loading="isInitLoadding" :rows="5" animated />
<el-skeleton :loading="isInitLoadding" :rows="5" animated/>
</el-container>
</template>

Expand Down Expand Up @@ -282,6 +282,11 @@ const initPage = async () => {
siyuanData.pageId = pageId;
siyuanData.meta = await getPageAttrs(pageId)
const page = await getPage(pageId)
if (!page) {
isInitLoadding.value = false
ElMessage.error(t('config.error.msg') + "_" + props.apiType)
throw new Error(t('config.error.msg') + "_" + props.apiType)
}
logUtil.logInfo("MetaweblogMain初始化页面,meta=>", siyuanData.meta);
// 表单数据
Expand Down
6 changes: 3 additions & 3 deletions src/components/tab/main/VuepressMain.vue
Original file line number Diff line number Diff line change
Expand Up @@ -322,8 +322,8 @@ async function initPage() {
}
const page = await getPage(pageId)
if (!page) {
ElMessage.error("网络异常,数据获取失败")
throw new Error("网络异常,数据获取失败")
ElMessage.error(t('config.error.msg') + "_vuepress")
throw new Error(t('config.error.msg') + "_vuepress")
}
logUtil.logInfo("VuepressMain获取主文档", page)
Expand Down Expand Up @@ -846,7 +846,7 @@ export default {
</script>

<style scoped>
.p-aside{
.p-aside {
overflow-x: hidden;
}
</style>
6 changes: 3 additions & 3 deletions src/lib/platform/metaweblog/CustomMetaweblogApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class CustomMetaWeblogApi {
// 错误处理
this.doFault(ret)

let retStr = ret.params.param.value.string || ""
let retStr = ret.params.param.value.string || ret.params.param.value || ""
logUtil.logInfo("newPost retStr=>", retStr.toString())

return retStr.toString();
Expand All @@ -224,7 +224,7 @@ export class CustomMetaWeblogApi {
// 错误处理
this.doFault(ret)

let retBool = ret.params.param.value.boolean || ""
let retBool = ret.params.param.value.boolean || ret.params.param.value || 0
logUtil.logInfo("editPost retBool=>", retBool)

return retBool;
Expand All @@ -237,7 +237,7 @@ export class CustomMetaWeblogApi {
// 错误处理
this.doFault(ret)

let retBool = ret.params.param.value.boolean || ""
let retBool = ret.params.param.value.boolean || ret.params.param.value || 0
logUtil.logInfo("deletePost retBool=>", retBool)

return retBool;
Expand Down
3 changes: 2 additions & 1 deletion src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,5 +173,6 @@ export default {
"setting.common.password":"Password",
"setting.blog.platform.support.common": "Current platform:",
"plantform.must.select.one": "You must enable at least one plantform",
"blog.list.toptip": "Reminder: Click the table line to enter the article details page. The details page has the release button! (〃'▽'〃)"
"blog.list.toptip": "Reminder: Click the table line to enter the article details page. The details page has the release button! (〃'▽'〃)",
"config.error.msg": "Network or config error, no data fetched"
}
3 changes: 2 additions & 1 deletion src/locales/zh_CN.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,5 +176,6 @@ export default {
"setting.common.password": "密码",
"setting.blog.platform.support.common": "您当前操作的平台是:",
"plantform.must.select.one": "哇哦,离使用就差一步啦 o(╥﹏╥)o ,您必须启用至少一个平台。如果上面列出的平台没有你想要的,可以在新增平台动态添加,支持Wordpress和Metaweblog API(例如博客园、oschina、51cto等)。有任何疑问欢迎邮件 youweics@163.com (*^▽^*)",
"blog.list.toptip": "温馨提示:单击表格行可以进入文章详情页,详情页有发布按钮哦! (〃'▽'〃)"
"blog.list.toptip": "温馨提示:单击表格行可以进入文章详情页,详情页有发布按钮哦! (〃'▽'〃)",
"config.error.msg": "网络异常或者配置错误,数据获取失败"
}

0 comments on commit 83a3693

Please sign in to comment.