Showing
8 changed files
with
24 additions
and
44 deletions
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-06-09 13:32:44 | 3 | * @Date: 2022-06-09 13:32:44 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-13 15:51:52 | 5 | + * @LastEditTime: 2022-06-14 14:47:01 |
| 6 | * @FilePath: /tswj/src/api/wx/config.js | 6 | * @FilePath: /tswj/src/api/wx/config.js |
| 7 | * @Description: | 7 | * @Description: |
| 8 | */ | 8 | */ |
| ... | @@ -18,4 +18,3 @@ const Api = { | ... | @@ -18,4 +18,3 @@ const Api = { |
| 18 | * @returns {*} cfg | 18 | * @returns {*} cfg |
| 19 | */ | 19 | */ |
| 20 | export const wxJsAPI = (params) => fn(fetch.get(Api.WX_JSAPI, params)); | 20 | export const wxJsAPI = (params) => fn(fetch.get(Api.WX_JSAPI, params)); |
| 21 | -// export const wxJsAPI = () => fn(fetch.get(Api.WX_JSAPI, { url: 'http://voice.onwall.cn/f/voice/#' })); | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-06-13 17:42:32 | 2 | * @Date: 2022-06-13 17:42:32 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-06-14 14:30:13 | 4 | + * @LastEditTime: 2022-06-14 17:55:36 |
| 5 | * @FilePath: /tswj/src/composables/useShare.js | 5 | * @FilePath: /tswj/src/composables/useShare.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | import wx from 'weixin-js-sdk'; | 8 | import wx from 'weixin-js-sdk'; |
| 9 | 9 | ||
| 10 | -export const sharePage = (title = '童声无界', desc = '共读一本书,传递一份爱。') => { | 10 | +export const sharePage = ({title = '童声无界', desc = '共读一本书,传递一份爱。', imgUrl = 'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg'}) => { |
| 11 | - // 分享好友(微信好友或qq好友) | 11 | + console.warn(imgUrl); |
| 12 | - wx.updateAppMessageShareData({ | 12 | + const shareData = { |
| 13 | title, // 分享标题 | 13 | title, // 分享标题 |
| 14 | desc, // 分享描述 | 14 | desc, // 分享描述 |
| 15 | link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 | 15 | link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 |
| 16 | - imgUrl: 'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg', // 分享图标 | 16 | + imgUrl, // 分享图标 |
| 17 | success: function () { | 17 | success: function () { |
| 18 | // 用户确认分享后执行的回调函数 | 18 | // 用户确认分享后执行的回调函数 |
| 19 | console.warn('分享成功'); | 19 | console.warn('分享成功'); |
| ... | @@ -22,35 +22,11 @@ export const sharePage = (title = '童声无界', desc = '共读一本书,传 | ... | @@ -22,35 +22,11 @@ export const sharePage = (title = '童声无界', desc = '共读一本书,传 |
| 22 | // 用户取消分享后执行的回调函数 | 22 | // 用户取消分享后执行的回调函数 |
| 23 | console.warn('分享已取消'); | 23 | console.warn('分享已取消'); |
| 24 | } | 24 | } |
| 25 | - }); | ||
| 26 | - // 分享到朋友圈或qq空间 | ||
| 27 | - wx.updateTimelineShareData({ | ||
| 28 | - title, // 分享标题 | ||
| 29 | - desc, // 分享描述 | ||
| 30 | - link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 | ||
| 31 | - imgUrl: 'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg', // 分享图标 | ||
| 32 | - success: function () { | ||
| 33 | - // 用户确认分享后执行的回调函数 | ||
| 34 | - console.warn('分享成功'); | ||
| 35 | - }, | ||
| 36 | - cancel: function () { | ||
| 37 | - // 用户取消分享后执行的回调函数 | ||
| 38 | - console.warn('分享已取消'); | ||
| 39 | } | 25 | } |
| 40 | - }); | 26 | + // 分享好友(微信好友或qq好友) |
| 27 | + wx.updateAppMessageShareData(shareData); | ||
| 28 | + // 分享到朋友圈或qq空间 | ||
| 29 | + wx.updateTimelineShareData(shareData); | ||
| 41 | // 分享到腾讯微博 | 30 | // 分享到腾讯微博 |
| 42 | - wx.onMenuShareWeibo({ | 31 | + wx.onMenuShareWeibo(shareData); |
| 43 | - title, // 分享标题 | ||
| 44 | - desc, // 分享描述 | ||
| 45 | - link: location.origin + location.pathname + location.hash, // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致 | ||
| 46 | - imgUrl: 'http://voice.onwall.cn/f/voice/images/weixin_logo.jpg', // 分享图标 | ||
| 47 | - success: function () { | ||
| 48 | - // 用户确认分享后执行的回调函数 | ||
| 49 | - console.warn('分享成功'); | ||
| 50 | - }, | ||
| 51 | - cancel: function () { | ||
| 52 | - // 用户取消分享后执行的回调函数 | ||
| 53 | - console.warn('分享已取消'); | ||
| 54 | - } | ||
| 55 | - }); | ||
| 56 | } | 32 | } | ... | ... |
| ... | @@ -110,8 +110,13 @@ watch( | ... | @@ -110,8 +110,13 @@ watch( |
| 110 | ) | 110 | ) |
| 111 | /**************************************************/ | 111 | /**************************************************/ |
| 112 | 112 | ||
| 113 | -// TAG:微信分享 | 113 | +setTimeout(() => { |
| 114 | -sharePage(); | 114 | + // TAG:微信分享 |
| 115 | + sharePage(); | ||
| 116 | + // 测试自定义分享内容 | ||
| 117 | + // const title = kgInfo.value.multi_name ? `${kgInfo.value.multi_name[0]} ${kgInfo.value.multi_name[1]}` : kgInfo.value.name | ||
| 118 | + // sharePage({ title, imgUrl: kgInfo.value.logo }); | ||
| 119 | +}, 500) | ||
| 115 | </script> | 120 | </script> |
| 116 | 121 | ||
| 117 | <style lang="less" scoped> | 122 | <style lang="less" scoped> | ... | ... |
| ... | @@ -2,7 +2,7 @@ | ... | @@ -2,7 +2,7 @@ |
| 2 | * @Author: hookehuyr hookehuyr@gmail.com | 2 | * @Author: hookehuyr hookehuyr@gmail.com |
| 3 | * @Date: 2022-04-21 11:21:39 | 3 | * @Date: 2022-04-21 11:21:39 |
| 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 4 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 5 | - * @LastEditTime: 2022-06-14 14:31:39 | 5 | + * @LastEditTime: 2022-06-14 17:43:46 |
| 6 | * @FilePath: /tswj/src/views/client/chooseSchool.vue | 6 | * @FilePath: /tswj/src/views/client/chooseSchool.vue |
| 7 | * @Description: 选择学校列表 | 7 | * @Description: 选择学校列表 |
| 8 | --> | 8 | --> |
| ... | @@ -32,7 +32,7 @@ killPages(); | ... | @@ -32,7 +32,7 @@ killPages(); |
| 32 | onMounted(() => { | 32 | onMounted(() => { |
| 33 | const $route = useRoute(); | 33 | const $route = useRoute(); |
| 34 | // TAG:微信分享 | 34 | // TAG:微信分享 |
| 35 | - sharePage(); | 35 | + sharePage({}); |
| 36 | }) | 36 | }) |
| 37 | </script> | 37 | </script> |
| 38 | 38 | ... | ... |
| ... | @@ -23,7 +23,7 @@ import { oneCertAPI } from '@/api/C/donate' | ... | @@ -23,7 +23,7 @@ import { oneCertAPI } from '@/api/C/donate' |
| 23 | import { sharePage } from '@/composables/useShare.js' | 23 | import { sharePage } from '@/composables/useShare.js' |
| 24 | 24 | ||
| 25 | // TAG:微信分享 | 25 | // TAG:微信分享 |
| 26 | -sharePage(); | 26 | +sharePage({}); |
| 27 | const $route = useRoute(); | 27 | const $route = useRoute(); |
| 28 | 28 | ||
| 29 | // 捐款成功后,查询生成捐赠证书 | 29 | // 捐款成功后,查询生成捐赠证书 | ... | ... |
| ... | @@ -80,7 +80,7 @@ import { prepareDonateAPI } from '@/api/C/donate.js' | ... | @@ -80,7 +80,7 @@ import { prepareDonateAPI } from '@/api/C/donate.js' |
| 80 | import { sharePage } from '@/composables/useShare.js' | 80 | import { sharePage } from '@/composables/useShare.js' |
| 81 | 81 | ||
| 82 | // TAG:微信分享 | 82 | // TAG:微信分享 |
| 83 | -sharePage(); | 83 | +sharePage({}); |
| 84 | 84 | ||
| 85 | const { resetScrollTop } = useScrollTop(); // 页面滚动恢复 | 85 | const { resetScrollTop } = useScrollTop(); // 页面滚动恢复 |
| 86 | resetScrollTop('scrollTopPerson'); | 86 | resetScrollTop('scrollTopPerson'); | ... | ... |
| ... | @@ -52,7 +52,7 @@ import { prodInfoAPI } from '@/api/C/prod.js' | ... | @@ -52,7 +52,7 @@ import { prodInfoAPI } from '@/api/C/prod.js' |
| 52 | import { sharePage } from '@/composables/useShare.js' | 52 | import { sharePage } from '@/composables/useShare.js' |
| 53 | 53 | ||
| 54 | // TAG:微信分享 | 54 | // TAG:微信分享 |
| 55 | -sharePage(); | 55 | +sharePage({}); |
| 56 | 56 | ||
| 57 | const $route = useRoute(); | 57 | const $route = useRoute(); |
| 58 | const $router = useRouter(); | 58 | const $router = useRouter(); | ... | ... |
| ... | @@ -82,7 +82,7 @@ import { useDefaultPerf } from '@/composables'; | ... | @@ -82,7 +82,7 @@ import { useDefaultPerf } from '@/composables'; |
| 82 | 82 | ||
| 83 | import { sharePage } from '@/composables/useShare.js' | 83 | import { sharePage } from '@/composables/useShare.js' |
| 84 | // TAG:微信分享 | 84 | // TAG:微信分享 |
| 85 | -sharePage(); | 85 | +sharePage({}); |
| 86 | 86 | ||
| 87 | const $route = useRoute(); | 87 | const $route = useRoute(); |
| 88 | const $router = useRouter(); | 88 | const $router = useRouter(); | ... | ... |
-
Please register or login to post a comment