import React, {Component} from 'react'; import {Layout, Butt, Spin, Row, Col, Tabs} from 'antd'; import './index.css' import {graphqlUrl} from "../../../config"; import {SHOW_ALL_CASE} from "../../../gql"; import {FormattedMessage} from 'react-intl'; import {request} from 'graphql-request' import UserCustom from "./UserCustom"; import {getCookie} from "../../../cookie"; const TabPane = Tabs.TabPane; const {Content} = Layout; class CaseShow extends Component { constructor(props) { super(props); this.state = { examplesFirst: [], examplesSecond: [], 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 examplesFirst = cases.filter(case1 => case1.title.includes('预约')); let examplesSecond = cases.filter(case2 => case2.title.includes('服装店')); if (this._isMounted) { this.setState({ examplesFirst, examplesSecond, }) } } ) } 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, examplesFirst, examplesSecond} = this.state; const tabStyle = { paddingBottom: '50px', height: '550px', display: 'inline-block', }; return (
{ !showCustom ?
{ examplesFirst.length === 0 ? : }
{ examplesSecond.length === 0 ? : }
: }
) } } export default CaseShow; class BaiduShow extends Component { constructor(props) { super(props); console.log(props); this.state = { showCaseID: props.examples[0].id, index: 0 } } render() { let {examples} = this.props; let {showCaseID, index} = this.state; let thisCase = examples[index]; return (
{thisCase.title}
{thisCase.detailDescription ? thisCase.detailDescription : '暂无简介'}
{thisCase.title
—— 打开微信扫码体验 ——
{ examples.map((item, index) => (
{ this.setState({ showCaseID: item.id, index }) }} key={index} > {item.title
{item.description}
)) }
) } }