From 3cc2f1e01980f61d85d417f666b44cd73539ca3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?lemon=E6=A9=AA?= <17633066053@163.com> Date: Mon, 7 Jun 2021 11:31:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=89=AB=E7=A0=81=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/tabbar/home/views.vue | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/pages/tabbar/home/views.vue b/pages/tabbar/home/views.vue index f4ae537..60901e6 100644 --- a/pages/tabbar/home/views.vue +++ b/pages/tabbar/home/views.vue @@ -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() { + // #ifdef APP-PLUS if (permision.judgeIosPermission("camera")) { - uni.scanCode({ - success: function (res) { - let path = encodeURIComponent(res.result); - // TODO 扫码功能后续还会后续增加 - // 扫码成功后跳转到webview页面 - setTimeout(() => { - uni.navigateTo({ - url: "/pages/tabbar/home/web-view?src=" + path, - }); - }, 100); - }, - }); + this.seacnCode(); } else { // 没有权限提醒是否去申请权限 uni.showModal({ @@ -136,6 +144,11 @@ export default { }, }); } + // #endif + + // #ifdef MP-WEIXIN + this.seacnCode(); + // #endif }, }, };