master
lion 1 month ago
parent b024827356
commit 9dc22165cf

@ -7,6 +7,8 @@ const HOSTARR = {
// https://gbyuyue.szgmbwg.org.cn/
}; // 审核状态
const jwx = require('jweixin-module')
const HOST = HOSTARR[process.env
.NODE_ENV]; //"https://tiantianxinye.365care.langye.net/";//HOSTARR[process.env.NODE_ENV];//
@ -143,6 +145,7 @@ const wxH5AuthLogin = (cb) => {
}
uni.setStorageSync(user_info_key, userInfo)
cb(userInfo)
shareIndex()
} else {
console.error('登录失败: token为空')
uni.showToast({ title: '登录失败,请重试', icon: 'none' })
@ -168,6 +171,59 @@ const wxH5AuthLogin = (cb) => {
}
}
// 分享
const shareIndex = (cb) => {
console.log("开始分享配置",location.href.split('#')[0])
let link = HOST+"/h5/";
request({
api: `/api/mobile/user/wx-jssdk`,
method: 'GET',
data:{
url:location.href.split('#')[0]
},
utilSuccess: (res) => {
jwx.config({
debug: false, // 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
appId: res.appId,
jsApiList: res.jsApiList,
nonceStr: res.nonceStr,
signature: res.signature,
timestamp: res.timestamp,
})
jwx.ready(() => {
jwx.updateAppMessageShareData({
title: '苏州革命博物馆', // 分享标题
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
desc: '点击查看',
imgUrl: HOST+'/h5/share.jpg', // 分享图标
success: () => {
console.log(
'updateAppMessageShareData-success'
)
},
});
jwx.updateTimelineShareData({
title: '苏州革命博物馆', // 分享标题
desc: '点击查看',
link: link, // 分享链接,该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
imgUrl: HOST+'/h5/share.jpg', // 分享图标
success: () => {
console.log(
'updateTimelineShareData-success'
)
}
});
})
},
utilFail: (err) => {
console.error('分享配置失败:', err)
// uni.showToast({ title: '分享配置失败', icon: 'none' })
}
})
}
const getUserProfile = (cb) => {

Loading…
Cancel
Save