调用第三方微信登录
appLogin: function() {
var t = this;
uni.getProvider({
service: 'oauth',
success(res) {
if (~res.provider.indexOf('weixin')) {
uni.login({
provider: 'weixin',
success(res) {
uni.getUserInfo({
provider: 'weixin',
success(info) {
console.log(info)
}
})
}
}
})
},
注意:
1. Hbuilder 调试选择自定义基座
2. [endif]微信开放平台的应用签名
3. 获取应用签名
链接:https://www.cnblogs.com/details-666/p/signature.html
微信支付
uni.requestPayment({
provider: 'wxpay',
orderInfo: {
appid: res.data.data.appId,
partnerid: res.data.data.mch_id,
prepayid: res.data.data.prepay_id,
package: 'Sign=WXPay',
noncestr: res.data.data.nonceStr,
timestamp: res.data.data.timeStamp,
sign: res.data.data.sign,
},
success: function(t) { },
complete(err) {
console.log(err)
}
}));
微信分享
分享朋友圈
shareFriendcricle() {
uni.share({
provider: "weixin",
scene: "WXSenceTimeline",
type: 0,
href: '/pages/course/detail?id=' + this.id,
title: this.detail.title,
summary: this.detail.subject,
imageUrl: this.detail.images[0],
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
},
分享朋友
shareFriend() {
uni.share({
provider: "weixin",
scene: "WXSceneSession",
type: 0,
href: '/pages/course/detail?id=' + this.id,
title: this.detail.title,
summary: this.detail.subject,
imageUrl: this.detail.images[0],
success: function(res) {
console.log("success:" + JSON.stringify(res));
},
fail: function(err) {
console.log("fail:" + JSON.stringify(err));
}
});
},