|
@@ -12,7 +12,7 @@ var wxJssdkMixin = function () {
|
|
SettlementService.getWxConfig({
|
|
SettlementService.getWxConfig({
|
|
appId: this.appId,
|
|
appId: this.appId,
|
|
url
|
|
url
|
|
- }, (res) => {
|
|
|
|
|
|
+ }, async (res) => {
|
|
const data = res.data
|
|
const data = res.data
|
|
const wx = window.wx
|
|
const wx = window.wx
|
|
const nonceStr = Math.random()
|
|
const nonceStr = Math.random()
|
|
@@ -20,7 +20,7 @@ var wxJssdkMixin = function () {
|
|
const signature = sha1(`jsapi_ticket=${data.ticket}&noncestr=${nonceStr}×tamp=${timestamp}&url=${url}`).toString()
|
|
const signature = sha1(`jsapi_ticket=${data.ticket}&noncestr=${nonceStr}×tamp=${timestamp}&url=${url}`).toString()
|
|
console.log(nonceStr, timestamp, signature, data.ticket)
|
|
console.log(nonceStr, timestamp, signature, data.ticket)
|
|
if (this.isWeChat()) {
|
|
if (this.isWeChat()) {
|
|
- wx.config({
|
|
|
|
|
|
+ await wx.config({
|
|
debug: true, // dev === 'development' 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
|
|
debug: true, // dev === 'development' 开启调试模式,调用的所有 api 的返回值会在客户端 alert 出来,若要查看传入的参数,可以在 pc 端打开,参数信息会通过 log 打出,仅在 pc 端时才会打印。
|
|
appId: 'wx91c4152b60ca91a3', // 必填,公众号的唯一标识
|
|
appId: 'wx91c4152b60ca91a3', // 必填,公众号的唯一标识
|
|
timestamp: timestamp, // 必填,生成签名的时间戳
|
|
timestamp: timestamp, // 必填,生成签名的时间戳
|
|
@@ -28,8 +28,10 @@ var wxJssdkMixin = function () {
|
|
signature: signature, // 必填,签名
|
|
signature: signature, // 必填,签名
|
|
jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData', 'onMenuShareTimeline'] // 必填,需要使用的 JS 接口列表
|
|
jsApiList: ['updateAppMessageShareData', 'onMenuShareAppMessage', 'updateTimelineShareData', 'onMenuShareTimeline'] // 必填,需要使用的 JS 接口列表
|
|
})
|
|
})
|
|
- callback && callback(wx)
|
|
|
|
|
|
+ await callback && callback(wx)
|
|
wx.error(function (err) {
|
|
wx.error(function (err) {
|
|
|
|
+ window.alert(err.toString())
|
|
|
|
+ window.location.reload();
|
|
console.warn(err)
|
|
console.warn(err)
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -41,22 +43,22 @@ var wxJssdkMixin = function () {
|
|
setWxReady(wx) {
|
|
setWxReady(wx) {
|
|
console.log('wx', wx)
|
|
console.log('wx', wx)
|
|
wx.ready(function () {
|
|
wx.ready(function () {
|
|
- wx.onMenuShareAppMessage({
|
|
|
|
|
|
+ wx.updateAppMessageShareData({
|
|
title: '采美商城', // 分享标题
|
|
title: '采美商城', // 分享标题
|
|
desc: '采美商城', // 分享描述
|
|
desc: '采美商城', // 分享描述
|
|
- link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
|
|
|
|
- imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
|
|
|
|
|
|
+ link: 'https://www.caimei365.com/serviceSettlement.html', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
|
|
|
|
+ imgUrl: 'https://www.caimei365.com/img/common/qr_code_mini.jpg',
|
|
success: () => {
|
|
success: () => {
|
|
},
|
|
},
|
|
fail: () => {
|
|
fail: () => {
|
|
window.location.reload();
|
|
window.location.reload();
|
|
}
|
|
}
|
|
})
|
|
})
|
|
- wx.onMenuShareTimeline({
|
|
|
|
|
|
+ wx.updateTimelineShareData({
|
|
title: '采美商城', // 分享标题
|
|
title: '采美商城', // 分享标题
|
|
desc: '采美商城', // 分享描述
|
|
desc: '采美商城', // 分享描述
|
|
- link: 'https://www.caimei365.com/serviceSettlement.html?id=0', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
|
|
|
|
- imgUrl: 'https://static.caimei365.com/app/img/serviceProvider/H5/search-content-bg.png',
|
|
|
|
|
|
+ link: 'https://www.caimei365.com/serviceSettlement.html', // 分享链接,该链接域名或路径必须与当前页面对应的公众号 JS 安全域名一致
|
|
|
|
+ imgUrl: 'https://www.caimei365.com/img/common/qr_code_mini.jpg',
|
|
success: () => {
|
|
success: () => {
|
|
},
|
|
},
|
|
fail: () => {
|
|
fail: () => {
|