mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp.git
synced 2025-12-17 16:05:53 +08:00
修改扫码功能报错的问题
This commit is contained in:
@@ -106,24 +106,32 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扫码
|
||||||
|
*/
|
||||||
|
seacnCode() {
|
||||||
|
uni.scanCode({
|
||||||
|
success: function (res) {
|
||||||
|
let path = encodeURIComponent(res.result);
|
||||||
|
// TODO 扫码功能后续还会后续增加
|
||||||
|
// 扫码成功后跳转到webview页面
|
||||||
|
setTimeout(() => {
|
||||||
|
uni.navigateTo({
|
||||||
|
url: "/pages/tabbar/home/web-view?src=" + path,
|
||||||
|
});
|
||||||
|
}, 100);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 唤醒客户端扫码
|
* 唤醒客户端扫码
|
||||||
* 没权限去申请权限,有权限获取扫码功能
|
* 没权限去申请权限,有权限获取扫码功能
|
||||||
*/
|
*/
|
||||||
scan() {
|
scan() {
|
||||||
|
// #ifdef APP-PLUS
|
||||||
if (permision.judgeIosPermission("camera")) {
|
if (permision.judgeIosPermission("camera")) {
|
||||||
uni.scanCode({
|
this.seacnCode();
|
||||||
success: function (res) {
|
|
||||||
let path = encodeURIComponent(res.result);
|
|
||||||
// TODO 扫码功能后续还会后续增加
|
|
||||||
// 扫码成功后跳转到webview页面
|
|
||||||
setTimeout(() => {
|
|
||||||
uni.navigateTo({
|
|
||||||
url: "/pages/tabbar/home/web-view?src=" + path,
|
|
||||||
});
|
|
||||||
}, 100);
|
|
||||||
},
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
// 没有权限提醒是否去申请权限
|
// 没有权限提醒是否去申请权限
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
@@ -136,6 +144,11 @@ export default {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// #endif
|
||||||
|
|
||||||
|
// #ifdef MP-WEIXIN
|
||||||
|
this.seacnCode();
|
||||||
|
// #endif
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user