feat: 页面配置入口加 ↗ 打开按钮,可直接跳转站点页面
This commit is contained in:
@@ -132,6 +132,9 @@
|
|||||||
<template v-if="!entry.compose">
|
<template v-if="!entry.compose">
|
||||||
<div style="display:flex;gap:8px;align-items:flex-start;margin-bottom:6px;max-width:500px">
|
<div style="display:flex;gap:8px;align-items:flex-start;margin-bottom:6px;max-width:500px">
|
||||||
<el-input v-model="entry.url" size="small" placeholder="URL路径,如 /torrents.php" @input="syncToJson" style="flex:1" />
|
<el-input v-model="entry.url" size="small" placeholder="URL路径,如 /torrents.php" @input="syncToJson" style="flex:1" />
|
||||||
|
<el-button v-if="entry.url" size="small" circle title="打开页面" @click="openPage(entry)">
|
||||||
|
<span style="font-size:14px">↗</span>
|
||||||
|
</el-button>
|
||||||
<el-button size="small" @click="verifyEntry(entry, idx)" :loading="verifying[idx]" :type="verifyResults[idx]?.success===true ? 'success' : verifyResults[idx]?.success===false ? 'danger' : ''">
|
<el-button size="small" @click="verifyEntry(entry, idx)" :loading="verifying[idx]" :type="verifyResults[idx]?.success===true ? 'success' : verifyResults[idx]?.success===false ? 'danger' : ''">
|
||||||
{{ verifyResults[idx]?.success===true ? '✓' : verifyResults[idx]?.success===false ? '✗' : '验证' }}
|
{{ verifyResults[idx]?.success===true ? '✓' : verifyResults[idx]?.success===false ? '✗' : '验证' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -211,6 +214,11 @@ const resolveUrl = (url) => {
|
|||||||
if (!url || !base) return url || ''
|
if (!url || !base) return url || ''
|
||||||
return url.startsWith('/') ? base.replace(/\/$/, '') + url : url
|
return url.startsWith('/') ? base.replace(/\/$/, '') + url : url
|
||||||
}
|
}
|
||||||
|
const openPage = (entry) => {
|
||||||
|
const resolved = resolveUrl(entry.url)
|
||||||
|
if (resolved) window.open(resolved, '_blank')
|
||||||
|
else ElMessage.warning('请先配置站点地址')
|
||||||
|
}
|
||||||
|
|
||||||
const verifyEntry = async (entry, idx) => {
|
const verifyEntry = async (entry, idx) => {
|
||||||
const resolved = resolveUrl(entry.url)
|
const resolved = resolveUrl(entry.url)
|
||||||
|
|||||||
Reference in New Issue
Block a user