diff --git a/.DS_Store b/.DS_Store index 0fe8cbb..24717fe 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/App.vue b/App.vue index 73069f9..f79aea0 100644 --- a/App.vue +++ b/App.vue @@ -3,7 +3,9 @@ import { reactive, inject, onMounted } from 'vue'; import { onLaunch, onShow, onHide } from '@dcloudio/uni-app'; import useUserStore from './stores/useUserStore'; import useDictStore from './stores/useDictStore'; +import { setupWechatShare, generateShareLink } from '@/utils/wechatShare.js'; const { $api, navTo, appendScriptTagElement } = inject('globalFunction'); +import config from '@/config.js'; onLaunch((options) => { useDictStore().getDictData(); @@ -26,15 +28,10 @@ onLaunch((options) => { onMounted(() => { // #ifndef MP-WEIXIN - if (process.env.NODE_ENV === 'development') { - appendScriptTagElement('./static/js/jweixin-1.4.0.js').then(() => { - console.log('✅ 微信 JSSDK 加载完成'); - }); - } else { - appendScriptTagElement('/static/js/jweixin-1.4.0.js').then(() => { - console.log('✅ 微信 JSSDK 加载完成'); - }); - } + appendScriptTagElement('https://qd.zhaopinzao8dian.com/file/csn/jweixin-1.4.0.js').then(() => { + console.log('✅ 微信 JSSDK 加载完成'); + signatureFn(); + }); // #endif }); @@ -45,6 +42,17 @@ onShow(() => { onHide(() => { console.log('App Hide'); }); + +function signatureFn() { + const link = generateShareLink(); + // console.log('首页link:', link); + setupWechatShare({ + title: config.shareConfig.title, + desc: config.shareConfig.desc, + link: link, + imgUrl: config.shareConfig.imgUrl, + }); +}