Revert "fix: 复原疑似被误处理的文件"

This reverts commit 42710ecf60.
This commit is contained in:
2025-09-02 00:02:43 +08:00
parent 76aff5d627
commit 1d02894957
2 changed files with 62 additions and 23 deletions

View File

@@ -1047,6 +1047,7 @@ const getDefaultMAAUserData = () => ({
Status: true,
Mode: 'MAA',
InfrastMode: '默认',
InfrastPath: '',
Routine: true,
Annihilation: '当期',
Stage: '1-7',
@@ -1057,6 +1058,11 @@ const getDefaultMAAUserData = () => ({
Stage_Remain: '',
IfSkland: false,
SklandToken: '',
// 添加 General 脚本的属性以确保兼容性
IfScriptBeforeTask: false,
IfScriptAfterTask: false,
ScriptBeforeTask: '',
ScriptAfterTask: '',
},
Task: {
IfBase: true,
@@ -1108,6 +1114,7 @@ const getDefaultGeneralUserData = () => ({
ToAddress: '',
IfSendMail: false,
IfSendStatistic: false,
IfSendSixStar: false,
IfServerChan: false,
IfCompanyWebHookBot: false,
ServerChanKey: '',
@@ -1132,7 +1139,7 @@ const formData = reactive({
userName: '',
userId: '',
// 嵌套的实际数据
...getDefaultUserData(),
...getDefaultMAAUserData(),
})
// 表单验证规则
@@ -1187,10 +1194,20 @@ const loadScriptInfo = async () => {
scriptType.value = script.type // 设置脚本类型
// 重新初始化表单数据(根据脚本类型)
const defaultData =
scriptType.value === 'MAA' ? getDefaultMAAUserData() : getDefaultGeneralUserData()
// 清空现有数据并重新赋值
Object.keys(formData).forEach(key => {
if (key !== 'userName' && key !== 'userId') {
delete formData[key]
}
})
Object.assign(formData, {
userName: '',
userId: '',
...getDefaultUserData(),
...defaultData,
})
// 如果是编辑模式,加载用户数据