Commit 7b9c9a55 by 李伟康

提交代码

1 parent 474f6825
......@@ -11,8 +11,10 @@
import {
reportData
} from '~/api/index.js'
import USERAPI from '~/api/usersApi/index'
const _WXUSERINFO_ = Symbol('_WXUSERINFO_')
class Share {
[_WXUSERINFO_] = null
constructor() {
console.log('---------------- 分享初始化 ----------------')
this.initPageProxy()
......@@ -29,10 +31,17 @@ class Share {
}
}
}
async checkWxUserInfo() {
if (!this[_WXUSERINFO_]) {
const data = await USERAPI.getWXUserInfo()
this[_WXUSERINFO_] = data
}
}
/**设置全局分享 */
pageLeaveProxy(page) {
const that = this
if (page.onShareAppMessage) {
const that = this
this.checkWxUserInfo()
page.onShareAppMessage = function () {
let {
shareTitle,
......@@ -47,6 +56,7 @@ class Share {
if (sharePath) path = `/${sharePath}`
path += that.setCommonShareQuery()
if (shareQuery) path += `&${shareQuery}`
console.log(path)
if (!noPageAuth) path = `/login/loading/loading?url=${encodeURIComponent(path)}`
if (shareFun) shareFun()
if (shareTrackData) that.reportShareData(shareTrackData)
......@@ -79,7 +89,7 @@ class Share {
}
}
getCommonData() {
const WXUSERINFO = wx.$storage.get('wx_user_info'),
const WXUSERINFO = this[_WXUSERINFO_],
USERINFO = wx.$storage.get('userInfo')
return {
WXUSERINFO,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!