From 38d8379be1fd9a72b8bd511dfb57ad67292bdf1e Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期五, 29 十月 2021 18:42:32 +0800 Subject: [PATCH] 2021-10-29 --- src/views/login/index.jsx | 119 ++++++++++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 88 insertions(+), 31 deletions(-) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index 80ac8f3..c333d44 100644 --- a/src/views/login/index.jsx +++ b/src/views/login/index.jsx @@ -1,5 +1,5 @@ import React, { Component } from 'react' -import { message, Modal } from 'antd' +import { message, Modal, notification } from 'antd' import { connect } from 'react-redux' import md5 from 'md5' import moment from 'moment' @@ -9,12 +9,14 @@ import options, { styles } from '@/store/options.js' import zhCN from '@/locales/zh-CN/login.js' import enUS from '@/locales/en-US/login.js' +import asyncComponent from '@/utils/asyncComponent' import asyncLoadComponent from '@/utils/asyncLoadComponent' import { modifyMemberLevel } from '@/store/action' import './index.scss' const LoginForm = asyncLoadComponent(() => import('./loginform')) -const LoginCloudForm = asyncLoadComponent(() => import('./logincloudform')) +const Resetpwd = asyncLoadComponent(() => import('@/components/header/resetpwd')) +const LoginCloudForm = asyncComponent(() => import('./logincloudform')) const iszhCN = sessionStorage.getItem('lang') !== 'en-US' const _href = window.location.href.split('#')[0] @@ -42,7 +44,8 @@ loginWays: null, touristLogin: false, syncing: false, - visible: false + visible: false, + resetLoading: false } changelang (item) { @@ -111,34 +114,34 @@ localStorage.removeItem(_url) } - // let level = localStorage.getItem(_url + 'pwdlevel') + let level = localStorage.getItem(_url + 'pwdlevel') - // if (level) { - // let visible = false - // let tip = '瀵嗙爜寮哄害涓嶅锛岃淇敼瀵嗙爜锛�' - // if (param.password.length < 8) { - // visible = true - // } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(param.password)) { - // visible = true - // } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { - // visible = true - // } else if (level === 'char_num_90' && res.modifydate) { - // let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60) - // if (!isNaN(s) && s > 90) { - // visible = true - // tip = '鎮ㄥ凡90澶╂湭淇敼瀵嗙爜锛岃鏇存崲瀵嗙爜鍚庝娇鐢紒' - // } - // } + if (level) { + let visible = false + let tip = '瀵嗙爜寮哄害涓嶅锛岃淇敼瀵嗙爜锛�' + if (param.password.length < 8) { + visible = true + } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(param.password)) { + visible = true + } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(param.password)) { + visible = true + } else if (level === 'char_num_90' && res.modifydate) { + let s = (new Date().getTime() - new Date(res.modifydate).getTime()) / (1000 * 24 * 60 * 60) + if (!isNaN(s) && s > 90) { + visible = true + tip = '鎮ㄥ凡90澶╂湭淇敼瀵嗙爜锛岃鏇存崲瀵嗙爜鍚庝娇鐢紒' + } + } - // if (visible) { - // message.warning(tip) - // this.setState({ - // isDisabled: false, - // visible: true - // }) - // return - // } - // } + if (visible) { + message.warning(tip) + this.setState({ + isDisabled: false, + visible: true + }) + return + } + } let _history = sessionStorage.getItem('history') if (_history) { @@ -457,7 +460,7 @@ app_version: res.app_version } - let level = res.pwd_level || 'char_num_90' + let level = res.pwd_level || '' if (level && !['letter_num', 'char_num', 'char_num_90'].includes(level)) { level = '' @@ -626,7 +629,6 @@ param.rduri = options.cloudServiceApi.replace('dostars', 'dostar') } - this.logincloudRef.handleConfirm().then(result => { param.UserName = result.cloudusername param.Password = result.cloudpassword @@ -669,6 +671,48 @@ } }) }) + } + + resetPwdSubmit = () => { + this.formRef.handleConfirm().then(res => { + this.setState({ + resetLoading: true + }) + + let _param = { + func: 's_PwdUpt', + LText: `select '${res.originpwd}','${res.password}'` + } + + _param.timestamp = moment().format('YYYY-MM-DD HH:mm:ss') // 鏃堕棿鎴� + _param.LText = Utils.formatOptions(_param.LText) // 鍏抽敭瀛楃鏇挎崲锛宐ase64鍔犲瘑 + _param.secretkey = Utils.encrypt(_param.LText, _param.timestamp) // md5瀵嗛挜 + + Api.getSystemConfig(_param).then(result => { + this.setState({ + visible: !result.status, + resetLoading: false + }) + + if (result.status) { + notification.success({ + top: 92, + message: '淇敼鎴愬姛锛岃閲嶆柊鐧诲綍銆�', + duration: 2 + }) + const input = document.getElementById('password') + if (input) { + input.select() + } + } else { + notification.warning({ + top: 92, + message: result.message, + duration: 5 + }) + } + }) + }, () => {}) } /** @@ -729,6 +773,19 @@ > <LoginCloudForm handleSubmit={() => this.syncSubmit()} wrappedComponentRef={(inst) => this.logincloudRef = inst}/> </Modal> + {/* 淇敼瀵嗙爜 */} + <Modal + title="淇敼瀵嗙爜" + okText={this.state.dict['login.ok']} + cancelText={this.state.dict['login.cancel']} + visible={this.state.visible} + onOk={this.resetPwdSubmit} + confirmLoading={this.state.resetLoading} + onCancel={() => this.setState({visible: false, resetLoading: false})} + destroyOnClose + > + <Resetpwd wrappedComponentRef={(inst) => this.formRef = inst} resetPwdSubmit={this.resetPwdSubmit}/> + </Modal> </div> ) } -- Gitblit v1.8.0