|
@@ -1,7 +1,6 @@
|
|
|
import wx from 'weixin-js-sdk';
|
|
|
import { http } from '@/utils/request';
|
|
|
import { wechatConfig } from '@/api/common';
|
|
|
-import mHelper from '@/utils/helper';
|
|
|
|
|
|
export function isWechat() {
|
|
|
|
|
@@ -57,6 +56,46 @@ export async function wxConfigH5(url) {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
+export function wxShare(title, imgUrl, desc, link) {
|
|
|
+ const url = window.location.href.split('#')[0];
|
|
|
+ const shareTitle = title || '中德智慧教育';
|
|
|
+ const shareDesc = desc || '全球思维儿童教育专家 全球优质教育内容输出平台';
|
|
|
+ const shareLink = link || url;
|
|
|
+ const shareImgUrl = imgUrl || 'http://res.training.luojigou.vip/FiLdD-zXCwM6A6JkVzAp8nKM7WLx';
|
|
|
+ wx.ready(() => {
|
|
|
+ wx.onMenuShareTimeline({
|
|
|
+ title: shareTitle,
|
|
|
+ link: shareLink,
|
|
|
+ imgUrl: shareImgUrl,
|
|
|
+ success() {
|
|
|
+
|
|
|
+ console.log('分享成功');
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+
|
|
|
+ console.log('取消分享');
|
|
|
+ },
|
|
|
+ });
|
|
|
+
|
|
|
+ wx.onMenuShareAppMessage({
|
|
|
+ title: shareTitle,
|
|
|
+ desc: shareDesc,
|
|
|
+ link: shareLink,
|
|
|
+ imgUrl: shareImgUrl,
|
|
|
+ type: '',
|
|
|
+ dataUrl: '',
|
|
|
+ success() {
|
|
|
+
|
|
|
+ console.log('分享成功');
|
|
|
+ },
|
|
|
+ cancel() {
|
|
|
+
|
|
|
+ console.log('取消分享');
|
|
|
+ },
|
|
|
+ });
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
export function getQueryString(name) {
|
|
|
let reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
|
|
|
let r = window.location.search.substr(1).match(reg);
|