|
@@ -8,6 +8,7 @@
|
|
|
import { useCookies } from '@vueuse/integrations/useCookies';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
import { useI18n } from 'vue-i18n';
|
|
|
+ import jsonp from 'jsonp'
|
|
|
const userStore = useUserStore();
|
|
|
const { t } = useI18n();
|
|
|
const wxOpenId = computed(() => {
|
|
@@ -36,6 +37,7 @@
|
|
|
useCookies().set('wxOpenId', '');
|
|
|
getCodeApi(123);
|
|
|
}
|
|
|
+ wxShare();
|
|
|
});
|
|
|
function getUrlKey(name) {
|
|
|
//获取url 参数
|
|
@@ -45,6 +47,67 @@
|
|
|
) || null
|
|
|
);
|
|
|
}
|
|
|
+ function wxShare() {
|
|
|
+ wxShare () {
|
|
|
+
|
|
|
+ let url = window.location.href.split('#')[0]
|
|
|
+ if(window.location.ancestorOrigins){url = window.location.ancestorOrigins[0]}
|
|
|
+ jsonp('https://www.4dage.com/wechat/jssdk/share/?uri=' +
|
|
|
+ window.escape(url) + '&name=厦门四维时代微信公众号', 'success_jsonp', function (err, data) {
|
|
|
+ if (err) {
|
|
|
+ console.err(err)
|
|
|
+ } else {
|
|
|
+ console.log(wx)
|
|
|
+ wx.config({
|
|
|
+ debug: false, // 开启调试模式
|
|
|
+ appId: data.appId,
|
|
|
+ timestamp: data.timestamp,
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
+ signature: data.signature,
|
|
|
+ jsApiList: ['checkJsApi',
|
|
|
+ 'onMenuShareTimeline',
|
|
|
+ 'onMenuShareAppMessage',
|
|
|
+ 'onMenuShareQQ',
|
|
|
+ 'onMenuShareWeibo',
|
|
|
+ 'hideMenuItems',
|
|
|
+ 'showMenuItems',
|
|
|
+ 'hideAllNonBaseMenuItem',
|
|
|
+ 'showAllNonBaseMenuItem',
|
|
|
+ 'translateVoice',
|
|
|
+ 'startRecord',
|
|
|
+ 'stopRecord',
|
|
|
+ 'onRecordEnd',
|
|
|
+ 'playVoice',
|
|
|
+ 'pauseVoice',
|
|
|
+ 'stopVoice',
|
|
|
+ 'uploadVoice',
|
|
|
+ 'downloadVoice']
|
|
|
+ })
|
|
|
+ }
|
|
|
+ wx.error(function (err) {
|
|
|
+ console.log(err)
|
|
|
+ })
|
|
|
+ wx.ready(function () {
|
|
|
+ var shareData = {
|
|
|
+ title: '四维看看', // 标题
|
|
|
+ desc: '可将线下场景自动转为线上四维场景。好用不贵,全球百万用户首选', // 描述
|
|
|
+ link: window.location.href, // 分享的URL,必须和当前打开的网页的URL是一样的
|
|
|
+ imgUrl: 'https://4dkk.4dage.com/FDKKIMG/icon/kankan_icon180.png', // 缩略图地址
|
|
|
+ success: function () {
|
|
|
+
|
|
|
+ },
|
|
|
+ cancel: function () {
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ wx.onMenuShareAppMessage(shareData)
|
|
|
+ wx.onMenuShareTimeline(shareData)
|
|
|
+ wx.onMenuShareQQ(shareData)
|
|
|
+ wx.onMenuShareQZone(shareData)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
function getCodeApi(state) {
|
|
|
//获取code
|
|
|
console.log('getCodeApi');
|