class Login extends ui.LoginUI {
constructor() {
super();
let button = window[‘wx’].createUserInfoButton({
type: ‘text’,
text: ‘确认登录’,
style: {
width: 200,
height: 40,
bottom: 80,
left: window[‘wx’].getSystemInfoSync().windowWidth / 2 - 100,
top: window[‘wx’].getSystemInfoSync().windowHeight / 2 - 20,
lineHeight: 40,
backgroundColor: ‘#ff0000’,
color: ‘#ffffff’,
textAlign: ‘center’,
fontSize: 16,
borderRadius: 4,
}
});
//点击登录按钮监听方法
button.onTap((res) => {
let user = res.userInfo;
try {
window[‘wx’].setStorageSync(‘userInfo’, user);
} catch (e) {
window[‘wx’].showToast({
title: ‘系统提示:网络错误’,
icon: ‘warn’,
duration: 1500,
})
}
let game = Const.game;//游戏101
let gender = user.gender;
let nickname = user.nickName;
let headimgurl = user.avatarUrl;
SFSServer.getIntance().Login(game, gender, nickname, headimgurl);
button.hide();
});
}
}