|
@@ -53,7 +53,12 @@ export class LoginManager {
|
|
|
constructor() {
|
|
|
}
|
|
|
init(){
|
|
|
- if(!NetMgr) NetManager.instance;
|
|
|
+ if(!NetMgr) {
|
|
|
+ let netMgr = NetManager.instance;
|
|
|
+ if(!netMgr){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
Framework.event.addEvent("account_auth_userState", (res) => {
|
|
|
res = JSON.parse(res);
|
|
|
if (res.state == 2) {
|
|
@@ -176,31 +181,33 @@ export class LoginManager {
|
|
|
this._seq = 1
|
|
|
this._last_seq = 0
|
|
|
let args = { "headpic": "", "system": "Fucking windows", "platform": "", "device": "PC", "name": this.userId, "lang": "cn" }
|
|
|
+ let self = this
|
|
|
+
|
|
|
this.sendPost('user', 'login', (data) => {
|
|
|
console.log('登录返回数据', data)
|
|
|
|
|
|
Framework.unionManager.dealLoginData(data)
|
|
|
|
|
|
- let min = Number(this._server_url.indexOf('//'))
|
|
|
- let max = this._server_url.lastIndexOf(':')
|
|
|
- let server = this._server_url.substring(min, max)
|
|
|
+ let min = Number(self._server_url.indexOf('//'))
|
|
|
+ let max = self._server_url.lastIndexOf(':')
|
|
|
+ let server = self._server_url.substring(min, max)
|
|
|
let ws_url = `ws:${server}:${data.wss_port}`
|
|
|
// let ws_url = 'ws://172.31.244.30:61114'
|
|
|
// ws://42.192.10.28:4003
|
|
|
- this.ws_url = ws_url;
|
|
|
+ self.ws_url = ws_url;
|
|
|
let req = {
|
|
|
mod: 'user',
|
|
|
act: 'handshake',
|
|
|
args: {
|
|
|
'auth_key': backdata.auth_key,
|
|
|
'auth_time': backdata.auth_time,
|
|
|
- 'openid': this.serverOpenId,
|
|
|
+ 'openid': self.serverOpenId,
|
|
|
},
|
|
|
uid: backdata.uid,
|
|
|
}
|
|
|
- this.we_req = req
|
|
|
- NetMgr.connect(this.ws_url, () => {
|
|
|
- NetMgr.send(this.we_req)
|
|
|
+ self.we_req = req
|
|
|
+ NetMgr.connect(self.ws_url, () => {
|
|
|
+ NetMgr.send(self.we_req)
|
|
|
OpenUIBack()
|
|
|
})
|
|
|
}, args)
|