hookehuyr

根据后台登录情况判断是否跳转授权页

...@@ -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 16:29:20 5 + * @LastEditTime: 2024-06-20 17:21:09
6 * @FilePath: /data-table/src/App.vue 6 * @FilePath: /data-table/src/App.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -70,6 +70,7 @@ const is_iframe = computed(() => window.frames.length > 0); ...@@ -70,6 +70,7 @@ const is_iframe = computed(() => window.frames.length > 0);
70 onMounted(async () => { 70 onMounted(async () => {
71 const code = getUrlParams(location.href) ? getUrlParams(location.href).code : ''; 71 const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
72 const model = getUrlParams(location.href) ? getUrlParams(location.href).model : ''; 72 const model = getUrlParams(location.href) ? getUrlParams(location.href).model : '';
73 + const data_id = getUrlParams(location.href) ? getUrlParams(location.href).data_id : '';
73 const raw_url = encodeURIComponent(location.pathname + location.hash); 74 const raw_url = encodeURIComponent(location.pathname + location.hash);
74 // 数据收集设置 75 // 数据收集设置
75 const { data } = await getFormSettingAPI({ form_code: code }); 76 const { data } = await getFormSettingAPI({ form_code: code });
...@@ -91,10 +92,18 @@ onMounted(async () => { ...@@ -91,10 +92,18 @@ onMounted(async () => {
91 /** 92 /**
92 * 微信公众号授权模式 93 * 微信公众号授权模式
93 * 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权 94 * 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权
94 - * is_back_user=true 说明后台用户登录了,可以忽略微信增强 95 + * is_back_user 1. 后台用户已登录, 新增表单(无data_id), 为了记录 openid 如果有微信增强设置,则启用微信增强 2. 后台用户未登录, 启用微信增强
95 */ 96 */
97 + const record_openid = false; // 是否记录open_id
98 + if (!form_setting.is_back_user) { // 用户未登录
99 + record_openid = true;
100 + } else { // 用户已登录
101 + if (!data_id) { // 新增表单
102 + record_openid = true
103 + }
104 + }
96 // 非测试环境,没有授权信息,需要授权 105 // 非测试环境,没有授权信息,需要授权
97 - if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope && !is_iframe.value && !form_setting.is_back_user) { 106 + if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope && record_openid) {
98 // 预览模式不开启 107 // 预览模式不开启
99 if (no_preview_model) { 108 if (no_preview_model) {
100 $router.replace({ 109 $router.replace({
......