/** * 加入会议 */ import React, { Component } from "react"; import { connect } from "dva"; import { Form, Input, Modal, Spin } from "antd"; import "../meeting.less"; const formItemLayout = { labelCol: { xs: { span: 12 }, sm: { span: 8 } }, wrapperCol: { xs: { span: 12 }, sm: { span: 10 } } }; @connect(state => ({ client: state.client.client, comName: state.global.companyInfo.comName, username: state.user.currentUser.name, joinMeetingStatus: state.client.joinMeetingStatus, isSuccessJoinMeeting: state.client.isSuccessJoinMeeting })) @Form.create() export default class Join extends Component { constructor(props, context) { super(props, context); this.state = { joinVisible: this.props.joinVisible, //是否展示模态框的状态 joinMeetingStatus: this.props.joinMeetingStatus }; } componentDidMount() {} componentWillReceiveProps(nextProps) { this.setState({ joinVisible: nextProps.joinVisible }); if (nextProps.joinMeetingStatus !== this.state.joinMeetingStatus) { this.setState({ joinMeetingStatus: nextProps.joinMeetingStatus }); } //加入会议成功之后,关掉模态框并重置输入框数据 if ( nextProps.isSuccessJoinMeeting !== this.props.isSuccessJoinMeeting && nextProps.isSuccessJoinMeeting ) { this.props.form.resetFields(); this.props.changeJoinStatus(false); } } handleSubmit() { this.props.form.validateFields((err, values) => { if (!err) { this.props.dispatch({ type: `client/setJoinMeetingStatus`, payload: { joinMeetingStatus: true } }); var joinConfParam = { conferenceId: values.conferenceId.trim(), accessNumber: "+991117", confPasswd: values.confPasswd === undefined ? values.confPasswd : values.confPasswd.trim() }; const _this = this; window.setHweiMeeingNickname = values.nickname; this.props.client.joinConference(joinConfParam, function(ret) { if (ret.result) { _this.props.dispatch({ type: `client/setCurrentConferID`, payload: { currentConferID: values.conferenceId } }); } }); } }); } render() { const { getFieldDecorator } = this.props.form; return (
this.handleSubmit()} okText="加入" onCancel={() => { this.props.changeJoinStatus(false); }} >
{getFieldDecorator("conferenceId", { rules: [{ required: true, message: "请输入会议ID" }] })()} {getFieldDecorator( "confPasswd", )()} 提示:请输入姓名+公司名称}> {getFieldDecorator("nickname", { initialValue: this.props.username + "+" + this.props.comName })()}

); } }