后台地图配置添加Key获取链接

This commit is contained in:
2026-10-26 22:11:03 +08:00
parent fd9ff73c00
commit 50af9b3fb0
@@ -115,7 +115,22 @@
<span class="status-pill">{{ mapEnabled ? '已配置' : '停用' }}</span>
</div>
<div v-for="item in mapKeyRows" :key="item.key" class="setting-row">
<div class="setting-copy"><strong>{{ item.label }}</strong><span>{{ item.description }}</span></div>
<div class="setting-copy">
<strong>
{{ item.label }}
<a
class="setting-copy__link"
:href="item.url"
target="_blank"
rel="noopener noreferrer"
:aria-label="`前往${item.label}获取页面`"
>
获取 Key
<ExportOutlined />
</a>
</strong>
<span>{{ item.description }}</span>
</div>
<div class="setting-control setting-control--password"><a-input-password v-model:value="mapForms[item.key].configValue" :placeholder="item.placeholder" /></div>
<span class="status-pill" :class="{ 'is-muted': !mapForms[item.key].configValue }">{{ mapForms[item.key].configValue ? '已填写' : '待配置' }}</span>
</div>
@@ -173,7 +188,7 @@
import { onMounted, reactive, ref } from 'vue'
import { useRoute } from 'vue-router'
import { message } from 'ant-design-vue'
import { ApiOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons-vue'
import { ApiOutlined, ExportOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons-vue'
import { adminSystemParameterConfigApi, type SystemParameterConfigVO } from '@/api/admin'
import { loadCachedAdminUserInfo } from '@/utils/admin-session'
@@ -207,10 +222,10 @@ const sections = [
{ key: 'services' as const, label: '服务接入', icon: ApiOutlined },
{ key: 'account' as const, label: '当前账号', icon: UserOutlined }
]
const mapKeyRows: Array<{ key: MapKey; label: string; description: string; placeholder: string }> = [
{ key: 'tencentWeb', label: '腾讯 Web Key', description: '用于后台腾讯地图选点和 Web 展示。', placeholder: '填写腾讯 Web Key' },
{ key: 'amapWeb', label: '高德 Web Key', description: '用于后台高德地图选点和 Web 展示。', placeholder: '填写高德 Web Key' },
{ key: 'amapMini', label: '高德小程序 Key', description: '供 Salon 小程序后续地图能力使用。', placeholder: '填写高德小程序 Key' }
const mapKeyRows: Array<{ key: MapKey; label: string; description: string; placeholder: string; url: string }> = [
{ key: 'tencentWeb', label: '腾讯 Web Key', description: '用于后台腾讯地图选点和 Web 展示。', placeholder: '填写腾讯 Web Key', url: 'https://lbs.qq.com/dev/console/key/manage' },
{ key: 'amapWeb', label: '高德 Web Key', description: '用于后台高德地图选点和 Web 展示。', placeholder: '填写高德 Web Key', url: 'https://console.amap.com/dev/key/app' },
{ key: 'amapMini', label: '高德小程序 Key', description: '供 Salon 小程序后续地图能力使用。', placeholder: '填写高德小程序 Key', url: 'https://console.amap.com/dev/key/app' }
]
const defaultPasswordForm = reactive<SystemParameterConfigVO>({
@@ -424,6 +439,10 @@ onMounted(() => {
.setting-row--last { border-radius: 0 0 10px 10px; }
.setting-copy { display: grid; gap: 4px; min-width: 0; }
.setting-copy strong { font-size: 13px; }
.setting-copy__link { display: inline-flex; align-items: center; gap: 3px; margin-left: 7px; color: var(--theme-primary-action); font-size: 11px; font-weight: 650; text-decoration: none; white-space: nowrap; }
.setting-copy__link:hover { text-decoration: underline; }
.setting-copy__link:focus-visible { outline: 2px solid color-mix(in srgb, var(--theme-primary) 55%, transparent); outline-offset: 2px; border-radius: 3px; }
.setting-copy__link :deep(.anticon) { font-size: 10px; }
.setting-copy span { color: var(--admin-mobile-muted); font-size: 11px; line-height: 1.45; }
.setting-control { display: flex; align-items: center; gap: 9px; min-width: 0; }
.setting-control > :deep(.ant-select) { width: 100%; }