king
2021-10-21 1da6506bf58270bacc2a4345002c6b082835580e
src/pc/components/login/normal-login/index.jsx
@@ -10,10 +10,11 @@
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'
const LoginForm = asyncComponent(() => import('./loginform'))
const WrapComponent = asyncIconComponent(() => import('../wrapsetting'))
const NormalForm = asyncIconComponent(() => import('@/components/normalform'))
class PropCardEditComponent extends Component {
  static propTpyes = {
@@ -43,11 +44,11 @@
        width: card.width || 24,
        name: card.name,
        subtype: card.subtype,
        wrap: { name: card.name, width: card.width || 24, loginWays: ['uname_pwd'] },
        wrap: { name: card.name, width: card.width || 24, loginWays: ['uname_pwd'], shortcut: 'remember' },
        style: { background: '#ffffff', width: '330px', borderRadius: '4px', marginLeft: '55vw'},
        loginWays: [
          {type: 'uname_pwd', label: '账号密码', remember: 'true'},
          {type: 'sms_vcode', label: '短信验证码'},
          {type: 'uname_pwd', label: '账号登录', shortcut: 'remember'},
          {type: 'sms_vcode', label: '短信登录'},
          {type: 'app_scan', label: '扫码登录'},
        ]
      }
@@ -141,6 +142,24 @@
    }
  }
  getWrapForms = () => {
    const { wrap } = this.state.card
    return getWrapForm(wrap)
  }
  updateWrap = (res) => {
    let card = fromJS(this.state.card).toJS()
    card.wrap = res
    if (res.shortcut) {
      card.loginWays[0].shortcut = res.shortcut
    }
    this.updateComponent(card)
  }
  render() {
    const { card, dict } = this.state
    let style = resetStyle(card.style)
@@ -159,7 +178,9 @@
      <div className="login-edit-box" style={style} onClick={this.clickComponent} id={card.uuid}>
        <Popover overlayClassName="mk-popover-control-wrap" mouseLeaveDelay={0.2} mouseEnterDelay={0.2} content={
          <div className="mk-popover-control">
            <WrapComponent config={card} updateConfig={this.updateComponent} />
            <NormalForm title="登录设置" width={800} update={this.updateWrap} getForms={this.getWrapForms}>
              <Icon type="edit" 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)} />
          </div>