Commit 1d9534e4 by hank

Merge branch 'develop' of gitlab.maxrocky.com:visualcloud/Vmatrix-device-start into develop

parents ac17eb37 e092f1c6
...@@ -108,6 +108,27 @@ export default { ...@@ -108,6 +108,27 @@ export default {
}; };
}, },
methods: { 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() { toQRcode() {
QRCode.toDataURL(this.link, { QRCode.toDataURL(this.link, {
width: 500, width: 500,
...@@ -244,6 +265,7 @@ export default { ...@@ -244,6 +265,7 @@ export default {
switch (value) { switch (value) {
case "MAIN_INIT_QRCODE": case "MAIN_INIT_QRCODE":
this.MAIN_INIT_QRCODE(); this.MAIN_INIT_QRCODE();
this.getQrcode();
this.showTitle(); this.showTitle();
this.closeLoading(); this.closeLoading();
break; break;
...@@ -290,29 +312,6 @@ export default { ...@@ -290,29 +312,6 @@ export default {
created() { created() {
window.test = this; window.test = this;
this.toQRcode(); 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) => { new Promise((resolve, reject) => {
if (!window.jsbridge) { if (!window.jsbridge) {
reject(); reject();
...@@ -322,9 +321,6 @@ export default { ...@@ -322,9 +321,6 @@ export default {
success ? resolve() : reject(); success ? resolve() : reject();
}; };
}).then(() => { }).then(() => {
// let =
getQrcode();
this.state = window.$jssdk("app.page"); this.state = window.$jssdk("app.page");
this.isConnected = window.$jssdk("ble.isConnected"); this.isConnected = window.$jssdk("ble.isConnected");
window.$observer("ble.onConnectionStateChange", 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