hookehuyr

🐞 fix(绑定手机操作): 优化绑定手机判断,把表单提交完成后操作提出来,优化处理

<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-26 10:29:41
* @LastEditTime: 2024-06-26 10:59:41
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
......@@ -154,7 +154,7 @@ import LoginBox from '@/components/LoginBox/index.vue';
// 获取表单设置
const store = mainStore();
const { formSetting, formInfo } = storeToRefs(store);
const { formSetting, formInfo, successInfo } = storeToRefs(store);
// web端判断封面图片高度
const is_pc = computed(() => wxInfo().isPC);
const PHeaderHeight = computed(() => {
......@@ -276,24 +276,7 @@ const onApprovalCancel = () => {
// TODO: 等待调试发送短信接口
const bind_tel_show = ref(false);
// setTimeout(() => {
// showConfirmDialog({
// title: '温馨提示',
// message:
// '您还没有绑定手机号,是否去绑定?',
// confirmButtonColor: styleColor.baseColor
// })
// .then(() => {
// // on confirm
// bind_tel_show.value = true;
// })
// .catch(() => {
// // on cancel
// });
// }, 2000);
const bindForm = ref(null);
const bindSubmit = () => {
bindForm.value.submit();
}
......@@ -305,9 +288,9 @@ const onBindSubmit = (values) => {
})
.then(res => {
if (res.data.code === 1) {
$router.push({
path: '/business/index'
});
bind_tel_show.value = false;
// 表单成功提交后续操作
successHandle();
} else {
console.warn(res.data);
Toast({
......@@ -927,6 +910,24 @@ const adjGroupData = (values) => { // 调整group组件的数据结构
const submitStatus = ref(false);
const successHandle = () => { // 表单成功提交后续操作
//在 iframe 中调用父页面中定义的变量 - Doris需要自由控制
let getChildVal = parent.parent.getChildVal;
if (getChildVal) {
getChildVal();
return false;
}
// 如果类型为跳转网页
if (successInfo.value.commit_action === 'url') {
window.location.href = successInfo.value.commit_url;
} else {
// 跳转成功页面
$router.push({
path: "/success",
});
}
}
const onSubmit = async (values) => {
// 表单数据处理
postData.value = preValidData(values);
......@@ -959,21 +960,25 @@ const onSubmit = async (values) => {
showSuccessToast("提交成功");
// 缓存表单返回值
store.changeSuccessInfo(result.data);
//在 iframe 中调用父页面中定义的变量 - Doris需要自由控制
let getChildVal = parent.parent.getChildVal;
if (getChildVal) {
getChildVal();
return false;
}
// 如果类型为跳转网页
if (result.data.commit_action === 'url') {
window.location.href = result.data.commit_url;
} else {
// 跳转成功页面
$router.push({
path: "/success",
});
// TODO:校验手机号绑定状态
let bind_status = false;
if (!bind_status) {
showConfirmDialog({
title: '温馨提示',
message: '您还没有绑定手机号,是否去绑定?',
confirmButtonColor: styleColor.baseColor,
cancelButtonText: '放弃'
})
.then(() => { // 确定去绑定手机号
bind_tel_show.value = true;
})
.catch(() => { // 放弃手机号绑定
// 表单成功提交后续操作
successHandle();
});
}
// 表单成功提交后续操作
successHandle();
} else {
// 提交按钮禁用状态
submitStatus.value = false;
......@@ -994,21 +999,8 @@ const onSubmit = async (values) => {
showSuccessToast("提交成功");
// 缓存表单返回值
store.changeSuccessInfo(result.data);
//在 iframe 中调用父页面中定义的变量 - Doris需要自由控制
let getChildVal = parent.parent.getChildVal;
if (getChildVal) {
getChildVal();
return false;
}
// 如果类型为跳转网页
if (result.data.commit_action === 'url') {
window.location.href = result.data.commit_url;
} else {
// 跳转成功页面
$router.push({
path: "/success",
});
}
// 表单成功提交后续操作
successHandle();
} else {
// 提交按钮禁用状态
submitStatus.value = false;
......