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