非空判断
This commit is contained in:
@@ -164,6 +164,12 @@ const onSubmit = async () => {
|
||||
return;
|
||||
}
|
||||
|
||||
// 额外验证话术内容
|
||||
if (!state.formData.description || state.formData.description === '<p><br></p>' || state.formData.description.trim() === '<p><br></p>') {
|
||||
ElMessage.warning('产品详情内容不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
// 根据ID判断是新增还是修改
|
||||
if (state.formData.id === 0) {
|
||||
// 新增产品
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
</el-col>
|
||||
<!-- 富文本编辑器 -->
|
||||
<el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24" class="mb20">
|
||||
<el-form-item label="产品详情" prop="content">
|
||||
<el-form-item label="话术" prop="content">
|
||||
<Editor v-model="formData.content" height="400px" :key="editorKey" placeholder="请输入产品详情" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
@@ -133,10 +133,17 @@ const onSubmit = async () => {
|
||||
const valid = await formRef.value.validate();
|
||||
if (!valid) return;
|
||||
|
||||
// 额外验证话术内容
|
||||
if (!state.formData.content || state.formData.content === '<p><br></p>' || state.formData.content.trim() === '<p><br></p>') {
|
||||
ElMessage.warning('话术内容不能为空');
|
||||
return;
|
||||
}
|
||||
|
||||
state.loading = true;
|
||||
|
||||
if (state.formData.id === 0) {
|
||||
// 新增模式
|
||||
console.log(state.formData.content, '话术内容');
|
||||
await getscriptAdd(state.formData);
|
||||
ElMessage.success('添加成功');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user