refactor(steps): 优化初始化页面的布局。让IDE能够正确识别@
This commit is contained in:
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mirror-description">{{ mirror.description }}</div>
|
<div class="mirror-description">{{ mirror.description }}</div>
|
||||||
<div class="mirror-url">{{ mirror.url }}</div>
|
<!-- <div class="mirror-url">{{ mirror.url }}</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,14 +62,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mirror-description">{{ mirror.description }}</div>
|
<div class="mirror-description">{{ mirror.description }}</div>
|
||||||
<div class="mirror-url">{{ mirror.url }}</div>
|
<!-- <div class="mirror-url">{{ mirror.url }}</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="test-actions">
|
<div class="test-actions">
|
||||||
<a-button @click="testGitMirrorSpeed" :loading="testingGitSpeed" type="primary">
|
<a-button @click="testGitMirrorSpeed" :loading="testingGitSpeed" type="primary">
|
||||||
{{ testingGitSpeed ? '测速中...' : '开始测速' }}
|
{{ testingGitSpeed ? '测速中...' : '重新测速' }}
|
||||||
</a-button>
|
</a-button>
|
||||||
<span class="test-note">3秒无响应视为超时</span>
|
<span class="test-note">3秒无响应视为超时</span>
|
||||||
</div>
|
</div>
|
||||||
@@ -206,7 +206,7 @@ onMounted(async () => {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--ant-color-text);
|
color: var(--ant-color-text);
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-section {
|
.install-section {
|
||||||
@@ -224,7 +224,7 @@ onMounted(async () => {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-card {
|
.mirror-card {
|
||||||
@@ -308,9 +308,6 @@ onMounted(async () => {
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-section {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -201,7 +201,6 @@ onMounted(async () => {
|
|||||||
font-size: 20px;
|
font-size: 20px;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
color: var(--ant-color-text);
|
color: var(--ant-color-text);
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.install-section {
|
.install-section {
|
||||||
@@ -219,7 +218,6 @@ onMounted(async () => {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-card {
|
.mirror-card {
|
||||||
@@ -303,9 +301,6 @@ onMounted(async () => {
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-section {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<div class="git-info">
|
<div class="git-info">
|
||||||
<a-alert
|
<a-alert
|
||||||
message="Git 工具信息"
|
message="Git 工具信息"
|
||||||
description="将安装便携版 Git 工具,包含完整的版本控制功能,无需系统安装。"
|
description="将安装便携版 Git 工具,以实现后端代码更新。"
|
||||||
type="info"
|
type="info"
|
||||||
show-icon
|
show-icon
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,19 +6,19 @@
|
|||||||
>欢迎使用 AUTO_MAA,让我们来配置您的运行环境</a-typography-title
|
>欢迎使用 AUTO_MAA,让我们来配置您的运行环境</a-typography-title
|
||||||
>
|
>
|
||||||
|
|
||||||
<!-- <div class="header-actions">-->
|
<div class="header-actions">
|
||||||
<!-- <a-button size="large" type="primary" @click="handleSkipToHome">-->
|
<a-button size="large" type="primary" @click="handleSkipToHome">
|
||||||
<!-- 跳转至首页(仅开发用)-->
|
跳转至首页(仅开发用)
|
||||||
<!-- </a-button>-->
|
</a-button>
|
||||||
<!-- <a-button-->
|
<a-button
|
||||||
<!-- size="large"-->
|
size="large"
|
||||||
<!-- type="default"-->
|
type="default"
|
||||||
<!-- @click="handleJumpToStep(5)"-->
|
@click="handleJumpToStep(3)"
|
||||||
<!-- style="margin-left: 16px"-->
|
style="margin-left: 16px"
|
||||||
<!-- >-->
|
>
|
||||||
<!-- 跳到启动服务(第六步)-->
|
跳到启动服务(第六步)
|
||||||
<!-- </a-button>-->
|
</a-button>
|
||||||
<!-- </div>-->
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<a-steps :current="currentStep" :status="stepStatus" class="init-steps">
|
<a-steps :current="currentStep" :status="stepStatus" class="init-steps">
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
<template>
|
|
||||||
<div class="step-panel">
|
|
||||||
<h3>安装 pip 包管理器</h3>
|
|
||||||
<div v-if="!pipInstalled" class="install-section">
|
|
||||||
<p>pip 是 Python 的包管理工具,用于安装和管理 Python 包</p>
|
|
||||||
|
|
||||||
<div class="pip-info">
|
|
||||||
<a-alert
|
|
||||||
message="pip 安装信息"
|
|
||||||
description="将自动下载并安装 pip 包管理器,这是安装 Python 依赖包的必要工具。"
|
|
||||||
type="info"
|
|
||||||
show-icon
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div v-else class="already-installed">
|
|
||||||
<a-result status="success" title="pip已成功安装,无需继续安装" />
|
|
||||||
<!-- <div class="reinstall-section">-->
|
|
||||||
<!-- <a-button type="primary" danger @click="handleForceReinstall" :loading="reinstalling">-->
|
|
||||||
<!-- {{ reinstalling ? '正在重新安装...' : '强制重新安装' }}-->
|
|
||||||
<!-- </a-button>-->
|
|
||||||
<!-- <p class="reinstall-note">点击此按钮将删除现有pip环境并重新安装</p>-->
|
|
||||||
<!-- </div>-->
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup lang="ts">
|
|
||||||
import { ref } from 'vue'
|
|
||||||
|
|
||||||
defineProps<{
|
|
||||||
pipInstalled: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const reinstalling = ref(false)
|
|
||||||
|
|
||||||
// 强制重新安装pip
|
|
||||||
async function handleForceReinstall() {
|
|
||||||
reinstalling.value = true
|
|
||||||
try {
|
|
||||||
console.log('开始强制重新安装pip')
|
|
||||||
// 先删除现有pip
|
|
||||||
const deleteResult = await window.electronAPI.deletePip()
|
|
||||||
if (!deleteResult.success) {
|
|
||||||
throw new Error(`删除pip失败: ${deleteResult.error}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 重新安装pip
|
|
||||||
const installResult = await window.electronAPI.installPip()
|
|
||||||
if (!installResult.success) {
|
|
||||||
throw new Error(`重新安装pip失败: ${installResult.error}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log('pip强制重新安装成功')
|
|
||||||
// 通知父组件更新状态
|
|
||||||
window.location.reload() // 简单的页面刷新来更新状态
|
|
||||||
} catch (error) {
|
|
||||||
console.error('pip强制重新安装失败:', error)
|
|
||||||
// 这里可以添加错误提示
|
|
||||||
} finally {
|
|
||||||
reinstalling.value = false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineExpose({
|
|
||||||
handleForceReinstall,
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
.step-panel {
|
|
||||||
padding: 20px;
|
|
||||||
background: var(--ant-color-bg-elevated);
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid var(--ant-color-border);
|
|
||||||
}
|
|
||||||
|
|
||||||
.step-panel h3 {
|
|
||||||
font-size: 20px;
|
|
||||||
font-weight: 600;
|
|
||||||
color: var(--ant-color-text);
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.install-section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.install-section p {
|
|
||||||
color: var(--ant-color-text-secondary);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.pip-info {
|
|
||||||
margin-top: 16px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.already-installed {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 200px;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reinstall-section {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
gap: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.reinstall-note {
|
|
||||||
font-size: 12px;
|
|
||||||
color: var(--ant-color-text-tertiary);
|
|
||||||
text-align: center;
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
<div class="step-panel">
|
<div class="step-panel">
|
||||||
<h3>Python 运行环境</h3>
|
<h3>Python 运行环境</h3>
|
||||||
<div v-if="!pythonInstalled" class="install-section">
|
<div v-if="!pythonInstalled" class="install-section">
|
||||||
<p>需要安装 Python 3.13.0 运行环境(64位嵌入式版本)</p>
|
<p>需要安装 Python 3.13.0 运行环境</p>
|
||||||
|
|
||||||
<!-- 镜像源 -->
|
<!-- 镜像源 -->
|
||||||
<div class="mirror-section">
|
<div class="mirror-section">
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mirror-description">{{ mirror.description }}</div>
|
<div class="mirror-description">{{ mirror.description }}</div>
|
||||||
<div class="mirror-url">{{ mirror.url }}</div>
|
<!-- <div class="mirror-url">{{ mirror.url }}</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="mirror-description">{{ mirror.description }}</div>
|
<div class="mirror-description">{{ mirror.description }}</div>
|
||||||
<div class="mirror-url">{{ mirror.url }}</div>
|
<!-- <div class="mirror-url">{{ mirror.url }}</div>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -264,7 +264,7 @@ onMounted(async () => {
|
|||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-card {
|
.mirror-card {
|
||||||
@@ -353,9 +353,7 @@ onMounted(async () => {
|
|||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mirror-section {
|
|
||||||
margin-bottom: 24px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.section-header {
|
.section-header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|||||||
@@ -89,40 +89,40 @@ const router = createRouter({
|
|||||||
routes,
|
routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
// 添加路由守卫,确保在生产环境中也能正确进入初始化页面
|
// // 添加路由守卫,确保在生产环境中也能正确进入初始化页面
|
||||||
router.beforeEach(async (to, from, next) => {
|
// router.beforeEach(async (to, from, next) => {
|
||||||
console.log('路由守卫:', { to: to.path, from: from.path })
|
// console.log('路由守卫:', { to: to.path, from: from.path })
|
||||||
|
//
|
||||||
// 如果目标就是初始化页,放行并清除一次性标记,避免反复跳转
|
// // 如果目标就是初始化页,放行并清除一次性标记,避免反复跳转
|
||||||
if (to.path === '/initialization') {
|
// if (to.path === '/initialization') {
|
||||||
needInitLanding = false
|
// needInitLanding = false
|
||||||
next()
|
// next()
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// (可选)开发环境跳过检查,可按需恢复
|
// // (可选)开发环境跳过检查,可按需恢复
|
||||||
const isDev = import.meta.env.VITE_APP_ENV === 'dev'
|
// const isDev = import.meta.env.VITE_APP_ENV === 'dev'
|
||||||
if (isDev) return next()
|
// if (isDev) return next()
|
||||||
|
//
|
||||||
// 先按原逻辑:未初始化 => 强制进入初始化
|
// // 先按原逻辑:未初始化 => 强制进入初始化
|
||||||
const initialized = await isAppInitialized()
|
// const initialized = await isAppInitialized()
|
||||||
console.log('检查初始化状态:', initialized)
|
// console.log('检查初始化状态:', initialized)
|
||||||
if (!initialized) {
|
// if (!initialized) {
|
||||||
needInitLanding = false // 以免重复重定向
|
// needInitLanding = false // 以免重复重定向
|
||||||
next('/initialization')
|
// next('/initialization')
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 已初始化:如果是“本次启动的第一次进入”,也先去初始化页一次
|
// // 已初始化:如果是“本次启动的第一次进入”,也先去初始化页一次
|
||||||
if (needInitLanding) {
|
// if (needInitLanding) {
|
||||||
needInitLanding = false
|
// needInitLanding = false
|
||||||
next({ path: '/initialization', query: { redirect: to.fullPath } })
|
// next({ path: '/initialization', query: { redirect: to.fullPath } })
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// 其他情况正常放行
|
// // 其他情况正常放行
|
||||||
next()
|
// next()
|
||||||
})
|
// })
|
||||||
|
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
@@ -1,14 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
"extends": "./tsconfig.base.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
||||||
|
|
||||||
/* Module Resolution */
|
|
||||||
"moduleResolution": "bundler",
|
"moduleResolution": "bundler",
|
||||||
"allowImportingTsExtensions": true,
|
"allowImportingTsExtensions": true,
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
|
|
||||||
/* Linting */
|
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
|
|||||||
9
frontend/tsconfig.base.json
Normal file
9
frontend/tsconfig.base.json
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vue/tsconfig/tsconfig.dom.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/*": ["./src/*"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
13
frontend/tsconfig.electron.json
Normal file
13
frontend/tsconfig.electron.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": "./tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"module": "CommonJS",
|
||||||
|
"strict": true,
|
||||||
|
"outDir": "dist-electron",
|
||||||
|
"rootDir": "electron",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"types": ["node", "electron"]
|
||||||
|
},
|
||||||
|
"include": ["electron"]
|
||||||
|
}
|
||||||
@@ -1,16 +1,7 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"files": [],
|
||||||
"target": "ES2020",
|
"references": [
|
||||||
"module": "CommonJS",
|
{ "path": "./tsconfig.app.json" },
|
||||||
"strict": true,
|
{ "path": "./tsconfig.electron.json" }
|
||||||
"outDir": "dist-electron",
|
]
|
||||||
"rootDir": "electron",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"types": ["node", "electron"],
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["src/*"]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"include": ["electron"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ export default defineConfig({
|
|||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.js', '.ts', '.vue', '.json'],
|
extensions: ['.js', '.ts', '.vue', '.json'],
|
||||||
alias: {
|
alias: {
|
||||||
'@': path.resolve(__dirname, 'src'),
|
'@': path.resolve(__dirname, './src'),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user