|
@@ -1,5 +1,5 @@
|
|
import { doChangeTabActive } from '@/module-model/tab'
|
|
import { doChangeTabActive } from '@/module-model/tab'
|
|
-import { openDialog, closeDialog, canShowDialog } from '@/module-model/dialog'
|
|
|
|
|
|
+import { canShowDialog, closeDialog, openDialog } from '@/module-model/dialog'
|
|
import loginCookie from '@/module-model/loginCookies'
|
|
import loginCookie from '@/module-model/loginCookies'
|
|
import { ScanCodeLoginDetection } from '@/utils/Login'
|
|
import { ScanCodeLoginDetection } from '@/utils/Login'
|
|
import { doSetPageShareId } from '@/module-model/wxQrcode'
|
|
import { doSetPageShareId } from '@/module-model/wxQrcode'
|
|
@@ -31,7 +31,7 @@ class PluginLogin {
|
|
this.emitter.$on('user-info-update', this.setState.bind(this))
|
|
this.emitter.$on('user-info-update', this.setState.bind(this))
|
|
}
|
|
}
|
|
|
|
|
|
- init(options) {
|
|
|
|
|
|
+ async init(options) {
|
|
if (this.hasInited) {
|
|
if (this.hasInited) {
|
|
console.warn('pluginLogin hasInited')
|
|
console.warn('pluginLogin hasInited')
|
|
return
|
|
return
|
|
@@ -62,7 +62,7 @@ class PluginLogin {
|
|
|
|
|
|
if (this.options.preloadLoginState) {
|
|
if (this.options.preloadLoginState) {
|
|
this.initPoll()
|
|
this.initPoll()
|
|
- this.poll.preload()
|
|
|
|
|
|
+ await this.poll.preload()
|
|
}
|
|
}
|
|
|
|
|
|
if (this.options.preloadWeChatImage) {
|
|
if (this.options.preloadWeChatImage) {
|
|
@@ -109,7 +109,8 @@ class PluginLogin {
|
|
emit(type, data = null) {
|
|
emit(type, data = null) {
|
|
if (typeof this.options[type] === 'function') {
|
|
if (typeof this.options[type] === 'function') {
|
|
this.options[type](data)
|
|
this.options[type](data)
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
console.warn('[plugin-login]: not find emit function:', type)
|
|
console.warn('[plugin-login]: not find emit function:', type)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -235,6 +236,7 @@ class PluginLogin {
|
|
cross: true
|
|
cross: true
|
|
})
|
|
})
|
|
}
|
|
}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 广播用户设置密码事件(暂不设置、设置成功)
|
|
* 广播用户设置密码事件(暂不设置、设置成功)
|
|
* @param data
|
|
* @param data
|
|
@@ -244,7 +246,8 @@ class PluginLogin {
|
|
const { status } = data
|
|
const { status } = data
|
|
if (status === 1) {
|
|
if (status === 1) {
|
|
this.emitter.$emit('user-set-pass-success', data)
|
|
this.emitter.$emit('user-set-pass-success', data)
|
|
- } else {
|
|
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
this.emitter.$emit('user-not-set-pass', data)
|
|
this.emitter.$emit('user-not-set-pass', data)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -259,7 +262,7 @@ function addHook(hook) {
|
|
}
|
|
}
|
|
|
|
|
|
// 注入 hooks
|
|
// 注入 hooks
|
|
-;['open', 'doSignOut', 'close', 'init', 'getState'].forEach((hook) =>
|
|
|
|
|
|
+;['open', 'doSignOut', 'close', 'init', 'getState'].forEach(hook =>
|
|
addHook(hook)
|
|
addHook(hook)
|
|
)
|
|
)
|
|
|
|
|