king
2022-04-26 5046d0d13dc6a8563b8e54e31913bc44cfa1072f
src/views/login/loginform.jsx
@@ -2,6 +2,7 @@
import PropTypes from 'prop-types'
import { is, fromJS } from 'immutable'
import { Form, Icon, Input, Button, Modal, message } from 'antd'
import { UserOutlined } from '@ant-design/icons'
import md5 from 'md5'
import moment from 'moment'
@@ -43,6 +44,9 @@
    let _url = window.location.href.split('#')[0]
    
    if (localStorage.getItem(_url + 'remember') === 'false') {
      remember = false
    }
    if (!window.GLOB.keepKey) {
      remember = false
    }
@@ -199,27 +203,61 @@
      return
    }
    let param = {
      func: 'MSN_sms_send_code',
    let _param = {
      func: 'mes_sms_send_code_sso',
      send_type: 'login',
      mob: _phone,
      timestamp: moment().format('YYYY-MM-DD HH:mm:ss'),
      ID: smsId
    }
    _param.LText = 'minke'
    _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss')
    _param.secretkey = md5(`${_param.LText}mingke${_param.timestamp}`)
    _param.userid = sessionStorage.getItem('visitorUserID') || ''
    _param.LoginUID = sessionStorage.getItem('visitorLoginUID') || ''
    param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`)
    param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
    Api.getSystemConfig(_param).then(res => {
      if (!res.status || !res.n_id) {
        message.warning(res.message || '验证码获取失败!')
        return
      }
    this.setState({
      verdisabled: true,
      delay: 60
    })
    LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000)
      let param = {
        func: 'MSN_sms_send_code',
        send_type: 'login',
        mob: _phone,
        timestamp: moment().format('YYYY-MM-DD HH:mm:ss'),
        ID: smsId,
        n_id: res.n_id
      }
      param.LText = md5(`${_phone}mingke${window.GLOB.appkey}${param.timestamp}`)
      param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
    Api.getSystemConfig(param).then(res => {
      if (res.status) {
      } else {
      param.rduri = 'http://sso.mk9h.cn/webapi/dostars'
      param.userid = 'bh0bapabtd45epsgra79segbch6c1ibk'
      param.LoginUID = 'bh0bapabtd45epsgra79segbch6c1ibk'
      this.setState({
        verdisabled: true,
        delay: 60
      })
      LoginVerCodeTimer = setTimeout(this.resetVerCodeDelay, 1000)
      Api.getLocalConfig(param).then(res => {
        if (res.status) {
        } else {
          if (LoginVerCodeTimer) {
            clearTimeout(LoginVerCodeTimer)
          }
          this.setState({
            verdisabled: false,
            delay: null
          })
          message.warning(res.message)
        }
      }, () => {
        if (LoginVerCodeTimer) {
          clearTimeout(LoginVerCodeTimer)
        }
@@ -227,15 +265,6 @@
          verdisabled: false,
          delay: null
        })
        message.warning(res.message)
      }
    }, () => {
      if (LoginVerCodeTimer) {
        clearTimeout(LoginVerCodeTimer)
      }
      this.setState({
        verdisabled: false,
        delay: null
      })
    })
  }
@@ -283,7 +312,7 @@
              initialValue: this.state.username || '',
            })(
              <Input
                prefix={<Icon type="user" style={{ color: 'rgba(0,0,0,.25)' }} />}
                prefix={<UserOutlined style={{ color: 'rgba(0,0,0,.25)' }} />}
                placeholder={this.props.dict['login.username']}
                autoComplete="off"
              />,
@@ -311,7 +340,7 @@
              />
            )}
          </Form.Item> : null}
          {activeKey === 'sms_vcode' ? <Form.Item>
          {activeKey === 'sms_vcode' ? <Form.Item className="vercode">
            {getFieldDecorator('vercode', {
              initialValue: '',
              rules: [
@@ -338,22 +367,12 @@
              initialValue: remember,
            })(<Checkbox onChange={this.rememberChange}>{this.props.dict['login.remember']}</Checkbox>)}
          </Form.Item> : null} */}
          {/* <Form.Item className="minline right">
            {getFieldDecorator('system', {
              initialValue: localStorage.getItem('bmsSystem') === 'new' ? 'new' : 'old',
            })(
              <Select getPopupContainer={() => document.getElementById('login-form')}>
                <Select.Option key="old" value="old">原系统</Select.Option>
                <Select.Option key="new" value="new">新系统</Select.Option>
              </Select>
            )}
          </Form.Item> */}
          {['uname_pwd', 'sms_vcode'].includes(activeKey) ? <Form.Item className="btn-login">
            <Button type="primary" htmlType="submit" className="login-form-button" disabled={this.props.isDisabled} loading={this.props.isDisabled}>
              {this.props.dict['login.submit']}
            </Button>
          </Form.Item> : null}
          {options.sysType === 'cloud' ? <Form.Item className="register-line">
          {options.sysType === 'cloud' && options.cdomain.indexOf('mk9h') > -1 ? <Form.Item className="register-line">
            <a href="http://minkesoft.com/#/signup" target="_blank" rel="noopener noreferrer" className="register">注册</a>
            <a href="http://minkesoft.com/#/forgotPwd" target="_blank" rel="noopener noreferrer" className="forgot">忘记密码?</a>
          </Form.Item> : null}