index.js
685 字节
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
/**
* 权限入口文件
* @param {String} authType -权限种类
*/
// #ifdef MP
import MpAuth from './mp.js' //微信小程序
// #endif
// #ifdef H5
import H5Auth from './h5.js' //H5相关
// #endif
// #ifdef APP-VUE
import AppAuth from './app.js' //APP相关
// #endif
export default class Auth {
constructor(authType) {
this.authType = authType
}
async check() {
let state = 0
// #ifdef MP
state = await new MpAuth(this.authType).checkAuth()
// #endif
// #ifdef H5
state = await new H5Auth(this.authType).checkAuth()
// #endif
// #ifdef APP-VUE
state = await new AppAuth(this.authType).checkAuth()
// #endif
return Promise.resolve(state)
}
}