Skip to content

Commit c4f7156

Browse files
committed
chore: 小程序扫码不需要申请相机权限
1 parent 07f1b74 commit c4f7156

File tree

1 file changed

+2
-19
lines changed

1 file changed

+2
-19
lines changed

pages/API/scan-code/scan-code.vue

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,25 +37,8 @@
3737
success: (res) => {
3838
this.result = res.result
3939
},
40-
fail: (err) => {
41-
// #ifdef MP
42-
uni.getSetting({
43-
success: (res) => {
44-
let authStatus = res.authSetting['scope.camera'];
45-
if (!authStatus) {
46-
uni.showModal({
47-
title: '授权失败',
48-
content: 'Hello uni-app需要使用您的相机,请在设置界面打开相关权限',
49-
success: (res) => {
50-
if (res.confirm) {
51-
uni.openSetting()
52-
}
53-
}
54-
})
55-
}
56-
}
57-
})
58-
// #endif
40+
fail: (err) => {
41+
// 需要注意的是小程序扫码不需要申请相机权限
5942
}
6043
});
6144
}

0 commit comments

Comments
 (0)