hookehuyr

✨ feat: iframe时判断授权,从URL上面获取openid值

...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
2 * @Author: hookehuyr hookehuyr@gmail.com 2 * @Author: hookehuyr hookehuyr@gmail.com
3 * @Date: 2022-05-26 23:52:36 3 * @Date: 2022-05-26 23:52:36
4 * @LastEditors: hookehuyr hookehuyr@gmail.com 4 * @LastEditors: hookehuyr hookehuyr@gmail.com
5 - * @LastEditTime: 2023-03-28 14:04:03 5 + * @LastEditTime: 2023-05-22 18:03:29
6 * @FilePath: /data-table/src/App.vue 6 * @FilePath: /data-table/src/App.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -76,7 +76,12 @@ onMounted(async () => { ...@@ -76,7 +76,12 @@ onMounted(async () => {
76 // 缓存表单设置 76 // 缓存表单设置
77 store.changeFormSetting(form_setting); 77 store.changeFormSetting(form_setting);
78 // 没有授权判断 78 // 没有授权判断
79 - const no_auth_info = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid; 79 + let no_auth_info = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid;
80 + // iframe传值openid
81 + const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : '';
82 + if (iframe_openid) { // 如果获取到iframe传值openid 不再校验授权
83 + no_auth_info = false;
84 + }
80 const no_preview_model = model !== 'preview'; 85 const no_preview_model = model !== 'preview';
81 // 需要网页授权-必须要域名相同,需要上传到线上测试 86 // 需要网页授权-必须要域名相同,需要上传到线上测试
82 /** 87 /**
......
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: 2023-05-16 21:51:49 4 + * @LastEditTime: 2023-05-22 17:55:53
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -518,10 +518,13 @@ const onSubmit = async (values) => { ...@@ -518,10 +518,13 @@ const onSubmit = async (values) => {
518 if (model === 'edit' || model === 'preview') return false; 518 if (model === 'edit' || model === 'preview') return false;
519 // 提交按钮禁用 519 // 提交按钮禁用
520 submitStatus.value = true; 520 submitStatus.value = true;
521 + // iframe传值openid
522 + const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : '';
521 // 通过验证 523 // 通过验证
522 const result = await addFormDataAPI({ 524 const result = await addFormDataAPI({
523 form_code: $route.query.code, 525 form_code: $route.query.code,
524 data: postData.value, 526 data: postData.value,
527 + openid: iframe_openid
525 }); 528 });
526 if (result.code) { 529 if (result.code) {
527 // 提交按钮禁用状态 530 // 提交按钮禁用状态
......