hookehuyr

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

......@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2024-06-20 16:29:20
* @LastEditTime: 2024-06-20 17:21:09
* @FilePath: /data-table/src/App.vue
* @Description:
-->
......@@ -70,6 +70,7 @@ const is_iframe = computed(() => window.frames.length > 0);
onMounted(async () => {
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
const model = getUrlParams(location.href) ? getUrlParams(location.href).model : '';
const data_id = getUrlParams(location.href) ? getUrlParams(location.href).data_id : '';
const raw_url = encodeURIComponent(location.pathname + location.hash);
// 数据收集设置
const { data } = await getFormSettingAPI({ form_code: code });
......@@ -91,10 +92,18 @@ onMounted(async () => {
/**
* 微信公众号授权模式
* 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权
* is_back_user=true 说明后台用户登录了,可以忽略微信增强
* is_back_user 1. 后台用户已登录, 新增表单(无data_id), 为了记录 openid 如果有微信增强设置,则启用微信增强 2. 后台用户未登录, 启用微信增强
*/
const record_openid = false; // 是否记录open_id
if (!form_setting.is_back_user) { // 用户未登录
record_openid = true;
} else { // 用户已登录
if (!data_id) { // 新增表单
record_openid = true
}
}
// 非测试环境,没有授权信息,需要授权
if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope && !is_iframe.value && !form_setting.is_back_user) {
if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope && record_openid) {
// 预览模式不开启
if (no_preview_model) {
$router.replace({
......