Commit 7933cd22 by hank

qrcode 处理

parent f2045da7
......@@ -287,6 +287,26 @@ 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) {
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();
......@@ -296,17 +316,9 @@ export default {
success ? resolve() : reject();
};
}).then(() => {
QRCode.toDataURL(window.$jssdk("ble.connectId"), {
errorCorrectionLevel: "H",
width: 500,
height: 500
})
.then(url => {
this.connectIdCode = url;
})
.catch(err => {
console.error(err);
});
// 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