|
@@ -9,26 +9,26 @@ import { setLocal, getLocal } from './storage'
|
9
|
9
|
*/
|
10
|
10
|
function getAuthInfo(cb?: any, redirect_url?: any) {
|
11
|
11
|
//回跳回来后,拿到本地存储的信息去走授权
|
12
|
|
- if (getLocal('authInfo') && getQueryString('againJump')) {
|
13
|
|
- const local_auth_info: string = getLocal('authInfo') || null;
|
14
|
|
- initEvent(JSON.parse(local_auth_info), cb)
|
15
|
|
- } else {
|
16
|
|
- axios.post('/api/h5/auth/commonAuthData', {
|
17
|
|
- corpid: getQueryString('corpid'),
|
18
|
|
- url: location.href.split('#')[0],
|
19
|
|
- }).then((res: any) => {
|
20
|
|
- //构造网页授权链接回调 保存返回信息
|
21
|
|
- if (redirect_url) {
|
22
|
|
- setLocal('authInfo', JSON.stringify(res.rst))
|
23
|
|
- redirect_url(res.rst)
|
24
|
|
- }
|
25
|
|
- if (cb) {
|
26
|
|
- initEvent(res.rst, cb)
|
27
|
|
- }
|
28
|
|
- }).catch((err) => {
|
29
|
|
- console.log(err, 'err')
|
30
|
|
- })
|
31
|
|
- }
|
|
12
|
+ // if (getLocal('authInfo') && getQueryString('againJump')) {
|
|
13
|
+ // const local_auth_info: string = getLocal('authInfo') || null;
|
|
14
|
+ // initEvent(JSON.parse(local_auth_info), cb)
|
|
15
|
+ // } else {
|
|
16
|
+ axios.post('/api/h5/auth/commonAuthData', {
|
|
17
|
+ corpid: getQueryString('corpid'),
|
|
18
|
+ url: location.href.split('#')[0],
|
|
19
|
+ }).then((res: any) => {
|
|
20
|
+ //构造网页授权链接回调 保存返回信息
|
|
21
|
+ if (redirect_url) {
|
|
22
|
+ // setLocal('authInfo', JSON.stringify(res.rst))
|
|
23
|
+ redirect_url(res.rst)
|
|
24
|
+ }
|
|
25
|
+ if (cb) {
|
|
26
|
+ initEvent(res.rst, cb)
|
|
27
|
+ }
|
|
28
|
+ }).catch((err) => {
|
|
29
|
+ console.log(err, 'err')
|
|
30
|
+ })
|
|
31
|
+ // }
|
32
|
32
|
}
|
33
|
33
|
|
34
|
34
|
function initEvent(authInfo: any, cb) {
|