Commit dc5050e5 by MissYasiky

增加状态位防止登录按钮被连续多次点击

parent 981d35f4
......@@ -42,6 +42,7 @@ export default class PolyvLogin extends Component {
constructor(props) {
super(props);
this.state = {
pressed:false,
showTitleText: false,
loginInfo: {},
tabIndex: 0
......@@ -120,6 +121,12 @@ export default class PolyvLogin extends Component {
<View style={styles.center}>
<Text style={styles.text}
onPress={() => {
if (this.state.pressed == true) {
console.log("处理中,请稍后")
return
}
this.state.pressed = true
if (this.state.tabIndex == 1) {//回放
this.state.loginInfo = PolyvViewManager.refCollection['PlayBackLogin'].state.playbackInfo
} else {
......@@ -128,6 +135,7 @@ export default class PolyvLogin extends Component {
var loginInfo = this.state.loginInfo
if (!loginInfo) {
alert("input login info")
this.state.pressed = false
return
}
......@@ -136,6 +144,7 @@ export default class PolyvLogin extends Component {
PolyvCloudClassModule.liveLogin(findNodeHandle(this), loginInfo.userId,
loginInfo.channelId, loginInfo.appId, loginInfo.appScrect)
.then(ret => {
this.state.pressed = false
if (ret.code != 0) {
var str = "登录失败 errCode=" + ret.code + " errMsg=" + ret.message;
console.log(str);
......@@ -148,6 +157,7 @@ export default class PolyvLogin extends Component {
PolyvCloudClassModule.playbackLogin(findNodeHandle(this), loginInfo.userId,
loginInfo.channelId, loginInfo.vid, loginInfo.appId, loginInfo.appScrect)
.then(ret => {
this.state.pressed = false
if (ret.code != 0) {
var str = "登录失败 errCode=" + ret.code + " errMsg=" + ret.message;
console.log(str);
......@@ -159,6 +169,8 @@ export default class PolyvLogin extends Component {
}
} else {
this.state.pressed = false
}
}}>登录</Text>
</View>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment