Commit ddaeee86 authored by shirlyn.guo's avatar shirlyn.guo 🤡

chore: 定制数据提交

parent 1731e7c4
import { request } from '@/utils/request'
// 声音与数字人形象定制资料填写
export function uploadVoiceCharacterCustomize<T>(payload: {
customServiceType: 'VOICE_FIGURE'
companyName: string
contactName: string
contactInformation: string
}) {
return request.post<T>('/bizCustomServiceRetentionRest/submitInfo.json', payload)
}
...@@ -3,6 +3,14 @@ import type { FormInst, FormItemRule, FormRules } from 'naive-ui' ...@@ -3,6 +3,14 @@ import type { FormInst, FormItemRule, FormRules } from 'naive-ui'
import { ref, shallowReadonly, useTemplateRef } from 'vue' import { ref, shallowReadonly, useTemplateRef } from 'vue'
import isMobilePhone from 'validator/es/lib/isMobilePhone' import isMobilePhone from 'validator/es/lib/isMobilePhone'
import isEmail from 'validator/es/lib/isEmail' import isEmail from 'validator/es/lib/isEmail'
import { uploadVoiceCharacterCustomize } from '@/apis/custom'
interface CustomizeInfoPayload {
customServiceType: 'VOICE_FIGURE'
companyName: string
contactName: string
contactInformation: string
}
const isShowVoiceCharacterCustomizeModal = defineModel<boolean>('isShowVoiceCharacterCustomizeModal', { const isShowVoiceCharacterCustomizeModal = defineModel<boolean>('isShowVoiceCharacterCustomizeModal', {
default: false, default: false,
...@@ -12,7 +20,7 @@ const customizeInfoFormRef = useTemplateRef<FormInst>('customizeInfoFormRef') ...@@ -12,7 +20,7 @@ const customizeInfoFormRef = useTemplateRef<FormInst>('customizeInfoFormRef')
const customizeInfoForm = ref({ const customizeInfoForm = ref({
companyName: '', companyName: '',
contactsName: '', contactName: '',
contactInformation: '', contactInformation: '',
}) })
...@@ -30,7 +38,7 @@ const customizeInfoFormRules = shallowReadonly<FormRules>({ ...@@ -30,7 +38,7 @@ const customizeInfoFormRules = shallowReadonly<FormRules>({
return return
}, },
}, },
contactsName: { contactName: {
required: true, required: true,
trigger: 'blur', trigger: 'blur',
validator: (_rule: FormItemRule, value: string) => { validator: (_rule: FormItemRule, value: string) => {
...@@ -77,11 +85,21 @@ function handleCustomizeInfoSubmit() { ...@@ -77,11 +85,21 @@ function handleCustomizeInfoSubmit() {
customizeSubmitBtnLoading.value = true customizeSubmitBtnLoading.value = true
console.log(customizeInfoForm.value) let payload: CustomizeInfoPayload = {
customServiceType: 'VOICE_FIGURE',
...customizeInfoForm.value,
}
uploadVoiceCharacterCustomize(payload)
.then(() => {
window.$message.success('提交成功')
})
.catch(() => {
window.$message.error('提交失敗,請重新提交')
})
.finally(() => {
customizeSubmitBtnLoading.value = false customizeSubmitBtnLoading.value = false
isShowVoiceCharacterCustomizeModal.value = false isShowVoiceCharacterCustomizeModal.value = false
window.$message.success('提交成功') })
}) })
} }
...@@ -90,7 +108,7 @@ function onModalAfterLeave() { ...@@ -90,7 +108,7 @@ function onModalAfterLeave() {
customizeInfoForm.value = { customizeInfoForm.value = {
companyName: '', companyName: '',
contactsName: '', contactName: '',
contactInformation: '', contactInformation: '',
} }
} }
...@@ -116,8 +134,8 @@ function onModalAfterLeave() { ...@@ -116,8 +134,8 @@ function onModalAfterLeave() {
<n-form-item label="公司名稱" path="companyName"> <n-form-item label="公司名稱" path="companyName">
<n-input v-model:value="customizeInfoForm.companyName" placeholder="請輸入公司名稱" /> <n-input v-model:value="customizeInfoForm.companyName" placeholder="請輸入公司名稱" />
</n-form-item> </n-form-item>
<n-form-item label="聯系人姓名" path="contactsName"> <n-form-item label="聯系人姓名" path="contactName">
<n-input v-model:value="customizeInfoForm.contactsName" placeholder="請輸入聯系人姓名" /> <n-input v-model:value="customizeInfoForm.contactName" placeholder="請輸入聯系人姓名" />
</n-form-item> </n-form-item>
<n-form-item label="聯系方式" path="contactInformation"> <n-form-item label="聯系方式" path="contactInformation">
<n-input <n-input
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment