You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
685 B
37 lines
685 B
/**
|
|
* 权限入口文件
|
|
* @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)
|
|
}
|
|
|
|
}
|
|
|