import React, {Component} from 'react'; import {Layout, Button, notification, Row, Col, Icon, message, Radio} from 'antd'; import {getCookie} from "../../../cookie"; import {graphqlUrl} from "../../../config"; import {SEARCH_APIGROUP} from "../../../gql"; import {request} from 'graphql-request' import {FormattedMessage} from 'react-intl'; import copy from 'copy-to-clipboard'; import UserCustom from './UserCustom'; const {Content} = Layout; class ExampleDetail extends Component { constructor() { super(); this.state = { userID: '', bucketName: '', domain: '', showCustom: false }; } componentWillMount() { this._isMounted = true; // 查询是否登录 let userID = getCookie('user_id'); if (userID !== undefined && userID !== '') { this.setState({ userID }); } // 查询跳转来的案例,转成 apigroup id let groupID = ''; if (this.props.location && this.props.location.state) { switch (this.props.location.state.schemaID) { case 'order_schemaID': this.setState({ bucketName: 'appointment' }); groupID = 'order'; break; case 'ecommerce_schemaID': this.setState({ bucketName: 'e-commerce' }); groupID = 'ecommerce'; break; case 'bills_schemaID': this.setState({ bucketName: 'bills' }); groupID = 'bills'; break; default: break; } } // 查询该案例的 domain request(graphqlUrl, SEARCH_APIGROUP, {id: groupID}).then(res => { let caseDeploy = res.apiGWGroupbyid; let domain = caseDeploy.defaultDomain; if (this._isMounted) { this.setState({ domain }) } }) } componentWillUnmount() { this._isMounted = false; } backToMe = () => { this.setState({ showCustom: false }) }; render() { let {userID, bucketName, domain, showCustom} = this.state; return (