Merge branch 'feature/refactor' of github.com:AUTO-MAS-Project/AUTO-MAS into feature/refactor
This commit is contained in:
@@ -3,9 +3,16 @@
|
||||
<!-- 管理员权限检查 -->
|
||||
<AdminCheck v-if="!isAdmin" />
|
||||
|
||||
<!-- 环境不完整页面 -->
|
||||
<EnvironmentIncomplete
|
||||
v-if="showEnvironmentIncomplete"
|
||||
:missing-components="missingComponents"
|
||||
:on-switch-to-manual="switchToManualMode"
|
||||
/>
|
||||
|
||||
<!-- 自动初始化模式 -->
|
||||
<AutoMode
|
||||
v-if="autoMode"
|
||||
v-else-if="autoMode"
|
||||
:on-switch-to-manual="switchToManualMode"
|
||||
:on-auto-complete="enterApp"
|
||||
/>
|
||||
@@ -33,6 +40,7 @@ import { getConfig, saveConfig, setInitialized } from '@/utils/config'
|
||||
import AdminCheck from '@/components/initialization/AdminCheck.vue'
|
||||
import AutoMode from '@/components/initialization/AutoMode.vue'
|
||||
import ManualMode from '@/components/initialization/ManualMode.vue'
|
||||
import EnvironmentIncomplete from '@/components/initialization/EnvironmentIncomplete.vue'
|
||||
import type { DownloadProgress } from '@/types/initialization'
|
||||
import { mirrorManager } from '@/utils/mirrorManager'
|
||||
|
||||
@@ -41,6 +49,8 @@ const router = useRouter()
|
||||
// 基础状态
|
||||
const isAdmin = ref(true)
|
||||
const autoMode = ref(false)
|
||||
const showEnvironmentIncomplete = ref(false)
|
||||
const missingComponents = ref<string[]>([])
|
||||
|
||||
// 安装状态
|
||||
const pythonInstalled = ref(false)
|
||||
@@ -64,7 +74,9 @@ function skipToHome() {
|
||||
}
|
||||
|
||||
function switchToManualMode() {
|
||||
showEnvironmentIncomplete.value = false
|
||||
autoMode.value = false
|
||||
console.log('切换到手动模式')
|
||||
}
|
||||
|
||||
// 进入应用
|
||||
@@ -143,8 +155,7 @@ async function checkCriticalFiles() {
|
||||
// 检查环境状态
|
||||
async function checkEnvironment() {
|
||||
try {
|
||||
|
||||
// 只检查关键exe文件是否存在
|
||||
// 每次都重新检查关键exe文件是否存在,不依赖持久化配置
|
||||
const criticalFiles = await checkCriticalFiles()
|
||||
|
||||
console.log('关键文件检查结果:', criticalFiles)
|
||||
@@ -154,7 +165,7 @@ async function checkEnvironment() {
|
||||
gitInstalled.value = criticalFiles.gitExists
|
||||
backendExists.value = criticalFiles.mainPyExists
|
||||
|
||||
// 检查配置文件中的依赖安装状态
|
||||
// 依赖安装状态从配置文件读取,但在手动模式中会重新安装
|
||||
const config = await getConfig()
|
||||
dependenciesInstalled.value = config.dependenciesInstalled || false
|
||||
|
||||
@@ -180,27 +191,43 @@ async function checkEnvironment() {
|
||||
console.log('- main.py存在:', criticalFiles.mainPyExists)
|
||||
console.log('- 所有关键文件存在:', allExeFilesExist)
|
||||
|
||||
// 检查是否应该进入自动模式
|
||||
// 新的自动模式判断逻辑:只要所有关键exe文件都存在且不是第一次启动就进入自动模式
|
||||
console.log('自动模式判断条件:')
|
||||
console.log('- 不是第一次启动:', !isFirst)
|
||||
console.log('- 配置显示已初始化:', config.init)
|
||||
console.log('- 所有关键文件存在:', allExeFilesExist)
|
||||
|
||||
// 只有在非首次启动、配置显示已初始化、且所有关键exe文件都存在时才进入自动模式
|
||||
if (!isFirst && config.init && allExeFilesExist) {
|
||||
// 只要不是第一次启动且所有关键exe文件都存在就进入自动模式
|
||||
if (!isFirst && allExeFilesExist) {
|
||||
console.log('进入自动模式,开始自动启动流程')
|
||||
autoMode.value = true
|
||||
} else {
|
||||
console.log('进入手动模式')
|
||||
console.log(
|
||||
'原因: isFirst =',
|
||||
isFirst,
|
||||
', config.init =',
|
||||
config.init,
|
||||
', allExeFilesExist =',
|
||||
allExeFilesExist
|
||||
)
|
||||
|
||||
if (isFirst) {
|
||||
console.log('原因: 第一次启动')
|
||||
// 第一次启动直接进入手动模式
|
||||
autoMode.value = false
|
||||
showEnvironmentIncomplete.value = false
|
||||
} else if (!allExeFilesExist) {
|
||||
console.log('原因: 关键exe文件缺失')
|
||||
console.log(' - python.exe缺失:', !criticalFiles.pythonExists)
|
||||
console.log(' - git.exe缺失:', !criticalFiles.gitExists)
|
||||
console.log(' - main.py缺失:', !criticalFiles.mainPyExists)
|
||||
|
||||
// 显示环境不完整页面
|
||||
const missing = []
|
||||
if (!criticalFiles.pythonExists) missing.push('Python 环境')
|
||||
if (!criticalFiles.gitExists) missing.push('Git 工具')
|
||||
if (!criticalFiles.mainPyExists) missing.push('后端代码')
|
||||
|
||||
missingComponents.value = missing
|
||||
showEnvironmentIncomplete.value = true
|
||||
autoMode.value = false
|
||||
} else {
|
||||
// 其他情况直接进入手动模式
|
||||
autoMode.value = false
|
||||
showEnvironmentIncomplete.value = false
|
||||
}
|
||||
|
||||
// 如果关键文件缺失,重置初始化状态
|
||||
if (!allExeFilesExist && config.init) {
|
||||
console.log('检测到关键exe文件缺失,重置初始化状态')
|
||||
@@ -288,6 +315,8 @@ onUnmounted(() => {
|
||||
box-sizing: border-box;
|
||||
width: 100%;
|
||||
min-height: 100%;
|
||||
background-color: var(--ant-color-bg-layout);
|
||||
color: var(--ant-color-text);
|
||||
}
|
||||
|
||||
/* 响应式优化 */
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
<template>
|
||||
<div class="logs-container">
|
||||
<div class="logs-header">
|
||||
<h1>日志查看</h1>
|
||||
<p class="logs-description">查看和管理应用程序日志</p>
|
||||
<div class="header-content">
|
||||
<div class="title-section">
|
||||
<h1>日志查看</h1>
|
||||
<p class="logs-description">查看和管理应用程序日志</p>
|
||||
</div>
|
||||
<a-button @click="goBack" size="large">
|
||||
<template #icon>
|
||||
<ArrowLeftOutlined />
|
||||
</template>
|
||||
返回设置
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<LogViewer />
|
||||
@@ -11,9 +21,12 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { ArrowLeftOutlined } from '@ant-design/icons-vue'
|
||||
import LogViewer from '@/components/LogViewer.vue'
|
||||
import { useTheme } from '@/composables/useTheme'
|
||||
|
||||
const router = useRouter()
|
||||
const { isDark } = useTheme()
|
||||
|
||||
const textColor = computed(() =>
|
||||
@@ -22,6 +35,10 @@ const textColor = computed(() =>
|
||||
const textSecondaryColor = computed(() =>
|
||||
isDark.value ? 'rgba(255, 255, 255, 0.65)' : 'rgba(0, 0, 0, 0.65)'
|
||||
)
|
||||
|
||||
const goBack = () => {
|
||||
router.push('/settings')
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
@@ -31,6 +48,19 @@ const textSecondaryColor = computed(() =>
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.logs-header {
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.logs-header h1 {
|
||||
margin: 0 0 8px 0;
|
||||
|
||||
@@ -1,8 +1,18 @@
|
||||
<template>
|
||||
<div class="mirror-test-container">
|
||||
<div class="test-header">
|
||||
<h2>镜像配置测试页面</h2>
|
||||
<p>用于测试云端镜像配置拉取功能</p>
|
||||
<div class="header-content">
|
||||
<div class="title-section">
|
||||
<h2>镜像配置测试页面</h2>
|
||||
<p>用于测试云端镜像配置拉取功能</p>
|
||||
</div>
|
||||
<a-button @click="goBack" size="large">
|
||||
<template #icon>
|
||||
<ArrowLeftOutlined />
|
||||
</template>
|
||||
返回设置
|
||||
</a-button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="test-content">
|
||||
@@ -83,10 +93,14 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { ArrowLeftOutlined } from '@ant-design/icons-vue'
|
||||
import { mirrorManager } from '@/utils/mirrorManager'
|
||||
import { cloudConfigManager, type CloudMirrorConfig } from '@/utils/cloudConfigManager'
|
||||
|
||||
const router = useRouter()
|
||||
|
||||
interface TestLog {
|
||||
time: string
|
||||
message: string
|
||||
@@ -196,6 +210,10 @@ const testCloudUrl = async () => {
|
||||
}
|
||||
}
|
||||
|
||||
const goBack = () => {
|
||||
router.push('/settings')
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
updateStatus()
|
||||
addLog('镜像配置测试页面已加载', 'info')
|
||||
@@ -210,10 +228,20 @@ onMounted(() => {
|
||||
}
|
||||
|
||||
.test-header {
|
||||
text-align: center;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.title-section {
|
||||
flex: 1;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.test-header h2 {
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
<script setup lang="ts">
|
||||
const { goToLogs, openDevTools } = defineProps<{ goToLogs: () => void; openDevTools: () => void }>()
|
||||
const {
|
||||
goToLogs,
|
||||
openDevTools,
|
||||
mirrorConfigStatus,
|
||||
refreshingConfig,
|
||||
refreshMirrorConfig,
|
||||
goToMirrorTest
|
||||
} = defineProps<{
|
||||
goToLogs: () => void
|
||||
openDevTools: () => void
|
||||
mirrorConfigStatus: { isUsingCloudConfig: boolean; version: string; lastUpdated: string; source: 'cloud' | 'fallback' }
|
||||
refreshingConfig: boolean
|
||||
refreshMirrorConfig: () => Promise<void>
|
||||
goToMirrorTest: () => void
|
||||
}>()
|
||||
</script>
|
||||
<template>
|
||||
<div class="tab-content">
|
||||
@@ -16,5 +30,45 @@ const { goToLogs, openDevTools } = defineProps<{ goToLogs: () => void; openDevTo
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<div class="section-header">
|
||||
<h3>镜像站配置</h3>
|
||||
<p class="section-description">管理下载站和加速站配置,支持从云端自动更新最新的镜像站列表</p>
|
||||
</div>
|
||||
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<div class="form-item-vertical">
|
||||
<div class="form-label-wrapper">
|
||||
<span class="form-label">配置管理</span>
|
||||
</div>
|
||||
<a-space size="large">
|
||||
<a-button type="primary" @click="refreshMirrorConfig" :loading="refreshingConfig"
|
||||
size="large">更新云端最新配置</a-button>
|
||||
<a-button @click="goToMirrorTest" size="large">测试页面</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="24" style="margin-top: 24px;">
|
||||
<a-col :span="24">
|
||||
<div class="form-item-vertical">
|
||||
<div class="form-label-wrapper">
|
||||
<span class="form-label">说明</span>
|
||||
</div>
|
||||
<a-alert message="镜像配置说明" type="info" show-icon>
|
||||
<template #description>
|
||||
<ul style="margin:8px 0; padding-left:20px;">
|
||||
<li>应用启动时会自动尝试从云端拉取最新的镜像站配置</li>
|
||||
<li>可以手动点击"刷新云端配置"按钮获取最新配置</li>
|
||||
</ul>
|
||||
</template>
|
||||
</a-alert>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -1,72 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
const { mirrorConfigStatus, refreshingConfig, refreshMirrorConfig, goToMirrorTest } = defineProps<{
|
||||
mirrorConfigStatus: { isUsingCloudConfig: boolean; version: string; lastUpdated: string; source: 'cloud' | 'fallback' }
|
||||
refreshingConfig: boolean
|
||||
refreshMirrorConfig: () => Promise<void>
|
||||
goToMirrorTest: () => void
|
||||
}>()
|
||||
</script>
|
||||
<template>
|
||||
<div class="tab-content">
|
||||
<div class="form-section">
|
||||
<div class="section-header">
|
||||
<h3>镜像站配置</h3>
|
||||
<p class="section-description">管理下载站和加速站配置,支持从云端自动更新最新的镜像站列表</p>
|
||||
</div>
|
||||
<a-row :gutter="24">
|
||||
<a-col :span="24">
|
||||
<div class="form-item-vertical">
|
||||
<div class="form-label-wrapper">
|
||||
<span class="form-label">配置状态</span>
|
||||
</div>
|
||||
<a-descriptions :column="1" bordered size="small">
|
||||
<a-descriptions-item label="配置来源">
|
||||
<a-tag :color="mirrorConfigStatus.source === 'cloud' ? 'green' : 'orange'">
|
||||
{{ mirrorConfigStatus.source === 'cloud' ? '云端配置' : '本地兜底配置' }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="配置版本" v-if="mirrorConfigStatus.version">
|
||||
{{ mirrorConfigStatus.version }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="最后更新" v-if="mirrorConfigStatus.lastUpdated">
|
||||
{{ new Date(mirrorConfigStatus.lastUpdated).toLocaleString() }}
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="24" style="margin-top:24px;">
|
||||
<a-col :span="24">
|
||||
<div class="form-item-vertical">
|
||||
<div class="form-label-wrapper">
|
||||
<span class="form-label">配置管理</span>
|
||||
</div>
|
||||
<a-space size="large">
|
||||
<a-button type="primary" @click="refreshMirrorConfig" :loading="refreshingConfig" size="large">更新云端最新配置</a-button>
|
||||
<a-button @click="goToMirrorTest" size="large">测试页面</a-button>
|
||||
</a-space>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<a-row :gutter="24" style="margin-top: 24px;">
|
||||
<a-col :span="24">
|
||||
<div class="form-item-vertical">
|
||||
<div class="form-label-wrapper">
|
||||
<span class="form-label">说明</span>
|
||||
</div>
|
||||
<a-alert message="镜像配置说明" type="info" show-icon>
|
||||
<template #description>
|
||||
<ul style="margin:8px 0; padding-left:20px;">
|
||||
<li>应用启动时会自动尝试从云端拉取最新的镜像站配置</li>
|
||||
<li>可以手动点击"刷新云端配置"按钮获取最新配置</li>
|
||||
</ul>
|
||||
</template>
|
||||
</a-alert>
|
||||
</div>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -22,7 +22,6 @@ import TabUpdate from './TabUpdate.vue'
|
||||
import TabStart from './TabStart.vue'
|
||||
import TabVoice from './TabVoice.vue'
|
||||
import TabAdvanced from './TabAdvanced.vue'
|
||||
import TabMirrors from './TabMirrors.vue'
|
||||
import TabOthers from './TabOthers.vue'
|
||||
|
||||
const router = useRouter()
|
||||
@@ -308,11 +307,10 @@ onMounted(() => {
|
||||
<TabVoice :settings="settings" :voice-type-options="voiceTypeOptions" :handle-setting-change="handleSettingChange" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="advanced" tab="高级设置">
|
||||
<TabAdvanced :go-to-logs="goToLogs" :open-dev-tools="openDevTools" />
|
||||
</a-tab-pane>
|
||||
<a-tab-pane key="mirrors" tab="镜像配置">
|
||||
<TabMirrors
|
||||
:mirror-config-status="mirrorConfigStatus.value"
|
||||
<TabAdvanced
|
||||
:go-to-logs="goToLogs"
|
||||
:open-dev-tools="openDevTools"
|
||||
:mirror-config-status="mirrorConfigStatus"
|
||||
:refreshing-config="refreshingConfig"
|
||||
:refresh-mirror-config="refreshMirrorConfig"
|
||||
:go-to-mirror-test="goToMirrorTest"
|
||||
|
||||
Reference in New Issue
Block a user