diff --git a/Yi.Ai.Vue3/src/pages/console/channel/index.vue b/Yi.Ai.Vue3/src/pages/console/channel/index.vue index 1580bd86..ddea45b9 100644 --- a/Yi.Ai.Vue3/src/pages/console/channel/index.vue +++ b/Yi.Ai.Vue3/src/pages/console/channel/index.vue @@ -2,7 +2,7 @@ import type { AiAppDto, AiModelDto, AppShortcutDto } from '@/api/channel/types'; import { Delete, Edit, Plus, Refresh, View } from '@element-plus/icons-vue'; import { ElMessage, ElMessageBox } from 'element-plus'; -import { onMounted, ref } from 'vue'; +import { onMounted, onUnmounted, ref } from 'vue'; import { clearPremiumModelCache, createApp, @@ -16,6 +16,12 @@ import { updateModel, } from '@/api/channel'; +// 移动端检测 +const isMobile = ref(false); +function checkMobile() { + isMobile.value = window.innerWidth < 768; +} + // ==================== 应用管理 ==================== const appList = ref([]); const appLoading = ref(false); @@ -151,7 +157,7 @@ async function handleBatchApply() { try { // 批量更新应用(只更新终结点和API Key,不修改应用名称) - const promises = selectedAppIds.value.map(appId => { + const promises = selectedAppIds.value.map((appId) => { // 获取当前应用信息,保留原有名称和排序 const currentApp = appList.value.find(a => a.id === appId); return updateApp({ @@ -185,7 +191,8 @@ function toggleAppSelection(appId: string) { const index = selectedAppIds.value.indexOf(appId); if (index > -1) { selectedAppIds.value.splice(index, 1); - } else { + } + else { selectedAppIds.value.push(appId); } } @@ -352,14 +359,20 @@ async function handleClearCache() { // 初始化 onMounted(() => { + checkMobile(); + window.addEventListener('resize', checkMobile); fetchAppList(); fetchShortcutList(); }); + +onUnmounted(() => { + window.removeEventListener('resize', checkMobile); +});