hookehuyr

✨ feat: 微信增强数据结构调整,分享slogan和封面设置获取

...@@ -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 15:07:28 5 + * @LastEditTime: 2023-03-13 16:50:00
6 * @FilePath: /data-table/src/App.vue 6 * @FilePath: /data-table/src/App.vue
7 * @Description: 7 * @Description:
8 --> 8 -->
...@@ -73,10 +73,18 @@ onMounted(async () => { ...@@ -73,10 +73,18 @@ onMounted(async () => {
73 } 73 }
74 // 缓存表单设置 74 // 缓存表单设置
75 store.changeFormSetting(form_setting); 75 store.changeFormSetting(form_setting);
76 + // 没有授权判断
77 + const no_auth_info = form_setting.wxzq_enable && !form_setting.x_field_weixin_openid;
78 + const no_preview_model = model !== 'preview';
76 // 需要网页授权-必须要域名相同,需要上传到线上测试 79 // 需要网页授权-必须要域名相同,需要上传到线上测试
77 - if (!import.meta.env.DEV && form_setting.wxzq_enable && !form_setting.x_field_weixin_openid) { 80 + /**
81 + * 微信公众号授权模式
82 + * 空字符串=不授权,snsapi_base=静默授权,snsapi_userinfo=显式授权
83 + */
84 + // 非测试环境,没有授权信息,需要授权
85 + if (!import.meta.env.DEV && no_auth_info && form_setting.wxzq_scope) {
78 // 预览模式不开启 86 // 预览模式不开启
79 - if (model !== 'preview') { 87 + if (no_preview_model) {
80 $router.replace({ 88 $router.replace({
81 path: '/auth', 89 path: '/auth',
82 query: { 90 query: {
...@@ -86,9 +94,8 @@ onMounted(async () => { ...@@ -86,9 +94,8 @@ onMounted(async () => {
86 }); 94 });
87 } 95 }
88 } else { 96 } else {
89 - // 微信分享打开并且openid存在时,开启wx授权功能 97 + // 启用分享功能,非预览模式
90 - // 预览模式不开启 98 + if (form_setting.wxzq_is_share && no_preview_model) {
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 }); 99 const wxJs = await wxJsAPI({ form_code: code, url: raw_url });
93 wxJs.data.jsApiList = apiList; 100 wxJs.data.jsApiList = apiList;
94 wx.config(wxJs.data); 101 wx.config(wxJs.data);
...@@ -100,8 +107,8 @@ onMounted(async () => { ...@@ -100,8 +107,8 @@ onMounted(async () => {
100 }); 107 });
101 } 108 }
102 // 判断跳转页面 109 // 判断跳转页面
103 - if (!form_setting.sjsj_enable) { 110 + if (form_setting.sjsj_enable === 0 && !form_setting.sjsj_enable) {
104 - // 表单已结束 111 + // 表单已结束 -
105 $router.push("/stop?status=disable"); 112 $router.push("/stop?status=disable");
106 } 113 }
107 // 开启后有开始和结束时间,不在时间范围的显示表单还未开始或者已经结束 114 // 开启后有开始和结束时间,不在时间范围的显示表单还未开始或者已经结束
......
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 17:54:18 4 + * @LastEditTime: 2023-03-13 15:51:55
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -285,11 +285,11 @@ onMounted(async () => { ...@@ -285,11 +285,11 @@ onMounted(async () => {
285 } 285 }
286 // 判断是否弹出密码输入框 286 // 判断是否弹出密码输入框
287 checkUserPassword(); 287 checkUserPassword();
288 - // 预览模式屏蔽微信授权 288 + // 启用分享功能,非预览模式
289 - if (model !== 'preview') { 289 + if (formSetting.value.wxzq_is_share && model !== 'preview') {
290 wx.ready(() => { 290 wx.ready(() => {
291 // 自定义分享内容 291 // 自定义分享内容
292 - sharePage({ title: form_name.value, desc: '表单收集' }); 292 + sharePage({ title: form_name.value, desc: formSetting.value.wxzq_share_slogan, imgUrl: formSetting.value.wxzq_share_logo });
293 }); 293 });
294 } 294 }
295 }); 295 });
......