add
This commit is contained in:
@@ -190,7 +190,8 @@ import {
|
||||
CheckIcon,
|
||||
DocumentIcon
|
||||
} from '@heroicons/vue/24/outline'
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { ElMessage, ElMessageBox } from 'element-plus'
|
||||
import { useAliyunCaptcha } from '@/composables/useAliyunCaptcha'
|
||||
|
||||
const props = defineProps({
|
||||
formData: {
|
||||
@@ -210,6 +211,7 @@ const props = defineProps({
|
||||
const emit = defineEmits(['submit'])
|
||||
|
||||
const userStore = useUserStore()
|
||||
const { runWithCaptcha } = useAliyunCaptcha()
|
||||
|
||||
// 表单引用
|
||||
const enterpriseFormRef = ref()
|
||||
@@ -345,14 +347,21 @@ const sendCode = async () => {
|
||||
|
||||
sendingCode.value = true
|
||||
try {
|
||||
const result = await userStore.sendCode(form.value.legalPersonPhone, 'certification')
|
||||
if (result.success) {
|
||||
ElMessage.success('验证码发送成功')
|
||||
startCountdown()
|
||||
}
|
||||
await runWithCaptcha(
|
||||
async (captchaVerifyParam) => {
|
||||
return await userStore.sendCode(form.value.legalPersonPhone, 'certification', captchaVerifyParam)
|
||||
},
|
||||
(res) => {
|
||||
if (res.success) {
|
||||
ElMessage.success('验证码发送成功')
|
||||
startCountdown()
|
||||
} else {
|
||||
ElMessage.error(res?.error?.message || '验证码发送失败')
|
||||
}
|
||||
}
|
||||
)
|
||||
} catch (error) {
|
||||
console.error('验证码发送失败:', error)
|
||||
ElMessage.error('验证码发送失败,请重试')
|
||||
} finally {
|
||||
sendingCode.value = false
|
||||
}
|
||||
@@ -428,6 +437,19 @@ const submitForm = async () => {
|
||||
try {
|
||||
await enterpriseFormRef.value.validate()
|
||||
|
||||
// 显示确认对话框
|
||||
await ElMessageBox.confirm(
|
||||
'提交的信息必须为法人真实信息(包括手机号),如信息有误请联系客服。',
|
||||
'提交确认',
|
||||
{
|
||||
confirmButtonText: '确认提交',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
distinguishCancelAndClose: true,
|
||||
customClass: 'submit-confirm-dialog'
|
||||
}
|
||||
)
|
||||
|
||||
submitting.value = true
|
||||
|
||||
// Mock API 调用
|
||||
@@ -436,7 +458,10 @@ const submitForm = async () => {
|
||||
emit('submit', form.value)
|
||||
|
||||
} catch (error) {
|
||||
console.error('表单验证失败:', error)
|
||||
// 用户点击取消或关闭对话框,不处理
|
||||
if (error !== 'cancel' && error !== 'close') {
|
||||
console.error('表单验证失败:', error)
|
||||
}
|
||||
} finally {
|
||||
submitting.value = false
|
||||
}
|
||||
@@ -723,3 +748,51 @@ onUnmounted(() => {
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
/* 提交确认对话框样式 */
|
||||
.submit-confirm-dialog {
|
||||
max-width: 420px;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-message-box__message {
|
||||
font-size: 15px;
|
||||
line-height: 1.6;
|
||||
color: #606266;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-message-box__title {
|
||||
font-size: 18px;
|
||||
font-weight: 600;
|
||||
color: #303133;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-message-box__btns {
|
||||
padding-top: 20px;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-button--warning {
|
||||
background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
|
||||
border: none;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-button--warning:hover {
|
||||
background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
|
||||
transform: translateY(-1px);
|
||||
box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-button--default {
|
||||
border: 1px solid #dcdfe6;
|
||||
color: #606266;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.submit-confirm-dialog .el-button--default:hover {
|
||||
color: #409eff;
|
||||
border-color: #c6e2ff;
|
||||
background-color: #ecf5ff;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user