h5.js
735 字节
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* H5相关权限
* @description 相关权限校验,调用在wechat/sdk.js
* @param {String} scopeValue - 权限种类
*
*/
const TIPS_MAP = {
'userInfo': '用户信息',
'userLocation': '地理位置',
'address': '通信地址',
'record': '录音功能',
'writePhotosAlbum': '保存到相册',
'message': '订阅消息'
}
export default class H5Auth {
constructor(scopeValue) {
this.scopeValue = scopeValue
}
// 检测当前请求权限是否可用。
checkAuth() {
const that = this;
return new Promise((resolve, reject) => {
switch (that.scopeValue) {
case 'writePhotosAlbum' || 'camera':
resolve(1)
break;
default:
resolve(1)
break;
}
})
}
}