From bc7a446808c208d6509649d1edd5e43ff6a9ada9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=90=8C=E8=90=8C=E5=93=92=E8=B5=AB=E8=90=9D?= Date: Mon, 28 Aug 2023 00:47:50 -0700 Subject: [PATCH] :sparkles: Feature: using webview to show manual website --- src/main/apis/app/window/windowList.ts | 1 + src/renderer/layouts/Main.vue | 31 +++----------------------- src/renderer/pages/DocumentPage.vue | 16 +++++++++++++ src/renderer/router/config.ts | 1 + src/renderer/router/index.ts | 5 +++++ 5 files changed, 26 insertions(+), 28 deletions(-) create mode 100644 src/renderer/pages/DocumentPage.vue diff --git a/src/main/apis/app/window/windowList.ts b/src/main/apis/app/window/windowList.ts index 1491ffdf..9d9ce643 100644 --- a/src/main/apis/app/window/windowList.ts +++ b/src/main/apis/app/window/windowList.ts @@ -71,6 +71,7 @@ const settingWindowOptions = { transparent: true, titleBarStyle: 'hidden', webPreferences: { + webviewTag: true, backgroundThrottling: false, nodeIntegration: !!process.env.ELECTRON_NODE_INTEGRATION, contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION, diff --git a/src/renderer/layouts/Main.vue b/src/renderer/layouts/Main.vue index 3d7951f5..a82dc0ce 100644 --- a/src/renderer/layouts/Main.vue +++ b/src/renderer/layouts/Main.vue @@ -124,7 +124,7 @@ {{ $T('PLUGIN_SETTINGS') }} - + @@ -259,7 +259,7 @@ import { } from '@element-plus/icons-vue' // Element Plus 消息框组件 -import { ElMessage as $message, ElMessageBox } from 'element-plus' +import { ElMessage as $message } from 'element-plus' // 国际化函数 import { T as $T } from '@/i18n/index' @@ -299,16 +299,12 @@ import { SHOW_MAIN_PAGE_MENU, SHOW_MAIN_PAGE_QRCODE, SHOW_MAIN_PAGE_DONATION, - GET_PICBEDS, - OPEN_URL + GET_PICBEDS } from '~/universal/events/constants' // 数据发送工具函数 import { getConfig, sendToMain } from '@/utils/dataSender' -// Piclist 配置类型声明 -import { IConfig } from 'piclist' - const version = ref(process.env.NODE_ENV === 'production' ? pkg.version : 'Dev') const routerConfig = reactive(config) const defaultActive = ref(routerConfig.UPLOAD_PAGE) @@ -357,27 +353,6 @@ const handleGetPicPeds = () => { } const handleSelect = (index: string) => { - if (index === 'MANUAL') { - ElMessageBox.confirm($T('OPEN_MANUAL_LINK_HINT'), $T('OPEN_MANUAL_LINK'), { - confirmButtonText: $T('CONFIRM'), - cancelButtonText: $T('CANCEL'), - type: 'warning', - center: true - }).then(async () => { - let language = 'zh-CN' - const config = (await getConfig())! - if (config !== undefined) { - const settings = config.settings || {} - language = settings.language ?? 'zh-CN' - } - if (language === 'zh-CN' || language === 'zh-TW') { - sendToMain(OPEN_URL, 'https://piclist.cn/configure.html') - } else { - sendToMain(OPEN_URL, 'https://piclist.cn/en/configure.html') - } - }).catch(() => {}) - return - } defaultActive.value = index const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE) if (type === null) { diff --git a/src/renderer/pages/DocumentPage.vue b/src/renderer/pages/DocumentPage.vue new file mode 100644 index 00000000..9fc5f4a4 --- /dev/null +++ b/src/renderer/pages/DocumentPage.vue @@ -0,0 +1,16 @@ + + + diff --git a/src/renderer/router/config.ts b/src/renderer/router/config.ts index edac110a..8bf721a7 100644 --- a/src/renderer/router/config.ts +++ b/src/renderer/router/config.ts @@ -15,3 +15,4 @@ export const TOOLBOX_CONFIG_PAGE = 'ToolBoxPage' export const TRAY_PAGE = 'TrayPage' export const UPLOAD_PAGE = 'UploadPage' export const UPLOADER_CONFIG_PAGE = 'UploaderConfigPage' +export const DocumentPage = 'DocumentPage' diff --git a/src/renderer/router/index.ts b/src/renderer/router/index.ts index 37918877..e4d30c34 100644 --- a/src/renderer/router/index.ts +++ b/src/renderer/router/index.ts @@ -79,6 +79,11 @@ export default createRouter({ component: () => import(/* webpackChunkName: "Plugin" */ '@/pages/Plugin.vue'), name: config.PLUGIN_PAGE }, + { + path: 'documents', + component: () => import(/* webpackChunkName: "DocumentPage" */ '@/pages/DocumentPage.vue'), + name: config.DocumentPage + }, { path: 'shortKey', component: () => import(/* webpackChunkName: "ShortkeyPage" */ '@/pages/ShortKey.vue'),