|  | @@ -6,6 +6,7 @@ import { Form, Input, message, Modal } from 'antd'
 | 
	
		
			
				|  |  |  import React, { useEffect, useState } from 'react'
 | 
	
		
			
				|  |  |  import { apiAccountChange } from '../api'
 | 
	
		
			
				|  |  |  import styles from '../index.module.scss'
 | 
	
		
			
				|  |  | +import StrengthMeter from '@/components/StrengthMeter'
 | 
	
		
			
				|  |  |  interface iPswModalProps {
 | 
	
		
			
				|  |  |    visible: boolean
 | 
	
		
			
				|  |  |    onCancel: () => void
 | 
	
	
		
			
				|  | @@ -16,13 +17,13 @@ interface iValues {
 | 
	
		
			
				|  |  |    ps_account: string
 | 
	
		
			
				|  |  |    ps_password: string
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  | -const PswModal:React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id, account } }) => {
 | 
	
		
			
				|  |  | +const PswModal: React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id, account } }) => {
 | 
	
		
			
				|  |  |    const [ loading, setLoading ] = useState(false)
 | 
	
		
			
				|  |  |    const [ form ] = Form.useForm()
 | 
	
		
			
				|  |  |    const onCreate = async (values: iValues) => {
 | 
	
		
			
				|  |  |      setLoading(true)
 | 
	
		
			
				|  |  |      const { code = -1 } = await apiAccountChange(values)
 | 
	
		
			
				|  |  | -    if ( code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  | +    if (code === consts.RET_CODE.SUCCESS) {
 | 
	
		
			
				|  |  |        message.success('修改成功')
 | 
	
		
			
				|  |  |        onCancel()
 | 
	
		
			
				|  |  |      }
 | 
	
	
		
			
				|  | @@ -32,7 +33,7 @@ const PswModal:React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id,
 | 
	
		
			
				|  |  |      form.setFieldsValue({ id, ps_account: account })
 | 
	
		
			
				|  |  |    }, [ visible ])
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -  const pswHandler = () => {
 | 
	
		
			
				|  |  | +  const handlePsw = () => {
 | 
	
		
			
				|  |  |      const ps_password = generatePsw(12)
 | 
	
		
			
				|  |  |      form.setFieldsValue({ ps_password })
 | 
	
		
			
				|  |  |    }
 | 
	
	
		
			
				|  | @@ -52,26 +53,34 @@ const PswModal:React.FC<iPswModalProps> = ({ visible, onCancel, userInfo: { id,
 | 
	
		
			
				|  |  |              onCreate(values)
 | 
	
		
			
				|  |  |            })
 | 
	
		
			
				|  |  |          }}
 | 
	
		
			
				|  |  | +      >
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        <Form
 | 
	
		
			
				|  |  | +          form={form}
 | 
	
		
			
				|  |  | +          layout="vertical"
 | 
	
		
			
				|  |  | +          className={styles.FormContent}
 | 
	
		
			
				|  |  |          >
 | 
	
		
			
				|  |  | -          <Form
 | 
	
		
			
				|  |  | -            form={form}
 | 
	
		
			
				|  |  | -            layout="vertical"
 | 
	
		
			
				|  |  | -            className={styles.FormContent}
 | 
	
		
			
				|  |  | -            >
 | 
	
		
			
				|  |  | -            <Form.Item name="id" hidden>
 | 
	
		
			
				|  |  | -              <Input />
 | 
	
		
			
				|  |  | -            </Form.Item>
 | 
	
		
			
				|  |  | -            <Form.Item name="ps_account" label="登录账号" rules={[ { required: true, message: '请输入账号' } ]}>
 | 
	
		
			
				|  |  | -              <Input />
 | 
	
		
			
				|  |  | -            </Form.Item>
 | 
	
		
			
				|  |  | -            <Form.Item name="ps_password" label="登录密码" rules={[ { required: true, message: '请输入登录密码' } ]}>
 | 
	
		
			
				|  |  | -              <Input.Password
 | 
	
		
			
				|  |  | -                placeholder="密码支持英文数字及符号"
 | 
	
		
			
				|  |  | -                addonAfter={<span className="pi-pd-lr-11" onClick={() => pswHandler()}>随机密码</span>}
 | 
	
		
			
				|  |  | -                iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)}
 | 
	
		
			
				|  |  | -              />
 | 
	
		
			
				|  |  | -        </Form.Item>
 | 
	
		
			
				|  |  | -          </Form>
 | 
	
		
			
				|  |  | +          <Form.Item name="id" hidden>
 | 
	
		
			
				|  |  | +            <Input />
 | 
	
		
			
				|  |  | +          </Form.Item>
 | 
	
		
			
				|  |  | +          <Form.Item name="ps_account" label="登录账号" rules={[ { required: true, message: '请输入账号' } ]}>
 | 
	
		
			
				|  |  | +            <Input />
 | 
	
		
			
				|  |  | +          </Form.Item>
 | 
	
		
			
				|  |  | +          <Form.Item name="ps_password" label="登录密码" rules={[ { required: true, message: '请输入登录密码' }, () => ({
 | 
	
		
			
				|  |  | +            validator(_, value) {
 | 
	
		
			
				|  |  | +              if (/(?=.*[0-9])(?=.*[a-zA-Z]).{6,30}/.test(value)) {
 | 
	
		
			
				|  |  | +                return Promise.resolve()
 | 
	
		
			
				|  |  | +              }
 | 
	
		
			
				|  |  | +              return Promise.reject('密码必须带有字母与数字的组合且大于6位')
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +          }) ]}>
 | 
	
		
			
				|  |  | +            <StrengthMeter placeholder="密码支持英文数字及符号"
 | 
	
		
			
				|  |  | +              addonAfter={<span className="pi-pd-lr-11" onClick={() => handlePsw()}>随机密码</span>}
 | 
	
		
			
				|  |  | +              allowClear
 | 
	
		
			
				|  |  | +              iconRender={visible => (visible ? <EyeTwoTone /> : <EyeInvisibleOutlined />)} />
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +          </Form.Item>
 | 
	
		
			
				|  |  | +        </Form>
 | 
	
		
			
				|  |  |        </Modal>
 | 
	
		
			
				|  |  |      </div>
 | 
	
		
			
				|  |  |    )
 |