refactor(components): 修复代码错误,重新格式化代码
This commit is contained in:
@@ -252,7 +252,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.log-entry:hover {
|
||||
background: var(--ant-color-fill-quaternary);
|
||||
|
||||
}
|
||||
|
||||
.log-highlight {
|
||||
@@ -311,7 +311,7 @@ onUnmounted(() => {
|
||||
}
|
||||
|
||||
.log-data-content {
|
||||
background: var(--ant-color-fill-quaternary);
|
||||
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
margin-top: 4px;
|
||||
|
||||
@@ -92,10 +92,9 @@ const md = new MarkdownIt({
|
||||
const notices = computed(() => Object.keys(props.noticeData))
|
||||
|
||||
// 当前公告索引
|
||||
const currentNoticeIndex = computed(() => {
|
||||
computed(() => {
|
||||
return notices.value.findIndex(title => title === activeNoticeKey.value)
|
||||
})
|
||||
|
||||
// 渲染 markdown
|
||||
const renderMarkdown = (content: string) => {
|
||||
return md.render(content)
|
||||
|
||||
@@ -211,10 +211,7 @@
|
||||
剩余关卡: {{ user.Info.Stage_Remain }}
|
||||
</a-tag>
|
||||
|
||||
<a-tag
|
||||
class="info-tag"
|
||||
color="magenta"
|
||||
>
|
||||
<a-tag class="info-tag" color="magenta">
|
||||
备注: {{ truncateText(user.Info.Notes) }}
|
||||
</a-tag>
|
||||
</div>
|
||||
@@ -270,10 +267,7 @@
|
||||
|
||||
<!-- 空状态 -->
|
||||
<div v-else class="empty-users">
|
||||
<a-empty
|
||||
description="暂无用户"
|
||||
class="compact-empty"
|
||||
>
|
||||
<a-empty description="暂无用户" class="compact-empty">
|
||||
<a-button type="primary" size="small" @click="handleAddUser(script)">
|
||||
<template #icon>
|
||||
<PlusOutlined />
|
||||
@@ -365,23 +359,6 @@ const handleDisconnectMAA = (script: Script) => {
|
||||
const handleToggleUserStatus = (user: User) => {
|
||||
emit('toggleUserStatus', user)
|
||||
}
|
||||
|
||||
function get_annihilation_name(annihilation_name) {
|
||||
if (annihilation_name == 'Annihilation') {
|
||||
return '当期剿灭'
|
||||
}
|
||||
if (annihilation_name == 'Chernobog@Annihilation') {
|
||||
return '切尔诺伯格'
|
||||
}
|
||||
if (annihilation_name == 'LungmenOutskirts@Annihilation') {
|
||||
return '龙门外环'
|
||||
}
|
||||
if (annihilation_name == 'LungmenDowntown@Annihilation') {
|
||||
return '龙门市区'
|
||||
}
|
||||
return '未开启'
|
||||
}
|
||||
|
||||
const truncateText = (text: string, maxLength: number = 10): string => {
|
||||
if (!text) return ''
|
||||
return text.length > maxLength ? text.substring(0, maxLength) + '...' : text
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
<a-tag v-if="mirror.recommended" color="gold" size="small">推荐</a-tag>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingGitSpeed">未测试</span>
|
||||
<span v-else-if="testingGitSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="mirror-title">
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingGitSpeed">未测试</span>
|
||||
<span v-else-if="testingGitSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
<a-tag v-if="mirror.recommended" color="gold" size="small">推荐</a-tag>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingPipSpeed">未测试</span>
|
||||
<span v-else-if="testingPipSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="mirror-title">
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingPipSpeed">未测试</span>
|
||||
<span v-else-if="testingPipSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
@@ -85,7 +85,7 @@ import {
|
||||
getOfficialMirrors,
|
||||
getMirrorMirrors,
|
||||
sortMirrorsBySpeedAndRecommendation,
|
||||
type MirrorConfig
|
||||
type MirrorConfig,
|
||||
} from '@/config/mirrors'
|
||||
|
||||
const pipMirrors = ref<MirrorConfig[]>(PIP_MIRRORS)
|
||||
@@ -95,7 +95,9 @@ const officialMirrors = computed(() => getOfficialMirrors('pip'))
|
||||
const mirrorMirrors = computed(() => getMirrorMirrors('pip'))
|
||||
|
||||
// 按速度和推荐排序的镜像源
|
||||
const sortedOfficialMirrors = computed(() => sortMirrorsBySpeedAndRecommendation(officialMirrors.value))
|
||||
const sortedOfficialMirrors = computed(() =>
|
||||
sortMirrorsBySpeedAndRecommendation(officialMirrors.value)
|
||||
)
|
||||
const sortedMirrorMirrors = computed(() => sortMirrorsBySpeedAndRecommendation(mirrorMirrors.value))
|
||||
|
||||
const selectedPipMirror = ref('aliyun')
|
||||
@@ -259,8 +261,6 @@ onMounted(async () => {
|
||||
color: var(--ant-color-text);
|
||||
}
|
||||
|
||||
|
||||
|
||||
.speed-badge {
|
||||
padding: 4px 8px;
|
||||
border-radius: 4px;
|
||||
@@ -268,26 +268,6 @@ onMounted(async () => {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.speed-badge.speed-unknown {
|
||||
color: var(--ant-color-text-tertiary);
|
||||
}
|
||||
|
||||
.speed-badge.speed-fast {
|
||||
color: var(--ant-color-success);
|
||||
}
|
||||
|
||||
.speed-badge.speed-medium {
|
||||
color: var(--ant-color-warning);
|
||||
}
|
||||
|
||||
.speed-badge.speed-slow {
|
||||
color: var(--ant-color-error);
|
||||
}
|
||||
|
||||
.speed-badge.speed-timeout {
|
||||
color: var(--ant-color-error);
|
||||
}
|
||||
|
||||
.mirror-description {
|
||||
font-size: 13px;
|
||||
color: var(--ant-color-text-secondary);
|
||||
@@ -301,7 +281,6 @@ onMounted(async () => {
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
|
||||
.section-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
@@ -105,17 +105,4 @@ defineExpose({
|
||||
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>
|
||||
@@ -160,10 +160,6 @@ const dependenciesStepRef = ref()
|
||||
const serviceStepRef = ref()
|
||||
|
||||
// 事件处理
|
||||
function handleSkipToHome() {
|
||||
props.onSkipToHome()
|
||||
}
|
||||
|
||||
function handleJumpToStep(step: number) {
|
||||
currentStep.value = step
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
<a-tag v-if="mirror.recommended" color="gold" size="small">推荐</a-tag>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingSpeed">未测试</span>
|
||||
<span v-else-if="testingSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
@@ -54,7 +54,7 @@
|
||||
<div class="mirror-title">
|
||||
<h4>{{ mirror.name }}</h4>
|
||||
</div>
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed)">
|
||||
<div class="speed-badge" :class="getSpeedClass(mirror.speed ?? null)">
|
||||
<span v-if="mirror.speed === null && !testingSpeed">未测试</span>
|
||||
<span v-else-if="testingSpeed">测试中...</span>
|
||||
<span v-else-if="mirror.speed === 9999">超时</span>
|
||||
|
||||
@@ -48,7 +48,6 @@
|
||||
</template>
|
||||
</a-table>
|
||||
|
||||
|
||||
<!-- 队列项编辑弹窗 -->
|
||||
<a-modal
|
||||
v-model:open="modalVisible"
|
||||
@@ -73,17 +72,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch, onMounted, h } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import {
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
EditOutlined,
|
||||
DeleteOutlined,
|
||||
MoreOutlined,
|
||||
} from '@ant-design/icons-vue'
|
||||
import { Service } from '@/api'
|
||||
import { onMounted, reactive, ref, watch } from 'vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { Service } from '@/api'
|
||||
|
||||
// Props
|
||||
interface Props {
|
||||
|
||||
@@ -89,11 +89,11 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, watch } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { PlusOutlined, ReloadOutlined, EditOutlined, DeleteOutlined } from '@ant-design/icons-vue'
|
||||
import { Service } from '@/api'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { DeleteOutlined, EditOutlined, PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { Service } from '@/api'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
// 时间处理工具函数
|
||||
@@ -192,11 +192,6 @@ watch(
|
||||
{ deep: true, immediate: true }
|
||||
)
|
||||
|
||||
// 刷新数据
|
||||
const refreshData = () => {
|
||||
emit('refresh')
|
||||
}
|
||||
|
||||
// 添加定时项
|
||||
const addTimeSet = () => {
|
||||
editingTimeSet.value = null
|
||||
@@ -372,14 +367,12 @@ const deleteTimeSet = async (timeSetId: string) => {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
|
||||
/* 表格样式优化 */
|
||||
:deep(.ant-table-tbody > tr > td) {
|
||||
padding: 12px 16px;
|
||||
}
|
||||
|
||||
:deep(.ant-table-thead > tr > th) {
|
||||
background: var(--ant-color-fill-quaternary);
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
@@ -398,7 +391,6 @@ const deleteTimeSet = async (timeSetId: string) => {
|
||||
font-weight: 600;
|
||||
color: var(--ant-color-text);
|
||||
padding: 4px 8px;
|
||||
background: var(--ant-color-fill-quaternary);
|
||||
border-radius: 4px;
|
||||
display: inline-block;
|
||||
min-width: 60px;
|
||||
|
||||
@@ -89,40 +89,40 @@ const router = createRouter({
|
||||
routes,
|
||||
})
|
||||
|
||||
// // 添加路由守卫,确保在生产环境中也能正确进入初始化页面
|
||||
// router.beforeEach(async (to, from, next) => {
|
||||
// console.log('路由守卫:', { to: to.path, from: from.path })
|
||||
//
|
||||
// // 如果目标就是初始化页,放行并清除一次性标记,避免反复跳转
|
||||
// if (to.path === '/initialization') {
|
||||
// needInitLanding = false
|
||||
// next()
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // (可选)开发环境跳过检查,可按需恢复
|
||||
// const isDev = import.meta.env.VITE_APP_ENV === 'dev'
|
||||
// if (isDev) return next()
|
||||
//
|
||||
// // 先按原逻辑:未初始化 => 强制进入初始化
|
||||
// const initialized = await isAppInitialized()
|
||||
// console.log('检查初始化状态:', initialized)
|
||||
// if (!initialized) {
|
||||
// needInitLanding = false // 以免重复重定向
|
||||
// next('/initialization')
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // 已初始化:如果是“本次启动的第一次进入”,也先去初始化页一次
|
||||
// if (needInitLanding) {
|
||||
// needInitLanding = false
|
||||
// next({ path: '/initialization', query: { redirect: to.fullPath } })
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// // 其他情况正常放行
|
||||
// next()
|
||||
// })
|
||||
// 添加路由守卫,确保在生产环境中也能正确进入初始化页面
|
||||
router.beforeEach(async (to, from, next) => {
|
||||
console.log('路由守卫:', { to: to.path, from: from.path })
|
||||
|
||||
// 如果目标就是初始化页,放行并清除一次性标记,避免反复跳转
|
||||
if (to.path === '/initialization') {
|
||||
needInitLanding = false
|
||||
next()
|
||||
return
|
||||
}
|
||||
|
||||
// (可选)开发环境跳过检查,可按需恢复
|
||||
const isDev = import.meta.env.VITE_APP_ENV === 'dev'
|
||||
if (isDev) return next()
|
||||
|
||||
// 先按原逻辑:未初始化 => 强制进入初始化
|
||||
const initialized = await isAppInitialized()
|
||||
console.log('检查初始化状态:', initialized)
|
||||
if (!initialized) {
|
||||
needInitLanding = false // 以免重复重定向
|
||||
next('/initialization')
|
||||
return
|
||||
}
|
||||
|
||||
// 已初始化:如果是“本次启动的第一次进入”,也先去初始化页一次
|
||||
if (needInitLanding) {
|
||||
needInitLanding = false
|
||||
next({ path: '/initialization', query: { redirect: to.fullPath } })
|
||||
return
|
||||
}
|
||||
|
||||
// 其他情况正常放行
|
||||
next()
|
||||
})
|
||||
|
||||
|
||||
export default router
|
||||
|
||||
@@ -724,7 +724,7 @@ onMounted(() => {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: var(--ant-color-fill-quaternary);
|
||||
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@@ -32,11 +32,7 @@
|
||||
cancel-text="取消"
|
||||
@confirm="handleRemovePlan(activePlanId)"
|
||||
>
|
||||
<a-button
|
||||
danger
|
||||
size="large"
|
||||
:disabled="!activePlanId"
|
||||
>
|
||||
<a-button danger size="large" :disabled="!activePlanId">
|
||||
<template #icon>
|
||||
<DeleteOutlined />
|
||||
</template>
|
||||
@@ -113,12 +109,7 @@
|
||||
<div class="plan-title-container">
|
||||
<div v-if="!isEditingPlanName" class="plan-title-display">
|
||||
<span class="plan-title-text">{{ currentPlanName || '计划配置' }}</span>
|
||||
<a-button
|
||||
type="text"
|
||||
size="small"
|
||||
@click="startEditPlanName"
|
||||
class="plan-edit-btn"
|
||||
>
|
||||
<a-button type="text" size="small" @click="startEditPlanName" class="plan-edit-btn">
|
||||
<template #icon>
|
||||
<EditOutlined />
|
||||
</template>
|
||||
@@ -146,7 +137,7 @@
|
||||
@change="onModeChange"
|
||||
:options="[
|
||||
{ label: '全局模式', value: 'ALL' },
|
||||
{ label: '周计划模式', value: 'Weekly' }
|
||||
{ label: '周计划模式', value: 'Weekly' },
|
||||
]"
|
||||
/>
|
||||
</a-space>
|
||||
@@ -166,10 +157,7 @@
|
||||
<template #bodyCell="{ column, record, index }">
|
||||
<template v-if="column.key === 'taskName'">
|
||||
<div class="task-name-cell">
|
||||
<a-tag
|
||||
:color="getTaskTagColor(record.taskName)"
|
||||
class="task-tag"
|
||||
>
|
||||
<a-tag :color="getTaskTagColor(record.taskName)" class="task-tag">
|
||||
{{ record.taskName }}
|
||||
</a-tag>
|
||||
</div>
|
||||
@@ -539,7 +527,7 @@ const handleSave = async () => {
|
||||
const handleAddPlan = async () => {
|
||||
try {
|
||||
const response = await createPlan('MaaPlan')
|
||||
const defaultName = '新MAA计划表'
|
||||
const defaultName = '新 MAA 计划表'
|
||||
const newPlan = {
|
||||
id: response.planId,
|
||||
name: defaultName,
|
||||
@@ -741,13 +729,13 @@ onMounted(() => {
|
||||
// 新增方法:获取任务标签颜色
|
||||
const getTaskTagColor = (taskName: string) => {
|
||||
const colorMap: Record<string, string> = {
|
||||
'吃理智药': 'blue',
|
||||
'连战次数': 'green',
|
||||
'关卡选择': 'orange',
|
||||
吃理智药: 'blue',
|
||||
连战次数: 'green',
|
||||
关卡选择: 'orange',
|
||||
'备选-1': 'purple',
|
||||
'备选-2': 'purple',
|
||||
'备选-3': 'purple',
|
||||
'剩余理智': 'cyan'
|
||||
剩余理智: 'cyan',
|
||||
}
|
||||
return colorMap[taskName] || 'default'
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ const handleAddQueue = async () => {
|
||||
const response = await Service.addQueueApiQueueAddPost()
|
||||
|
||||
if (response.code === 200 && response.queueId) {
|
||||
const defaultName = '新调度队列'
|
||||
const defaultName = '新队列'
|
||||
const newQueue = {
|
||||
id: response.queueId,
|
||||
name: defaultName,
|
||||
|
||||
@@ -242,18 +242,17 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref, onUnmounted, computed } from 'vue'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { message } from 'ant-design-vue'
|
||||
import {
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
FileTextOutlined,
|
||||
SettingOutlined,
|
||||
ClockCircleOutlined,
|
||||
FileSearchOutlined,
|
||||
FileTextOutlined,
|
||||
PlusOutlined,
|
||||
ReloadOutlined,
|
||||
SettingOutlined,
|
||||
UserOutlined,
|
||||
CheckCircleFilled,
|
||||
} from '@ant-design/icons-vue'
|
||||
import ScriptTable from '@/components/ScriptTable.vue'
|
||||
import type { Script, ScriptType, User } from '@/types/script'
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
{
|
||||
"extends": "./tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "ES2020",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "Node",
|
||||
"strict": true,
|
||||
"outDir": "dist-electron",
|
||||
|
||||
"rootDir": "electron",
|
||||
"outDir": "dist-electron",
|
||||
|
||||
"esModuleInterop": true,
|
||||
"types": ["node", "electron"]
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"types": ["node", "electron"],
|
||||
|
||||
// 仅供 IDE 跳转可选加入(不影响运行)
|
||||
"baseUrl": ".",
|
||||
"paths": { "@/*": ["./src/*"] },
|
||||
|
||||
// 关键:不要把 ESM import 原样保留,交给 TS 转成 require
|
||||
"verbatimModuleSyntax": false
|
||||
},
|
||||
"include": ["electron"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user