| | |
| | | import React, {Component} from 'react' |
| | | import PropTypes from 'prop-types' |
| | | import { is, fromJS } from 'immutable' |
| | | import { Icon, Popover } from 'antd' |
| | | import { Popover } from 'antd' |
| | | import { EditOutlined, FontColorsOutlined, ToolOutlined, DeleteOutlined } from '@ant-design/icons' |
| | | |
| | | import asyncIconComponent from '@/utils/asyncIconComponent' |
| | | import asyncComponent from '@/utils/asyncComponent' |
| | | |
| | | import MKEmitter from '@/utils/events.js' |
| | | import zhCN from '@/locales/zh-CN/model.js' |
| | | import enUS from '@/locales/en-US/model.js' |
| | | import { resetStyle } from '@/utils/utils-custom.js' |
| | | import getWrapForm from './options' |
| | | import './index.scss' |
| | |
| | | } |
| | | |
| | | state = { |
| | | dict: sessionStorage.getItem('lang') !== 'en-US' ? zhCN : enUS, |
| | | card: null, |
| | | back: false |
| | | } |
| | |
| | | let _card = fromJS(card).toJS() |
| | | if (_card.loginWays.length === 2) { |
| | | _card.loginWays.push({type: 'app_scan', label: '扫码登录'}) |
| | | } |
| | | if (_card.wrap.link && _card.wrap.link === 'menu') { |
| | | _card.wrap.linkmenu = _card.uuid |
| | | } |
| | | this.setState({ |
| | | card: _card |
| | |
| | | } |
| | | |
| | | getWrapForms = () => { |
| | | const { wrap } = this.state.card |
| | | const { card } = this.state |
| | | |
| | | return getWrapForm(wrap) |
| | | return getWrapForm(card.wrap) |
| | | } |
| | | |
| | | updateWrap = (res) => { |
| | |
| | | } |
| | | |
| | | render() { |
| | | const { card, dict } = this.state |
| | | const { card } = this.state |
| | | let style = resetStyle(card.style) |
| | | if (card.wrap.maxWidth) { |
| | | style.maxWidth = card.wrap.maxWidth |
| | |
| | | <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={ |
| | | <div className="mk-popover-control"> |
| | | <NormalForm title="登录设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}> |
| | | <Icon type="edit" style={{color: '#1890ff'}} title="编辑"/> |
| | | <EditOutlined style={{color: '#1890ff'}} title="编辑"/> |
| | | </NormalForm> |
| | | <Icon className="style" title="调整样式" onClick={this.changeStyle} type="font-colors" /> |
| | | <Icon className="close" title="删除组件" type="delete" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | <FontColorsOutlined className="style" title="调整样式" onClick={this.changeStyle}/> |
| | | <DeleteOutlined className="close" title="删除组件" onClick={() => this.props.deletecomponent(card.uuid)} /> |
| | | </div> |
| | | } trigger="hover"> |
| | | <Icon type="tool" /> |
| | | <ToolOutlined /> |
| | | </Popover> |
| | | <LoginForm loginWays={card.loginWays} wrap={card.wrap} menuId={card.uuid} dict={dict} /> |
| | | <LoginForm loginWays={card.loginWays} wrap={card.wrap} /> |
| | | </div> |
| | | ) |
| | | } |