hookehuyr

fix 预览模式下屏蔽微信功能

......@@ -2,7 +2,7 @@
* @Author: hookehuyr hookehuyr@gmail.com
* @Date: 2022-05-26 23:52:36
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-03 11:12:26
* @LastEditTime: 2023-03-03 15:07:28
* @FilePath: /data-table/src/App.vue
* @Description:
-->
......@@ -60,10 +60,10 @@ watch(
// web端判断
const is_pc = computed(() => wxInfo().isPC);
// 预览模式不需要授权
const model = $route.query.model;
onMounted(async () => {
const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
const model = getUrlParams(location.href) ? getUrlParams(location.href).model : '';
const raw_url = encodeURIComponent(location.pathname + location.hash);
// 数据收集设置
const { data } = await getFormSettingAPI({ form_code: code });
......@@ -75,15 +75,30 @@ onMounted(async () => {
store.changeFormSetting(form_setting);
// 需要网页授权-必须要域名相同,需要上传到线上测试
if (!import.meta.env.DEV && form_setting.wxzq_enable && !form_setting.x_field_weixin_openid) {
if (model === 'preview') return false;
$router.replace({
path: '/auth',
query: {
href: location.hash,
code
}
});
// 预览模式不开启
if (model !== 'preview') {
$router.replace({
path: '/auth',
query: {
href: location.hash,
code
}
});
}
} else {
// 微信分享打开并且openid存在时,开启wx授权功能
// 预览模式不开启
if (form_setting.wxzq_enable && form_setting.x_field_weixin_openid && model !== 'preview') {
const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
wxJs.data.jsApiList = apiList;
wx.config(wxJs.data);
wx.ready(() => {
wx.showAllNonBaseMenuItem();
});
wx.error((err) => {
console.warn(err);
});
}
// 判断跳转页面
if (form_setting.sjsj_enable && !form_setting.sjsj_enable) {
// 表单已结束
......@@ -101,18 +116,6 @@ onMounted(async () => {
}
}
}
// 微信分享打开并且openid存在时,开启wx授权功能
if (form_setting.wxzq_enable && form_setting.x_field_weixin_openid) {
const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
wxJs.data.jsApiList = apiList;
wx.config(wxJs.data);
wx.ready(() => {
wx.showAllNonBaseMenuItem();
});
wx.error((err) => {
console.warn(err);
});
}
});
</script>
......
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-01 16:09:00
* @LastEditTime: 2023-03-03 15:10:05
* @FilePath: /data-table/src/components/TextField/index.vue
* @Description: 单行文本输入框
-->
......@@ -53,7 +53,11 @@ const scanType = (scan_type_code) => {
}
}
// 预览模式
const model = $route.query.model;
const clickRightIcon = async () => {
// 预览模式屏蔽微信授权
if (model === 'preview') return false;
wx.ready(() => {
wx.scanQRCode({
needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
......
<!--
* @Date: 2022-07-18 10:22:22
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-03-03 12:20:49
* @LastEditTime: 2023-03-03 15:09:56
* @FilePath: /data-table/src/views/index.vue
* @Description: 首页
-->
......@@ -285,10 +285,13 @@ onMounted(async () => {
}
// 判断是否弹出密码输入框
checkUserPassword();
wx.ready(() => {
// 自定义分享内容
sharePage({ title: form_name.value, desc: '活动报名' });
});
// 预览模式屏蔽微信授权
if (model !== 'preview') {
wx.ready(() => {
// 自定义分享内容
sharePage({ title: form_name.value, desc: '活动报名' });
});
}
});
// 打开轮询用户是否关注
......