From aed1ff699140de60131bf9cc1332c98063c66721 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 03 七月 2020 09:14:51 +0800 Subject: [PATCH] 2020-07-03 --- src/mob/controller/index.jsx | 107 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 87 insertions(+), 20 deletions(-) diff --git a/src/mob/controller/index.jsx b/src/mob/controller/index.jsx index b2a85eb..6a4306b 100644 --- a/src/mob/controller/index.jsx +++ b/src/mob/controller/index.jsx @@ -1,18 +1,21 @@ import React, {Component} from 'react' -// import PropTypes from 'prop-types' +import PropTypes from 'prop-types' import { is, fromJS } from 'immutable' -import { Collapse } from 'antd' +import { Collapse, Form, Input, Col, Icon, InputNumber, Select } from 'antd' import zhCN from '@/locales/zh-CN/mob.js' import enUS from '@/locales/en-US/mob.js' +import ColorSketch from '@/mob/colorsketch' import './index.scss' const { Panel } = Collapse +const { Option } = Select class MobController extends Component { - // static propTpyes = { - // collapse: PropTypes.bool, - // } + static propTpyes = { + editElem: PropTypes.any, + } + state = { dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, } @@ -21,24 +24,88 @@ return !is(fromJS(this.props), fromJS(nextProps)) || !is(fromJS(this.state), fromJS(nextState)) } - render () { + boldChange = (val) => { + console.log(val) + } + render () { + const { editElem } = this.props + const formItemLayout = { + labelCol: { + xs: { span: 24 }, + sm: { span: 8 } + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 } + } + } return ( <div className="mob-controller"> - <Collapse expandIconPosition="right"> - <Panel header="瀛椾綋" key="0"> - 瀛椾綋淇敼 - </Panel> - <Panel header="鑳屾櫙" key="1"> - 鑳屾櫙 - </Panel> - <Panel header="杈硅窛" key="2"> - 杈硅窛 - </Panel> - <Panel header="鍏朵粬" key="3"> - 鍏朵粬 - </Panel> - </Collapse> + <Form {...formItemLayout}> + {editElem ? <Collapse expandIconPosition="right" accordion={true}> + {editElem.items.includes('font') ? <Panel header="瀛椾綋" key="0"> + <Col span={12}> + <Form.Item colon={false} label={<Icon title="瀛椾綋澶у皬" type="font-size" />}> + <InputNumber min={12} max={100} precision={0} /> + </Form.Item> + </Col> + <Col span={12}> + <Form.Item colon={false} label={<Icon title="瀛椾綋绮楃粏" type="bold" />}> + <Select defaultValue="normal" onChange={this.boldChange}> + <Option value="normal">normal</Option> + <Option value="bold">bold</Option> + <Option value="bolder">bolder</Option> + <Option value="lighter">lighter</Option> + <Option value="100">100</Option> + <Option value="200">200</Option> + <Option value="300">300</Option> + <Option value="400">400</Option> + <Option value="500">500</Option> + <Option value="600">600</Option> + <Option value="700">700</Option> + <Option value="800">800</Option> + <Option value="900">900</Option> + </Select> + </Form.Item> + </Col> + <Col span={12}> + <Form.Item colon={false} label={<Icon title="琛岄棿璺�" type="line-height" />}> + <InputNumber min={1} max={10} precision={1} /> + </Form.Item> + </Col> + <Col span={12}> + <Form.Item colon={false} label={<Icon title="瀛楅棿璺�" type="column-width" />}> + <InputNumber min={0} max={100} precision={0} /> + </Form.Item> + </Col> + <Col span={24}> + <Form.Item + colon={false} + label={<Icon title="瀛椾綋棰滆壊" type="font-colors" />} + labelCol={{xs: { span: 24 }, sm: { span: 4 }}} wrapperCol={ {xs: { span: 24 }, sm: { span: 20 }} } + > + <ColorSketch /> + <Input /> + </Form.Item> + </Col> + <Col span={12}> + <Form.Item colon={false} label={<Icon title="瀛椾綋绮楃粏" type="bold" />}> + <Input /> + </Form.Item> + </Col> + </Panel> : null} + <Panel header="鑳屾櫙" key="1"> + 鑳屾櫙 + </Panel> + <Panel header="杈硅窛" key="2"> + 杈硅窛 + </Panel> + <Panel header="鍏朵粬" key="3"> + 鍏朵粬 + </Panel> + </Collapse> : null} + </Form> </div> ) } -- Gitblit v1.8.0