|
@@ -88,30 +88,6 @@ export default {
|
|
|
},
|
|
|
// 扫码
|
|
|
async scanCode() {
|
|
|
- // scanQRCode
|
|
|
- // console.log(929292, WeixinJSBridge);
|
|
|
- // console.log(9393939393, this.$wx);
|
|
|
- // wx.miniProgram.scanQRCode(function(res) {
|
|
|
- // console.log(949494949494, res) // true
|
|
|
- // })
|
|
|
-
|
|
|
- this.$wx.scanQRCode({
|
|
|
- desc: 'scanQRCode desc',
|
|
|
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
- // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
- success: ( res ) => {
|
|
|
- console.log(237,res);
|
|
|
- // runScanFn(res);∑
|
|
|
- // this.formMsg.deviceCode = res.resultStr;
|
|
|
- },
|
|
|
- error: ( res ) => {
|
|
|
- console.log(242,res);
|
|
|
- },
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- return
|
|
|
-
|
|
|
const runScanFn = ( res ) => {
|
|
|
if ( res.scanType == 'QR_CODE' && res.scanType || (isAlipayClient && res.scanType == 'QR')) {
|
|
|
console.log(res.result);
|
|
@@ -129,36 +105,15 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
- this.$wx.scanQRCode({
|
|
|
- desc: 'scanQRCode desc',
|
|
|
- needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
|
|
|
- // scanType: ['qrCode', 'barCode'], // 可以指定扫二维码还是一维码,默认二者都有
|
|
|
- success: ( res ) => {
|
|
|
- console.log(237,res);
|
|
|
- // runScanFn(res);
|
|
|
- // this.formMsg.deviceCode = res.resultStr;
|
|
|
- },
|
|
|
- error: ( res ) => {
|
|
|
- console.log(242,res);
|
|
|
- },
|
|
|
- });
|
|
|
- return
|
|
|
- // 微信小程序
|
|
|
- const platform = getPlatform();
|
|
|
- if ( platform === 'miniprogram' ) {
|
|
|
- // 判断微信小程序与 h5 是否正常通信
|
|
|
- const isReload = await theCommunicationBetweenWechatAndH5IsNormal()
|
|
|
- if(!isReload) {
|
|
|
- uni.setStorageSync('isReload', 1)
|
|
|
- window.location.reload()
|
|
|
- return
|
|
|
- }
|
|
|
+ // 支付宝小程序
|
|
|
+ // const platform = getPlatform();
|
|
|
+ if ( isAlipayClient ) {
|
|
|
window.toWXSendMsg({
|
|
|
type: 'scanQRCode',
|
|
|
});
|
|
|
window.subscribe('scanQRCodeOver',( options ) => {
|
|
|
console.log('微信扫码结束之后的返回参数',options);
|
|
|
- runScanFn(isAlipayClient ? options.options : options);
|
|
|
+ runScanFn(options.options);
|
|
|
});
|
|
|
} else {
|
|
|
this.$wx.scanQRCode({
|