Commit e092f1c6 by patpat

调整二维码读取时机

parent 72f650a8
......@@ -108,6 +108,27 @@ export default {
};
},
methods: {
getQrcode() {
// let qr_code = window.$jssdk("ble.connectId")
let qr_code = window.$jssdk("bind.qrcode");
if (!qr_code.qrcode) {
setTimeout(this.getQrcode, 1000)
// getQrcode();
return;
} else {
QRCode.toDataURL(JSON.stringify(qr_code), {
errorCorrectionLevel: "H",
width: 500,
height: 500
})
.then(url => {
this.connectIdCode = url;
})
.catch(err => {
console.error(err);
});
}
},
toQRcode() {
QRCode.toDataURL(this.link, {
width: 500,
......@@ -241,6 +262,7 @@ export default {
switch (value) {
case "MAIN_INIT_QRCODE":
this.MAIN_INIT_QRCODE();
this.getQrcode();
this.showTitle();
this.closeLoading();
break;
......@@ -287,29 +309,6 @@ export default {
created() {
window.test = this;
this.toQRcode();
const getQrcode = () => {
// let qr_code = window.$jssdk("ble.connectId")
let qr_code = window.$jssdk("bind.qrcode");
if (!qr_code.qrcode) {
setTimeout(() => {
getQrcode()
}, 1000)
// getQrcode();
return;
} else {
QRCode.toDataURL(JSON.stringify(qr_code), {
errorCorrectionLevel: "H",
width: 500,
height: 500
})
.then(url => {
this.connectIdCode = url;
})
.catch(err => {
console.error(err);
});
}
};
new Promise((resolve, reject) => {
if (!window.jsbridge) {
reject();
......@@ -319,9 +318,6 @@ export default {
success ? resolve() : reject();
};
}).then(() => {
// let =
getQrcode();
this.state = window.$jssdk("app.page");
this.isConnected = window.$jssdk("ble.isConnected");
window.$observer("ble.onConnectionStateChange", isConnected => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment