修复跳转问题

This commit is contained in:
kk
2026-07-10 16:20:00 +08:00
parent 3a154198e9
commit 20649c67a9
2 changed files with 71 additions and 6 deletions
+19 -1
View File
@@ -101,7 +101,25 @@ export default {
methods: {
handleScan() {
// #ifdef H5
uni.showToast({ title: 'H5 环境暂不支持扫码', icon: 'none' });
// 检测是否在微信环境
const isWechat = /MicroMessenger/i.test(navigator.userAgent);
if (isWechat) {
// 微信环境:拉起微信扫一扫
// 注意:需要后端配合引入微信 JS-SDK 并完成签名配置
uni.showToast({ title: '请使用微信扫一扫功能', icon: 'none' });
// 如果已配置微信 JS-SDK,可以使用:
// wx.scanQRCode({
// needResult: 1,
// scanType: ['qrCode', 'barCode'],
// success: (res) => {
// const result = res.resultStr;
// this.parseScanResult(result);
// }
// });
} else {
// 非微信环境
uni.showToast({ title: '请使用微信扫码或在小程序中打开', icon: 'none' });
}
// #endif
// #ifdef MP-WEIXIN