| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Modal, Tabs } from 'antd' |
| | | import { Modal, Tabs, message } from 'antd' |
| | | import { FormOutlined } from '@ant-design/icons' |
| | | |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | import './index.scss' |
| | | |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: localStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | visible: false, |
| | | html: '', |
| | | css: '', |
| | |
| | | visible: true, |
| | | html: config.html || '', |
| | | css: config.css || '', |
| | | js: config.js || '', |
| | | js: config.js || '// Function(data, result, Api, notification, systemType) data-数据列表,result-查询接口返回结果,Api-接口,notification-信息提示控件(移动端为Toast),systemType-系统类型(正式为 production,测试为空)', |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | onJsChange = (val) => { |
| | | if (/document\.getElementsByTagName/g.test(val)) { |
| | | message.warning('为防止代码冲突,js中不可使用document.getElementsByTagName方法!') |
| | | return |
| | | } |
| | | |
| | | this.setState({ |
| | | js: val |
| | | }) |
| | | } |
| | | |
| | | render () { |
| | | const { visible, dict, html, css, js } = this.state |
| | | const { visible, html, css, js } = this.state |
| | | |
| | | return ( |
| | | <div style={{display: 'inline-block'}}> |
| | | <Icon title="代码编辑" style={{color: 'purple'}} type="form" onClick={() => this.trigger()} /> |
| | | <FormOutlined title="代码编辑" style={{color: 'purple'}} onClick={() => this.trigger()} /> |
| | | <Modal |
| | | wrapClassName="popview-modal code-sand-box-code-editor" |
| | | title="内容编辑" |
| | | visible={visible} |
| | | width={950} |
| | | maskClosable={false} |
| | | okText={dict['model.submit']} |
| | | okText="提交" |
| | | onOk={this.verifySubmit} |
| | | onCancel={() => { this.setState({ visible: false }) }} |
| | | destroyOnClose |