Showing
1 changed file
with
19 additions
and
10 deletions
| ... | @@ -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: 2024-06-20 17:29:20 | 5 | + * @LastEditTime: 2024-06-20 17:40:51 |
| 6 | * @FilePath: /data-table/src/App.vue | 6 | * @FilePath: /data-table/src/App.vue |
| 7 | * @Description: | 7 | * @Description: |
| 8 | --> | 8 | --> |
| ... | @@ -81,20 +81,22 @@ onMounted(async () => { | ... | @@ -81,20 +81,22 @@ onMounted(async () => { |
| 81 | // 缓存表单设置 | 81 | // 缓存表单设置 |
| 82 | store.changeFormSetting(form_setting); | 82 | store.changeFormSetting(form_setting); |
| 83 | // 没有授权判断 | 83 | // 没有授权判断 |
| 84 | - let no_auth_info = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid; | 84 | + let open_auth = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid; |
| 85 | // iframe传值openid | 85 | // iframe传值openid |
| 86 | const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : ''; | 86 | const iframe_openid = getUrlParams(location.href) ? getUrlParams(location.href).openid : ''; |
| 87 | if (iframe_openid) { // 如果获取到iframe传值openid 不再校验授权 | 87 | if (iframe_openid) { // 如果获取到iframe传值openid 不再校验授权 |
| 88 | - no_auth_info = false; | 88 | + open_auth = false; |
| 89 | } | 89 | } |
| 90 | const no_preview_model = model !== 'preview'; | 90 | const no_preview_model = model !== 'preview'; |
| 91 | - // 需要网页授权-必须要域名相同,需要上传到线上测试 | 91 | + |
| 92 | + let record_openid = false; // 是否记录open_id | ||
| 93 | + | ||
| 92 | /** | 94 | /** |
| 93 | - * 微信公众号授权模式 | 95 | + * is_back_user 用户登录情况 |
| 94 | - * 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权 | 96 | + * 1. 后台用户已登录, 新增表单(无data_id), 为了记录 openid 如果有微信增强设置,则启用微信增强 |
| 95 | - * is_back_user 1. 后台用户已登录, 新增表单(无data_id), 为了记录 openid 如果有微信增强设置,则启用微信增强 2. 后台用户未登录, 启用微信增强 | 97 | + * 2. 后台用户未登录, 启用微信增强 |
| 96 | */ | 98 | */ |
| 97 | - let record_openid = false; // 是否记录open_id | 99 | + |
| 98 | if (!form_setting.is_back_user) { // 用户未登录 | 100 | if (!form_setting.is_back_user) { // 用户未登录 |
| 99 | record_openid = true; | 101 | record_openid = true; |
| 100 | } else { // 用户已登录 | 102 | } else { // 用户已登录 |
| ... | @@ -102,8 +104,15 @@ onMounted(async () => { | ... | @@ -102,8 +104,15 @@ onMounted(async () => { |
| 102 | record_openid = true | 104 | record_openid = true |
| 103 | } | 105 | } |
| 104 | } | 106 | } |
| 105 | - // 非测试环境,没有授权信息,需要授权 | 107 | + |
| 106 | - if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope && record_openid) { | 108 | + // 需要网页授权-必须要域名相同,需要上传到线上测试 |
| 109 | + /** | ||
| 110 | + * wxzq_scope 微信公众号授权模式 | ||
| 111 | + * 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权 | ||
| 112 | + */ | ||
| 113 | + | ||
| 114 | + // 非测试环境,没有openid信息,需要授权 | ||
| 115 | + if (!import.meta.env.DEV && open_auth && form_setting.wxzq_scope && record_openid) { | ||
| 107 | // 预览模式不开启 | 116 | // 预览模式不开启 |
| 108 | if (no_preview_model) { | 117 | if (no_preview_model) { |
| 109 | $router.replace({ | 118 | $router.replace({ | ... | ... |
-
Please register or login to post a comment