fix: 搜索路由参数校验 — page>=1、limit 1-500
This commit is contained in:
@@ -95,7 +95,7 @@
|
||||
<el-table-column label="转存启用" width="80" align="center">
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
:model-value="row.is_transfer_enabled !== 0"
|
||||
:model-value="row.is_active !== 0"
|
||||
size="small"
|
||||
@change="(val: boolean) => handleToggleTransfer(row, val)"
|
||||
/>
|
||||
@@ -105,7 +105,7 @@
|
||||
<template #default="{ row }">
|
||||
<el-switch
|
||||
:model-value="row.is_primary === 1"
|
||||
:disabled="!row.is_transfer_enabled"
|
||||
:disabled="!row.is_active"
|
||||
size="small"
|
||||
@change="(val: boolean) => handleTogglePrimary(row, val)"
|
||||
/>
|
||||
@@ -386,11 +386,10 @@ async function handleToggleTransfer(row: CloudConfig, enabled: boolean) {
|
||||
cloud_type: row.cloud_type,
|
||||
nickname: row.nickname || '',
|
||||
promotion_account: row.promotion_account || '',
|
||||
is_transfer_enabled: newVal,
|
||||
is_active: row.is_active,
|
||||
is_active: newVal,
|
||||
cookie: undefined, // don't send cookie on toggle-only
|
||||
})
|
||||
row.is_transfer_enabled = newVal
|
||||
row.is_active = newVal
|
||||
ElMessage.success(enabled ? '转存已开启' : '转存已关闭')
|
||||
} catch (e: any) {
|
||||
ElMessage.error(e.response?.data?.error || '操作失败')
|
||||
@@ -455,7 +454,7 @@ function openDialog(row: CloudConfig | null) {
|
||||
form.cloud_type = row.cloud_type
|
||||
form.nickname = row.nickname || ''
|
||||
form.promotion_account = row.promotion_account || ''
|
||||
form.is_transfer_enabled = row.is_transfer_enabled !== 0
|
||||
form.is_transfer_enabled = row.is_active !== 0
|
||||
form.cookie = row.cookie || ''
|
||||
form._verifying = false
|
||||
form._storageUsed = ''
|
||||
@@ -506,9 +505,8 @@ async function handleSave() {
|
||||
cloud_type: form.cloud_type as CloudType,
|
||||
nickname: form.nickname,
|
||||
promotion_account: form.promotion_account,
|
||||
is_transfer_enabled: form.is_transfer_enabled ? 1 : 0,
|
||||
is_active: form.is_transfer_enabled ? 1 : 0,
|
||||
cookie: form.cookie || undefined,
|
||||
is_active: 1,
|
||||
})
|
||||
ElMessage.success('配置更新成功')
|
||||
} else {
|
||||
@@ -516,9 +514,8 @@ async function handleSave() {
|
||||
cloud_type: form.cloud_type as CloudType,
|
||||
nickname: form.nickname,
|
||||
promotion_account: form.promotion_account,
|
||||
is_transfer_enabled: form.is_transfer_enabled ? 1 : 0,
|
||||
is_active: form.is_transfer_enabled ? 1 : 0,
|
||||
cookie: form.cookie,
|
||||
is_active: 1,
|
||||
})
|
||||
ElMessage.success('配置保存成功')
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="user-layout">
|
||||
<!-- Header -->
|
||||
<div class="user-header">
|
||||
<span class="user-title">CloudSearch 用户中心</span>
|
||||
<span class="user-title">{{ siteName }} 用户中心</span>
|
||||
<div class="header-right">
|
||||
<span class="user-account">{{ account }}</span>
|
||||
<el-button size="small" @click="handleLogout">退出登录</el-button>
|
||||
@@ -152,6 +152,21 @@
|
||||
<!-- 新增/编辑网盘弹窗 — 复刻 admin CloudConfig dialog -->
|
||||
<el-dialog v-model="showAddDrive" :title="editingDrive ? '编辑网盘配置' : '新增网盘配置'" width="560px">
|
||||
<el-form ref="driveFormRef" :model="driveForm" :rules="driveRules" label-width="120px">
|
||||
<!-- 白名单目录提示 -->
|
||||
<el-alert
|
||||
v-show="whitelistDirs.length > 0"
|
||||
type="warning"
|
||||
show-icon
|
||||
:closable="false"
|
||||
style="margin-bottom: 18px;"
|
||||
>
|
||||
<template #title>
|
||||
<div style="line-height: 1.6;">
|
||||
<div>🧹 请在网盘主目录内创建:<b>{{ whitelistDirs.join('、') }}</b> 目录</div>
|
||||
<div>并将你的重要文件移至该目录,<b>只有这个目录不会被自动清理</b></div>
|
||||
</div>
|
||||
</template>
|
||||
</el-alert>
|
||||
<el-form-item label="网盘类型" prop="cloud_type">
|
||||
<el-select v-model="driveForm.cloud_type" style="width: 100%" :disabled="!!editingDrive" @change="onDriveTypeChange">
|
||||
<el-option
|
||||
@@ -195,12 +210,35 @@ import { useRouter } from 'vue-router'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import axios from 'axios'
|
||||
import { CLOUD_LABELS } from '../../types'
|
||||
import { getSystemConfigs } from '../../api'
|
||||
import type { CloudType } from '../../types'
|
||||
import CloudBadge from '../../components/CloudBadge.vue'
|
||||
import type { ElForm } from 'element-plus'
|
||||
|
||||
const router = useRouter()
|
||||
const account = ref('')
|
||||
const siteName = ref('CloudSearch')
|
||||
|
||||
/** 白名单目录提示 */
|
||||
const systemConfigs = ref<Record<string, string>>({})
|
||||
const whitelistDirs = computed(() => {
|
||||
try {
|
||||
const raw = systemConfigs.value.cleanup_whitelist_dirs || '[]'
|
||||
const arr = JSON.parse(raw)
|
||||
return Array.isArray(arr) && arr.length > 0 ? arr : []
|
||||
} catch { return [] }
|
||||
})
|
||||
|
||||
async function loadSystemConfigs() {
|
||||
try {
|
||||
const { data } = await axios.get('/api/system-configs')
|
||||
const map: Record<string, string> = {}
|
||||
for (const item of data) {
|
||||
map[item.key] = item.value
|
||||
}
|
||||
systemConfigs.value = map
|
||||
} catch (e) { console.error('加载系统配置失败', e) }
|
||||
}
|
||||
|
||||
function userApi() {
|
||||
const token = localStorage.getItem('user_token')
|
||||
@@ -220,7 +258,14 @@ onMounted(async () => {
|
||||
localStorage.removeItem('user_token')
|
||||
localStorage.removeItem('user_account')
|
||||
router.push('/user/login')
|
||||
return
|
||||
}
|
||||
// 获取网站名称
|
||||
try {
|
||||
const { data } = await axios.get('/api/site-config')
|
||||
if (data.site_name) siteName.value = data.site_name
|
||||
} catch { /* use default */ }
|
||||
loadSystemConfigs()
|
||||
})
|
||||
|
||||
function handleLogout() {
|
||||
|
||||
Reference in New Issue
Block a user