优化
This commit is contained in:
@@ -54,17 +54,27 @@ async function handleSave() {
|
||||
|
||||
savingPrompt.value = true
|
||||
try {
|
||||
// 确保 content 字段有值
|
||||
const content = savePromptForm.value.content?.trim() || ''
|
||||
if (!content) {
|
||||
message.error('提示词内容不能为空')
|
||||
savingPrompt.value = false
|
||||
return
|
||||
}
|
||||
|
||||
const payload = {
|
||||
userId: userId,
|
||||
name: savePromptForm.value.name.trim(),
|
||||
content: savePromptForm.value.content.trim(),
|
||||
category: savePromptForm.value.category.trim() || null,
|
||||
content: content, // 确保 content 有值
|
||||
category: savePromptForm.value.category?.trim() || null,
|
||||
isPublic: false,
|
||||
sort: 0,
|
||||
useCount: 0,
|
||||
status: 1,
|
||||
}
|
||||
|
||||
console.log('[SavePromptModal] 发送请求参数:', payload)
|
||||
|
||||
const response = await UserPromptApi.createUserPrompt(payload)
|
||||
|
||||
if (response && (response.code === 0 || response.code === 200)) {
|
||||
|
||||
Reference in New Issue
Block a user