Skip to content

Commit

Permalink
feat: #341 整合所有配置,提供单一统一的配置入口页面-功能菜单调整
Browse files Browse the repository at this point in the history
  • Loading branch information
terwer committed Feb 8, 2023
1 parent 7c8b3f3 commit 29106e3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 84 deletions.
2 changes: 2 additions & 0 deletions components/detail/PostDetailService.vue
Expand Up @@ -73,6 +73,7 @@

<!-- 管理图片 -->
<el-tooltip
v-if="false"
class="box-item"
effect="dark"
:content="$t('post.detail.button.pic.manage')"
Expand All @@ -85,6 +86,7 @@

<!-- 管理Anki -->
<el-tooltip
v-if="false"
class="box-item"
effect="dark"
:content="$t('post.detail.button.anki.mark')"
Expand Down
103 changes: 19 additions & 84 deletions layouts/default/DefaultFooter.vue
Expand Up @@ -36,27 +36,12 @@
}}</span>

<span class="text">.</span>
<span class="text s-dark" @click="changeSiyuanApi()">
{{ $t("blog.change.siyuan.api") }}
<span class="text s-dark">
{{ $t("setting.conf.transport") }}
</span>

<span class="text">.</span>
<span class="text s-dark" @click="exportConfig()">
{{ $t("setting.conf.export") }}
</span>

<span class="text">.</span>
<span class="text s-dark" @click="importConfig()">
{{ $t("setting.conf.import") }}
</span>

<span class="text">.</span>
<span class="text s-dark" @click="clearConfig()">
{{ $t("setting.conf.clear") }}
</span>

<span class="text">.</span>
<span class="text s-dark" @click="newWin()">
<span class="text" v-if="isChrome">.</span>
<span class="text s-dark" @click="newWin()" v-if="isChrome">
{{ $t("blog.newwin.open") }}
</span>

Expand All @@ -69,31 +54,10 @@
-----------------------------------------------------------------------------
-->
<!-- 思源地址设置弹窗 -->
<el-dialog
v-model="siyuanApiChangeFormVisible"
:title="$t('blog.change.siyuan.api')"
>
<siyuan-api-setting
@on-change="
() => {
siyuanApiChangeFormVisible = false
}
"
:show-cancel="true"
/>
</el-dialog>

<!-- 导入选择弹窗 -->
<el-dialog
v-model="settingImportFormVisible"
:title="$t('setting.conf.export')"
>
<transport-select />
</el-dialog>

<!-- 导出选择弹窗 -->
<!-- 导出导出弹窗 -->
<el-dialog
v-model="settingExportFormVisible"
v-model="transportFormVisible"
:title="$t('setting.conf.import')"
>
<transport-select />
Expand All @@ -114,33 +78,28 @@
<script lang="ts" setup>
import { useDark, useToggle } from "@vueuse/core"
import { onMounted, ref } from "vue"
import { ElMessage, ElMessageBox } from "element-plus"
import { useI18n } from "vue-i18n"
import { LogFactory } from "~/utils/logUtil"
import { isInSiyuanWidget } from "~/utils/platform/siyuan/siyuanUtil"
import { goToPage } from "~/utils/otherlib/ChromeUtil"
import { clearConf } from "~/utils/configUtil"
import { version } from "../../package.json"
import { isBrowser, reloadPage } from "~/utils/browserUtil"
import { isBrowser } from "~/utils/browserUtil"
import { nowYear } from "~/utils/dateUtil"
import SetIndex from "~/components/set/SetIndex.vue"
import SiyuanApiSetting from "~/components/set/siyuanApiSetting.vue"
import TransportSelect from "~/components/transport/TransportSelect.vue"
import { DeviceType, DeviceUtil } from "~/utils/deviceUtil"
const logger = LogFactory.getLogger("layouts/default/DefaultFooter")
const { t } = useI18n()
const isDark = useDark()
const toggleDark = useToggle(isDark)
const v = ref("0.0.3")
const siyuanApiChangeFormVisible = ref(false)
const settingImportFormVisible = ref(false)
const settingExportFormVisible = ref(false)
const transportFormVisible = ref(false)
const generalSettingFormVisible = ref(false)
const isChrome = ref(false)
const goGithub = () => {
window.open("https://github.com/terwer/src-sy-post-publisher")
}
Expand All @@ -153,40 +112,16 @@ const openGeneralSetting = () => {
generalSettingFormVisible.value = true
}
const exportConfig = () => {
settingExportFormVisible.value = true
}
const importConfig = async () => {
settingImportFormVisible.value = true
}
const clearConfig = () => {
ElMessageBox.confirm(t("main.opt.warning.tip"), t("main.opt.warning"), {
confirmButtonText: t("main.opt.ok"),
cancelButtonText: t("main.opt.cancel"),
type: "warning",
})
.then(async () => {
clearConf()
reloadPage()
ElMessage.success(t("main.opt.success"))
})
.catch(() => {
// ElMessage({
// type: 'error',
// message: t("main.opt.failure"),
// })
})
}
const changeSiyuanApi = () => {
siyuanApiChangeFormVisible.value = true
}
const initConf = () => {
v.value = version
const deviceType = DeviceUtil.getDevice()
if (
deviceType === DeviceType.DeviceType_Chrome_Extension ||
deviceType === DeviceType.DeviceType_Chrome_Browser
) {
isChrome.value = true
}
}
onMounted(() => {
Expand Down
1 change: 1 addition & 0 deletions locales/en_US.ts
Expand Up @@ -276,6 +276,7 @@ export default {
"setting.blog.siyuan.current.apiurl": "Current apiUrl=>",
"setting.conf.export": "Export config",
"setting.conf.import": "Import config",
"setting.conf.transport": "Transport",
"setting.conf.clear": "Clear config",
"page.no.id": "pageId fetch error",
"main.read.mode": "Readonly",
Expand Down
1 change: 1 addition & 0 deletions locales/zh_CN.ts
Expand Up @@ -282,6 +282,7 @@ export default {
"如果没有部署代理,可以使用我的共享地址:https://api.terwer.space/api/middleware 。出于性能考虑,建议自己部署一份,请使用 https://github.com/terwer/node-metaweblog-api-adaptor 此项目进行部署。",
"setting.conf.export": "导出配置",
"setting.conf.import": "导入配置",
"setting.conf.transport": "导入导出",
"setting.conf.clear": "清空配置",
"page.no.id": "请求非法,原因:pageId获取失败",
"yaml.show.type.yaml": "YAML",
Expand Down

0 comments on commit 29106e3

Please sign in to comment.