Feature: using webview to show manual website

This commit is contained in:
萌萌哒赫萝 2023-08-28 00:47:50 -07:00
parent 636596a984
commit bc7a446808
5 changed files with 26 additions and 28 deletions

View File

@ -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,

View File

@ -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) {

View 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>

View File

@ -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'

View File

@ -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'),