hookehuyr

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

1 <!-- 1 <!--
2 * @Date: 2022-07-18 10:22:22 2 * @Date: 2022-07-18 10:22:22
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-26 10:29:41 4 + * @LastEditTime: 2024-06-26 10:59:41
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -154,7 +154,7 @@ import LoginBox from '@/components/LoginBox/index.vue'; ...@@ -154,7 +154,7 @@ import LoginBox from '@/components/LoginBox/index.vue';
154 154
155 // 获取表单设置 155 // 获取表单设置
156 const store = mainStore(); 156 const store = mainStore();
157 -const { formSetting, formInfo } = storeToRefs(store); 157 +const { formSetting, formInfo, successInfo } = storeToRefs(store);
158 // web端判断封面图片高度 158 // web端判断封面图片高度
159 const is_pc = computed(() => wxInfo().isPC); 159 const is_pc = computed(() => wxInfo().isPC);
160 const PHeaderHeight = computed(() => { 160 const PHeaderHeight = computed(() => {
...@@ -276,24 +276,7 @@ const onApprovalCancel = () => { ...@@ -276,24 +276,7 @@ const onApprovalCancel = () => {
276 276
277 // TODO: 等待调试发送短信接口 277 // TODO: 等待调试发送短信接口
278 const bind_tel_show = ref(false); 278 const bind_tel_show = ref(false);
279 -// setTimeout(() => {
280 -// showConfirmDialog({
281 -// title: '温馨提示',
282 -// message:
283 -// '您还没有绑定手机号,是否去绑定?',
284 -// confirmButtonColor: styleColor.baseColor
285 -// })
286 -// .then(() => {
287 -// // on confirm
288 -// bind_tel_show.value = true;
289 -// })
290 -// .catch(() => {
291 -// // on cancel
292 -// });
293 -// }, 2000);
294 -
295 const bindForm = ref(null); 279 const bindForm = ref(null);
296 -
297 const bindSubmit = () => { 280 const bindSubmit = () => {
298 bindForm.value.submit(); 281 bindForm.value.submit();
299 } 282 }
...@@ -305,9 +288,9 @@ const onBindSubmit = (values) => { ...@@ -305,9 +288,9 @@ const onBindSubmit = (values) => {
305 }) 288 })
306 .then(res => { 289 .then(res => {
307 if (res.data.code === 1) { 290 if (res.data.code === 1) {
308 - $router.push({ 291 + bind_tel_show.value = false;
309 - path: '/business/index' 292 + // 表单成功提交后续操作
310 - }); 293 + successHandle();
311 } else { 294 } else {
312 console.warn(res.data); 295 console.warn(res.data);
313 Toast({ 296 Toast({
...@@ -927,6 +910,24 @@ const adjGroupData = (values) => { // 调整group组件的数据结构 ...@@ -927,6 +910,24 @@ const adjGroupData = (values) => { // 调整group组件的数据结构
927 910
928 const submitStatus = ref(false); 911 const submitStatus = ref(false);
929 912
913 +const successHandle = () => { // 表单成功提交后续操作
914 + //在 iframe 中调用父页面中定义的变量 - Doris需要自由控制
915 + let getChildVal = parent.parent.getChildVal;
916 + if (getChildVal) {
917 + getChildVal();
918 + return false;
919 + }
920 + // 如果类型为跳转网页
921 + if (successInfo.value.commit_action === 'url') {
922 + window.location.href = successInfo.value.commit_url;
923 + } else {
924 + // 跳转成功页面
925 + $router.push({
926 + path: "/success",
927 + });
928 + }
929 +}
930 +
930 const onSubmit = async (values) => { 931 const onSubmit = async (values) => {
931 // 表单数据处理 932 // 表单数据处理
932 postData.value = preValidData(values); 933 postData.value = preValidData(values);
...@@ -959,21 +960,25 @@ const onSubmit = async (values) => { ...@@ -959,21 +960,25 @@ const onSubmit = async (values) => {
959 showSuccessToast("提交成功"); 960 showSuccessToast("提交成功");
960 // 缓存表单返回值 961 // 缓存表单返回值
961 store.changeSuccessInfo(result.data); 962 store.changeSuccessInfo(result.data);
962 - //在 iframe 中调用父页面中定义的变量 - Doris需要自由控制 963 + // TODO:校验手机号绑定状态
963 - let getChildVal = parent.parent.getChildVal; 964 + let bind_status = false;
964 - if (getChildVal) { 965 + if (!bind_status) {
965 - getChildVal(); 966 + showConfirmDialog({
966 - return false; 967 + title: '温馨提示',
967 - } 968 + message: '您还没有绑定手机号,是否去绑定?',
968 - // 如果类型为跳转网页 969 + confirmButtonColor: styleColor.baseColor,
969 - if (result.data.commit_action === 'url') { 970 + cancelButtonText: '放弃'
970 - window.location.href = result.data.commit_url; 971 + })
971 - } else { 972 + .then(() => { // 确定去绑定手机号
972 - // 跳转成功页面 973 + bind_tel_show.value = true;
973 - $router.push({ 974 + })
974 - path: "/success", 975 + .catch(() => { // 放弃手机号绑定
976 + // 表单成功提交后续操作
977 + successHandle();
975 }); 978 });
976 } 979 }
980 + // 表单成功提交后续操作
981 + successHandle();
977 } else { 982 } else {
978 // 提交按钮禁用状态 983 // 提交按钮禁用状态
979 submitStatus.value = false; 984 submitStatus.value = false;
...@@ -994,21 +999,8 @@ const onSubmit = async (values) => { ...@@ -994,21 +999,8 @@ const onSubmit = async (values) => {
994 showSuccessToast("提交成功"); 999 showSuccessToast("提交成功");
995 // 缓存表单返回值 1000 // 缓存表单返回值
996 store.changeSuccessInfo(result.data); 1001 store.changeSuccessInfo(result.data);
997 - //在 iframe 中调用父页面中定义的变量 - Doris需要自由控制 1002 + // 表单成功提交后续操作
998 - let getChildVal = parent.parent.getChildVal; 1003 + successHandle();
999 - if (getChildVal) {
1000 - getChildVal();
1001 - return false;
1002 - }
1003 - // 如果类型为跳转网页
1004 - if (result.data.commit_action === 'url') {
1005 - window.location.href = result.data.commit_url;
1006 - } else {
1007 - // 跳转成功页面
1008 - $router.push({
1009 - path: "/success",
1010 - });
1011 - }
1012 } else { 1004 } else {
1013 // 提交按钮禁用状态 1005 // 提交按钮禁用状态
1014 submitStatus.value = false; 1006 submitStatus.value = false;
......