import React, {Component} from 'react'; import {Layout, Card, Button, Avatar, Spin, Icon, Row, Col, notification, Tabs, Select} from 'antd'; import lo from '../../../images/lo.png' import './index.css' import {graphqlUrl} from "../../../config"; import {SHOW_ALL_CASE, SHOW_CASE} from "../../../gql"; import {FormattedMessage} from 'react-intl'; import {request} from 'graphql-request' import UserCustom from "./UserCustom"; import {Query} from "react-apollo"; import gql from "graphql-tag"; import {getCookie} from "../../../cookie"; const TabPane = Tabs.TabPane; const {Content} = Layout; const {Meta} = Card; class CaseShow extends Component { constructor(props) { super(props); this.state = { examplesMP: [], examplesPublic: [], examplesH5: [], showCustom: false, chosenSchemaID: '', activeKey: '1', showCaseID: 'order-react-CaseID' } } componentWillMount() { this._isMounted = true; // 查询是否登录 let userID = getCookie('user_id'); if (userID !== undefined && userID !== '') { this.setState({ userID }); } request(graphqlUrl, SHOW_ALL_CASE, {}).then(data => { let cases = data.case_by_props; let examplesMP = cases.filter(case1 => case1.description === '小程序'); let examplesPublic = cases.filter(case2 => case2.description === '公众号'); let examplesH5 = cases.filter(case2 => case2.description === 'H5'); if (this._isMounted) { this.setState({ examplesMP, examplesPublic, examplesH5 }) } } ) } componentWillUnmount() { this._isMounted = false; } schemaIDChangeBucket = (schemaID) => { if (this.props.location && this.props.location.state) { switch (schemaID) { case 'order_schemaID': return 'appointment'; case 'ecommerce_schemaID': return 'e-commerce'; case 'bills_schemaID': return 'bills'; default: break; } } }; backToMe = () => { this.setState({ showCustom: false }) }; render() { let {userID, showCustom, chosenSchemaID, activeKey, showCaseID} = this.state; const tabStyle = { paddingTop: '50px', paddingBottom: '50px', height: '550px', display: 'inline-block', }; return (