测试扫码

This commit is contained in:
weiwei committed 2025-03-20 11:01:13 +08:00
1 parent 053707d4c8
commit 012f4f0f7b
1 file changed
+20 -22
+20 -22
View File
@@ -37,6 +37,11 @@
退出登录
</view>
</view>
<view class="flex-col-center m-t-40rpx m-x-30rpx">
<view class="w-full text-center sub-text-28 p-y-20rpx rounded-40rpx border-solid border border-#0094ff" @tap="doScanCode">
扫扫扫
</view>
</view>
</crud-layout>
</template>
@@ -183,36 +188,29 @@ const onTabMenu = async (v: MenuItem, i: number) => {
if (isLogin) {
if (v.text === "扫一扫") {
console.log("扫一扫")
dd.scan({
type: "all",
})
.then((res) => {
console.log(res)
uni.showToast({
title: JSON.stringify(res),
icon: "none",
})
})
.catch()
} else {
router.jump(v.router)
}
}
}
dd.ready(function () {
dd.confirm({
message: "2022年亚运会在哪里举办",
title: "提问",
buttonLabels: ["杭州", "上海"],
})
.then((res) => {
console.log(res)
// 扫扫扫
const doScanCode = async () => {
try {
const res = await dd.scan({ type: "all" })
console.log(res)
uni.showToast({
title: JSON.stringify(res),
icon: "none",
})
.catch((err) => {
console.error(err)
} catch (error) {
console.log("error", error)
uni.showToast({
title: JSON.stringify(error),
icon: "none",
})
})
}
}
const getStorageUserInfo = () => {
const tokenKey = constant.storageConstant.TOKEN