fix: 修复通用脚本创建时,内容没有被正确获取;修复通用脚本用户添加时报错

This commit is contained in:
2025-09-02 20:46:44 +08:00
parent 272fd9b425
commit 949044fcdb
2 changed files with 13 additions and 14 deletions

View File

@@ -451,17 +451,8 @@ const handleConfirmTemplate = async () => {
// 刷新脚本列表
await loadScripts()
// 跳转到编辑页面
router.push({
path: `/scripts/${createResult.scriptId}/edit`,
state: {
scriptData: {
id: createResult.scriptId,
type: 'General',
config: createResult.data,
},
},
})
// 跳转到编辑页面不传递state数据让编辑页面从API重新加载最新配置
router.push(`/scripts/${createResult.scriptId}/edit`)
}
} catch (error) {
console.error('使用模板创建脚本失败:', error)

View File

@@ -902,7 +902,8 @@
<span class="switch-description">启用后将发送任务通知</span>
</a-col>
</a-row>
<!-- 发送统计等可选通知 -->
<!-- 发送统计 -->
<a-row :gutter="24" style="margin-top: 16px">
<a-col :span="6">
<span style="font-weight: 500">通知内容</span>
@@ -1128,7 +1129,6 @@ const getDefaultGeneralUserData = () => ({
ToAddress: '',
IfSendMail: false,
IfSendStatistic: false,
IfSendSixStar: false,
IfServerChan: false,
IfCompanyWebHookBot: false,
ServerChanKey: '',
@@ -1322,10 +1322,18 @@ const handleSubmit = async () => {
const { InfrastPath, ...infoWithoutInfrastPath } = formData.Info
// 构建提交数据
let notifyData = { ...formData.Notify }
// 如果是通用脚本移除MAA专用的通知字段
if (scriptType.value === 'General') {
const { IfSendSixStar, ...generalNotify } = notifyData
notifyData = generalNotify
}
const userData = {
Info: { ...infoWithoutInfrastPath },
Task: { ...formData.Task },
Notify: { ...formData.Notify },
Notify: notifyData,
Data: { ...formData.Data },
}