fix: 修复通用脚本创建时,内容没有被正确获取;修复通用脚本用户添加时报错
This commit is contained in:
@@ -451,17 +451,8 @@ const handleConfirmTemplate = async () => {
|
|||||||
// 刷新脚本列表
|
// 刷新脚本列表
|
||||||
await loadScripts()
|
await loadScripts()
|
||||||
|
|
||||||
// 跳转到编辑页面
|
// 跳转到编辑页面,不传递state数据,让编辑页面从API重新加载最新配置
|
||||||
router.push({
|
router.push(`/scripts/${createResult.scriptId}/edit`)
|
||||||
path: `/scripts/${createResult.scriptId}/edit`,
|
|
||||||
state: {
|
|
||||||
scriptData: {
|
|
||||||
id: createResult.scriptId,
|
|
||||||
type: 'General',
|
|
||||||
config: createResult.data,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('使用模板创建脚本失败:', error)
|
console.error('使用模板创建脚本失败:', error)
|
||||||
|
|||||||
@@ -902,7 +902,8 @@
|
|||||||
<span class="switch-description">启用后将发送任务通知</span>
|
<span class="switch-description">启用后将发送任务通知</span>
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
<!-- 发送统计等可选通知 -->
|
|
||||||
|
<!-- 发送统计 -->
|
||||||
<a-row :gutter="24" style="margin-top: 16px">
|
<a-row :gutter="24" style="margin-top: 16px">
|
||||||
<a-col :span="6">
|
<a-col :span="6">
|
||||||
<span style="font-weight: 500">通知内容</span>
|
<span style="font-weight: 500">通知内容</span>
|
||||||
@@ -1128,7 +1129,6 @@ const getDefaultGeneralUserData = () => ({
|
|||||||
ToAddress: '',
|
ToAddress: '',
|
||||||
IfSendMail: false,
|
IfSendMail: false,
|
||||||
IfSendStatistic: false,
|
IfSendStatistic: false,
|
||||||
IfSendSixStar: false,
|
|
||||||
IfServerChan: false,
|
IfServerChan: false,
|
||||||
IfCompanyWebHookBot: false,
|
IfCompanyWebHookBot: false,
|
||||||
ServerChanKey: '',
|
ServerChanKey: '',
|
||||||
@@ -1322,10 +1322,18 @@ const handleSubmit = async () => {
|
|||||||
const { InfrastPath, ...infoWithoutInfrastPath } = formData.Info
|
const { InfrastPath, ...infoWithoutInfrastPath } = formData.Info
|
||||||
|
|
||||||
// 构建提交数据
|
// 构建提交数据
|
||||||
|
let notifyData = { ...formData.Notify }
|
||||||
|
|
||||||
|
// 如果是通用脚本,移除MAA专用的通知字段
|
||||||
|
if (scriptType.value === 'General') {
|
||||||
|
const { IfSendSixStar, ...generalNotify } = notifyData
|
||||||
|
notifyData = generalNotify
|
||||||
|
}
|
||||||
|
|
||||||
const userData = {
|
const userData = {
|
||||||
Info: { ...infoWithoutInfrastPath },
|
Info: { ...infoWithoutInfrastPath },
|
||||||
Task: { ...formData.Task },
|
Task: { ...formData.Task },
|
||||||
Notify: { ...formData.Notify },
|
Notify: notifyData,
|
||||||
Data: { ...formData.Data },
|
Data: { ...formData.Data },
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user