import { WeaTools } from 'ecCom'; import React, { Component } from 'react'; import { WeaDialog, WeaLocaleProvider } from 'ecCom'; import { Button } from 'antd'; import ReactDOM from 'react-dom'; const getLabel = WeaLocaleProvider.getLabel; const isWeakPassword = (params = {}) => WeaTools.callApi('/api/hrm/password/isWeakPassword', 'POST', params); export const checkWeakPass = (password,onOk,onCancel) => { isWeakPassword({ password }).then(datas => { const { weakPasswordDisable, isWeakPassword, defaultPasswordEnable } = datas; if (isWeakPassword) { const div = document.createElement("div"); document.body.appendChild(div); ReactDOM.render(,div); } else { onOk(); } }).catch(() => { onOk(); }) } class PassConfirm extends Component{ constructor(props){ super(props); this.state = { visible:false } } componentDidMount() { this.setState({visible:true}); } handleOk = () => { const {weakPasswordDisable,onOk}= this.props; if (weakPasswordDisable === "0") { onOk && onOk(); this.setState({visible:false}); }else{ this.handleCancel(); } } handleCancel = () => { const {onCancel} = this.props; this.setState({visible:false}); onCancel && onCancel(); } getButtons = () => { const {weakPasswordDisable}= this.props; const btns =[ {getLabel(33703, '确定')}, ] if (weakPasswordDisable === "0") { btns.push({getLabel(32694, '取消')}) } return btns; } render() { const { visible } = this.state, { weakPasswordDisable } = this.props; const pstyle = { display: "table-cell", verticalAlign: "middle", padding: "0 20px" } if (!visible) { return null; } return ( { (weakPasswordDisable === "0") ? getLabel('515419','该密码比较容易被猜到,确定保存吗?') : getLabel('515420','该密码比较容易被猜到,为了您的系统安全,请重新修改密码。') } ); } }
{ (weakPasswordDisable === "0") ? getLabel('515419','该密码比较容易被猜到,确定保存吗?') : getLabel('515420','该密码比较容易被猜到,为了您的系统安全,请重新修改密码。') }