mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
✨ Feature: using webview to show manual website
This commit is contained in:
parent
636596a984
commit
bc7a446808
@ -71,6 +71,7 @@ const settingWindowOptions = {
|
|||||||
transparent: true,
|
transparent: true,
|
||||||
titleBarStyle: 'hidden',
|
titleBarStyle: 'hidden',
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
|
webviewTag: true,
|
||||||
backgroundThrottling: false,
|
backgroundThrottling: false,
|
||||||
nodeIntegration: !!process.env.ELECTRON_NODE_INTEGRATION,
|
nodeIntegration: !!process.env.ELECTRON_NODE_INTEGRATION,
|
||||||
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
|
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION,
|
||||||
|
@ -124,7 +124,7 @@
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
<span>{{ $T('PLUGIN_SETTINGS') }}</span>
|
<span>{{ $T('PLUGIN_SETTINGS') }}</span>
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
<el-menu-item index="MANUAL">
|
<el-menu-item :index="routerConfig.DocumentPage">
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<Link />
|
<Link />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
@ -259,7 +259,7 @@ import {
|
|||||||
} from '@element-plus/icons-vue'
|
} from '@element-plus/icons-vue'
|
||||||
|
|
||||||
// Element Plus 消息框组件
|
// Element Plus 消息框组件
|
||||||
import { ElMessage as $message, ElMessageBox } from 'element-plus'
|
import { ElMessage as $message } from 'element-plus'
|
||||||
|
|
||||||
// 国际化函数
|
// 国际化函数
|
||||||
import { T as $T } from '@/i18n/index'
|
import { T as $T } from '@/i18n/index'
|
||||||
@ -299,16 +299,12 @@ import {
|
|||||||
SHOW_MAIN_PAGE_MENU,
|
SHOW_MAIN_PAGE_MENU,
|
||||||
SHOW_MAIN_PAGE_QRCODE,
|
SHOW_MAIN_PAGE_QRCODE,
|
||||||
SHOW_MAIN_PAGE_DONATION,
|
SHOW_MAIN_PAGE_DONATION,
|
||||||
GET_PICBEDS,
|
GET_PICBEDS
|
||||||
OPEN_URL
|
|
||||||
} from '~/universal/events/constants'
|
} from '~/universal/events/constants'
|
||||||
|
|
||||||
// 数据发送工具函数
|
// 数据发送工具函数
|
||||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||||
|
|
||||||
// Piclist 配置类型声明
|
|
||||||
import { IConfig } from 'piclist'
|
|
||||||
|
|
||||||
const version = ref(process.env.NODE_ENV === 'production' ? pkg.version : 'Dev')
|
const version = ref(process.env.NODE_ENV === 'production' ? pkg.version : 'Dev')
|
||||||
const routerConfig = reactive(config)
|
const routerConfig = reactive(config)
|
||||||
const defaultActive = ref(routerConfig.UPLOAD_PAGE)
|
const defaultActive = ref(routerConfig.UPLOAD_PAGE)
|
||||||
@ -357,27 +353,6 @@ const handleGetPicPeds = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const handleSelect = (index: string) => {
|
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<IConfig>())!
|
|
||||||
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
|
defaultActive.value = index
|
||||||
const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE)
|
const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE)
|
||||||
if (type === null) {
|
if (type === null) {
|
||||||
|
16
src/renderer/pages/DocumentPage.vue
Normal file
16
src/renderer/pages/DocumentPage.vue
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<template>
|
||||||
|
<webview
|
||||||
|
src="https://piclist.cn/app.html"
|
||||||
|
disablewebsecurity
|
||||||
|
allowpopups
|
||||||
|
autosize="on"
|
||||||
|
scrollbars="none"
|
||||||
|
style="width: 100%; height: 100%;"
|
||||||
|
/>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
name: 'DocumentPage'
|
||||||
|
}
|
||||||
|
</script>
|
@ -15,3 +15,4 @@ export const TOOLBOX_CONFIG_PAGE = 'ToolBoxPage'
|
|||||||
export const TRAY_PAGE = 'TrayPage'
|
export const TRAY_PAGE = 'TrayPage'
|
||||||
export const UPLOAD_PAGE = 'UploadPage'
|
export const UPLOAD_PAGE = 'UploadPage'
|
||||||
export const UPLOADER_CONFIG_PAGE = 'UploaderConfigPage'
|
export const UPLOADER_CONFIG_PAGE = 'UploaderConfigPage'
|
||||||
|
export const DocumentPage = 'DocumentPage'
|
||||||
|
@ -79,6 +79,11 @@ export default createRouter({
|
|||||||
component: () => import(/* webpackChunkName: "Plugin" */ '@/pages/Plugin.vue'),
|
component: () => import(/* webpackChunkName: "Plugin" */ '@/pages/Plugin.vue'),
|
||||||
name: config.PLUGIN_PAGE
|
name: config.PLUGIN_PAGE
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: 'documents',
|
||||||
|
component: () => import(/* webpackChunkName: "DocumentPage" */ '@/pages/DocumentPage.vue'),
|
||||||
|
name: config.DocumentPage
|
||||||
|
},
|
||||||
{
|
{
|
||||||
path: 'shortKey',
|
path: 'shortKey',
|
||||||
component: () => import(/* webpackChunkName: "ShortkeyPage" */ '@/pages/ShortKey.vue'),
|
component: () => import(/* webpackChunkName: "ShortkeyPage" */ '@/pages/ShortKey.vue'),
|
||||||
|
Loading…
Reference in New Issue
Block a user