mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-02 05:49:41 +08:00
✨ Feature(custom): add manual page open setting
This commit is contained in:
@@ -124,7 +124,9 @@
|
||||
</el-icon>
|
||||
<span>{{ $T('PLUGIN_SETTINGS') }}</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item :index="routerConfig.DocumentPage">
|
||||
<el-menu-item
|
||||
:index="routerConfig.DocumentPage"
|
||||
>
|
||||
<el-icon>
|
||||
<Link />
|
||||
</el-icon>
|
||||
@@ -232,7 +234,7 @@ import {
|
||||
} from '@element-plus/icons-vue'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessage as $message } from 'element-plus'
|
||||
import { ElMessage as $message, ElMessageBox } from 'element-plus'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
@@ -275,7 +277,8 @@ import {
|
||||
} from '~/universal/events/constants'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
import { getConfig, saveConfig, sendToMain } from '@/utils/dataSender'
|
||||
import { openURL } from '@/utils/common'
|
||||
|
||||
const version = ref(process.env.NODE_ENV === 'production' ? pkg.version : 'Dev')
|
||||
const routerConfig = reactive(config)
|
||||
@@ -320,10 +323,29 @@ const handleGetPicPeds = () => {
|
||||
sendToMain(GET_PICBEDS)
|
||||
}
|
||||
|
||||
const handleSelect = (index: string) => {
|
||||
const handleSelect = async (index: string) => {
|
||||
defaultActive.value = index
|
||||
if (index === routerConfig.DocumentPage) {
|
||||
ipcRenderer.send('openManualWindow')
|
||||
const manualPageOpenSetting = await getConfig('settings.manualPageOpen')
|
||||
const openManual = () => ipcRenderer.send('openManualWindow')
|
||||
const openExternal = () => openURL('https://piclist.cn/app.html')
|
||||
|
||||
if (!manualPageOpenSetting) {
|
||||
ElMessageBox.confirm($T('MANUAL_PAGE_OPEN_TIP'), $T('MANUAL_PAGE_OPEN_TIP_TITLE'), {
|
||||
confirmButtonText: $T('MANUAL_PAGE_OPEN_BY_BROWSER'),
|
||||
cancelButtonText: $T('MANUAL_PAGE_OPEN_BY_BUILD_IN'),
|
||||
type: 'info',
|
||||
center: true
|
||||
}).then(() => {
|
||||
saveConfig('settings.manualPageOpen', 'browser')
|
||||
openExternal()
|
||||
}).catch(() => {
|
||||
saveConfig('settings.manualPageOpen', 'window')
|
||||
openManual()
|
||||
})
|
||||
} else {
|
||||
manualPageOpenSetting === 'window' ? openManual() : openExternal()
|
||||
}
|
||||
return
|
||||
}
|
||||
const type = index.match(routerConfig.UPLOADER_CONFIG_PAGE)
|
||||
|
||||
@@ -92,6 +92,26 @@
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:label="$T('MANUAL_PAGE_OPEN_SETTING_TIP')"
|
||||
>
|
||||
<el-select
|
||||
v-model="form.manualPageOpen"
|
||||
size="small"
|
||||
style="width: 50%"
|
||||
:placeholder="$T('MANUAL_PAGE_OPEN_SETTING_TIP')"
|
||||
:persistent="false"
|
||||
teleported
|
||||
@change="handleManualPageOpenChange"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in manualPageOpenList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
v-if="os === 'darwin'"
|
||||
:label="$T('SETTINGS_ISHIDEDOCK')"
|
||||
@@ -1622,6 +1642,16 @@ const shortUrlServerList = [{
|
||||
}
|
||||
]
|
||||
|
||||
const manualPageOpenList = [{
|
||||
label: $T('MANUAL_PAGE_OPEN_BY_BUILD_IN'),
|
||||
value: 'window'
|
||||
},
|
||||
{
|
||||
label: $T('MANUAL_PAGE_OPEN_BY_BROWSER'),
|
||||
value: 'browser'
|
||||
}
|
||||
]
|
||||
|
||||
const waterMarkPositionMap = new Map([
|
||||
['north', $T('UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP')],
|
||||
['northeast', $T('UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP_RIGHT')],
|
||||
@@ -1749,7 +1779,8 @@ const form = reactive<ISettingForm>({
|
||||
yourlsSignature: '',
|
||||
deleteLocalFile: false,
|
||||
serverKey: '',
|
||||
aesPassword: ''
|
||||
aesPassword: '',
|
||||
manualPageOpen: 'browser'
|
||||
})
|
||||
|
||||
const languageList = i18nManager.languageList.map(item => ({
|
||||
@@ -1914,6 +1945,7 @@ async function initData () {
|
||||
form.deleteLocalFile = settings.deleteLocalFile || false
|
||||
form.serverKey = settings.serverKey || ''
|
||||
form.aesPassword = settings.aesPassword || 'PicList-aesPassword'
|
||||
form.manualPageOpen = settings.manualPageOpen || 'window'
|
||||
currentLanguage.value = settings.language ?? 'zh-CN'
|
||||
currentStartMode.value = settings.startMode || 'quiet'
|
||||
customLink.value = settings.customLink || ''
|
||||
@@ -2428,6 +2460,12 @@ function handleStartModeChange (val: 'quiet' | 'mini' | 'main' | 'no-tray') {
|
||||
})
|
||||
}
|
||||
|
||||
function handleManualPageOpenChange (val: string) {
|
||||
saveConfig({
|
||||
'settings.manualPageOpen': val
|
||||
})
|
||||
}
|
||||
|
||||
function goConfigPage () {
|
||||
sendToMain(OPEN_URL, 'https://piclist.cn/configure.html')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user