hookehuyr

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

...@@ -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-03 11:12:26 5 + * @LastEditTime: 2023-03-03 15:07:28
6 * @FilePath: /data-table/src/App.vue 6 * @FilePath: /data-table/src/App.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -60,10 +60,10 @@ watch( ...@@ -60,10 +60,10 @@ watch(
60 60
61 // web端判断 61 // web端判断
62 const is_pc = computed(() => wxInfo().isPC); 62 const is_pc = computed(() => wxInfo().isPC);
63 -// 预览模式不需要授权 63 +
64 -const model = $route.query.model;
65 onMounted(async () => { 64 onMounted(async () => {
66 const code = getUrlParams(location.href) ? getUrlParams(location.href).code : ''; 65 const code = getUrlParams(location.href) ? getUrlParams(location.href).code : '';
66 + const model = getUrlParams(location.href) ? getUrlParams(location.href).model : '';
67 const raw_url = encodeURIComponent(location.pathname + location.hash); 67 const raw_url = encodeURIComponent(location.pathname + location.hash);
68 // 数据收集设置 68 // 数据收集设置
69 const { data } = await getFormSettingAPI({ form_code: code }); 69 const { data } = await getFormSettingAPI({ form_code: code });
...@@ -75,7 +75,8 @@ onMounted(async () => { ...@@ -75,7 +75,8 @@ onMounted(async () => {
75 store.changeFormSetting(form_setting); 75 store.changeFormSetting(form_setting);
76 // 需要网页授权-必须要域名相同,需要上传到线上测试 76 // 需要网页授权-必须要域名相同,需要上传到线上测试
77 if (!import.meta.env.DEV && form_setting.wxzq_enable && !form_setting.x_field_weixin_openid) { 77 if (!import.meta.env.DEV && form_setting.wxzq_enable && !form_setting.x_field_weixin_openid) {
78 - if (model === 'preview') return false; 78 + // 预览模式不开启
79 + if (model !== 'preview') {
79 $router.replace({ 80 $router.replace({
80 path: '/auth', 81 path: '/auth',
81 query: { 82 query: {
...@@ -83,7 +84,21 @@ onMounted(async () => { ...@@ -83,7 +84,21 @@ onMounted(async () => {
83 code 84 code
84 } 85 }
85 }); 86 });
87 + }
86 } else { 88 } else {
89 + // 微信分享打开并且openid存在时,开启wx授权功能
90 + // 预览模式不开启
91 + if (form_setting.wxzq_enable && form_setting.x_field_weixin_openid && model !== 'preview') {
92 + const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
93 + wxJs.data.jsApiList = apiList;
94 + wx.config(wxJs.data);
95 + wx.ready(() => {
96 + wx.showAllNonBaseMenuItem();
97 + });
98 + wx.error((err) => {
99 + console.warn(err);
100 + });
101 + }
87 // 判断跳转页面 102 // 判断跳转页面
88 if (form_setting.sjsj_enable && !form_setting.sjsj_enable) { 103 if (form_setting.sjsj_enable && !form_setting.sjsj_enable) {
89 // 表单已结束 104 // 表单已结束
...@@ -101,18 +116,6 @@ onMounted(async () => { ...@@ -101,18 +116,6 @@ onMounted(async () => {
101 } 116 }
102 } 117 }
103 } 118 }
104 - // 微信分享打开并且openid存在时,开启wx授权功能
105 - if (form_setting.wxzq_enable && form_setting.x_field_weixin_openid) {
106 - const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
107 - wxJs.data.jsApiList = apiList;
108 - wx.config(wxJs.data);
109 - wx.ready(() => {
110 - wx.showAllNonBaseMenuItem();
111 - });
112 - wx.error((err) => {
113 - console.warn(err);
114 - });
115 - }
116 }); 119 });
117 </script> 120 </script>
118 121
......
1 <!-- 1 <!--
2 * @Date: 2022-08-29 14:31:20 2 * @Date: 2022-08-29 14:31:20
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2023-03-01 16:09:00 4 + * @LastEditTime: 2023-03-03 15:10:05
5 * @FilePath: /data-table/src/components/TextField/index.vue 5 * @FilePath: /data-table/src/components/TextField/index.vue
6 * @Description: 单行文本输入框 6 * @Description: 单行文本输入框
7 --> 7 -->
...@@ -53,7 +53,11 @@ const scanType = (scan_type_code) => { ...@@ -53,7 +53,11 @@ const scanType = (scan_type_code) => {
53 } 53 }
54 } 54 }
55 55
56 +// 预览模式
57 +const model = $route.query.model;
56 const clickRightIcon = async () => { 58 const clickRightIcon = async () => {
59 + // 预览模式屏蔽微信授权
60 + if (model === 'preview') return false;
57 wx.ready(() => { 61 wx.ready(() => {
58 wx.scanQRCode({ 62 wx.scanQRCode({
59 needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果, 63 needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
......
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-03-03 12:20:49 4 + * @LastEditTime: 2023-03-03 15:09:56
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -285,10 +285,13 @@ onMounted(async () => { ...@@ -285,10 +285,13 @@ onMounted(async () => {
285 } 285 }
286 // 判断是否弹出密码输入框 286 // 判断是否弹出密码输入框
287 checkUserPassword(); 287 checkUserPassword();
288 + // 预览模式屏蔽微信授权
289 + if (model !== 'preview') {
288 wx.ready(() => { 290 wx.ready(() => {
289 // 自定义分享内容 291 // 自定义分享内容
290 sharePage({ title: form_name.value, desc: '活动报名' }); 292 sharePage({ title: form_name.value, desc: '活动报名' });
291 }); 293 });
294 + }
292 }); 295 });
293 296
294 // 打开轮询用户是否关注 297 // 打开轮询用户是否关注
......