import React from 'react'; import { Button } from 'antd'; import { WeaTools, WeaLocaleProvider, WeaTop, WeaDialog } from 'ecCom'; import { addContentPath } from '../../util/pathUtil'; const getLabel = WeaLocaleProvider.getLabel; class WeaVersion extends React.Component { constructor(props) { super(props); this.state = { loading: false, data: {} }; } componentWillMount() { const { display, visible } = this.props; if (display == 'page' || visible) { this.onLoad(); } } componentWillReceiveProps(nextProps) { const { visible } = nextProps; if (visible) { this.onLoad(); } } render() { const { display, visible, style = {} } = this.props; const { loading, data } = this.state; const { logo, label1, cversion, label2, companyname, label3, website, msg1, msg2, msg3, msg4, label4, copyright } = data; const Content = (
{label1} :   {cversion}
{label2} :   {companyname}
{label3} :   {website}

{msg1}

{msg2}

{msg3}

{msg4}

{label4}   ©   {copyright}
); if (display == 'page') { return ( } iconBgcolor="#a7adb5" buttons={this.getButtons(display)} > {Content} ); } return ( {Content} ); } getButtons = (display) => { const buttons = []; buttons.push( , ); if (display != 'page') { buttons.push( , ); } return buttons; }; onLoad = () => { this.setState({ loading: true }); WeaTools.callApi('/api/portal/systemInfo/getVersion', 'GET').then((result) => { this.setState({ loading: false, data: result.data || {} }); }); }; onDownload = () => { window.open(addContentPath('/api/system/license/downloadVersion')); }; onCancel = () => { this.props.onShow(false); }; } export default WeaVersion;