完善提示
This commit is contained in:
@@ -22,14 +22,22 @@ const handleScan = () => {
|
|||||||
onlyFromCamera: true,
|
onlyFromCamera: true,
|
||||||
scanType: ["qrCode"],
|
scanType: ["qrCode"],
|
||||||
success: async (res) => {
|
success: async (res) => {
|
||||||
const base64Decode = (str) => {
|
try {
|
||||||
// 将 base64 转换为 utf8 字符串
|
const base64Decode = (str) => {
|
||||||
const bytes = wx.base64ToArrayBuffer(str);
|
// 将 base64 转换为 utf8 字符串
|
||||||
return String.fromCharCode.apply(null, new Uint8Array(bytes));
|
const bytes = wx.base64ToArrayBuffer(str);
|
||||||
};
|
return String.fromCharCode.apply(null, new Uint8Array(bytes));
|
||||||
|
};
|
||||||
|
|
||||||
addDevice.value = JSON.parse(base64Decode(res.result));
|
addDevice.value = JSON.parse(base64Decode(res.result));
|
||||||
confirmBindTip.value = true;
|
confirmBindTip.value = true;
|
||||||
|
} catch (err) {
|
||||||
|
uni.showToast({
|
||||||
|
title: "无效二维码",
|
||||||
|
icon: "none",
|
||||||
|
duration: 2000,
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
fail: (err) => {
|
fail: (err) => {
|
||||||
console.error("扫码失败:", err);
|
console.error("扫码失败:", err);
|
||||||
|
|||||||
Reference in New Issue
Block a user