From d823c59ba0b5f73e06c90d8bcae4dd25f5dfab64 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期四, 07 九月 2023 17:18:02 +0800 Subject: [PATCH] Merge branch 'master' into positec --- src/views/login/index.jsx | 217 +++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 150 insertions(+), 67 deletions(-) diff --git a/src/views/login/index.jsx b/src/views/login/index.jsx index b0a2552..3135c50 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 md5 from 'md5' import moment from 'moment' @@ -16,6 +16,7 @@ const LoginForm = asyncLoadComponent(() => import('./loginform')) const Resetpwd = asyncLoadComponent(() => import('@/components/resetPassword')) const LoginCloudForm = asyncComponent(() => import('./logincloudform')) +const LoginCodeForm = asyncComponent(() => import('./logincodeform')) const iszhCN = sessionStorage.getItem('lang') !== 'en-US' const _href = window.location.href.split('#')[0] @@ -119,6 +120,16 @@ } } else { users = [] + } + + // positecgroup + if (res.token) { + this.setState({ + isDisabled: false, + verify: {...res, $password: param.password}, + codeVisible: true + }) + return } users = users.filter(item => item.username !== param.username) @@ -536,20 +547,20 @@ Api.getTouristMsg().then(result => { if (result.status) { - if (result.website && process.env.NODE_ENV === 'production') { - let website = result.website.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() - let current = window.GLOB.baseurl.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() + // if (result.website && process.env.NODE_ENV === 'production') { + // let website = result.website.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() + // let current = window.GLOB.baseurl.replace(/http(s)?:\/\/|\/$/ig, '').toLowerCase() - if (website !== current) { - try { - window.history.replaceState(null, null, result.website.replace(/\/$/ig, '') + '/admin/index.html#/login') - window.location.reload() - } catch(e) { - window.location.href = result.website.replace(/\/$/ig, '') + '/admin/index.html#/login' - } - return - } - } + // if (website !== current) { + // try { + // window.history.replaceState(null, null, result.website.replace(/\/$/ig, '') + '/admin/index.html#/login') + // window.location.reload() + // } catch(e) { + // window.location.href = result.website.replace(/\/$/ig, '') + '/admin/index.html#/login' + // } + // return + // } + // } sessionStorage.setItem('visitorUserID', result.UserID || '') sessionStorage.setItem('visitorLoginUID', result.LoginUID || '') @@ -574,25 +585,26 @@ if (!res) return if (res.status) { - if (window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { - if (md5(('mk' + window.GLOB.appkey + res.sys_datetime + res.member_type + res.registry_date).toLowerCase()) !== res.secret_key) { - Modal.warning({ - title: '瀵嗛挜閿欒锛岃鑱旂郴绠$悊鍛橈紒', - okText: '鐭ラ亾浜�' - }) - this.setState({ - auth: false, - authError: '瀵嗛挜閿欒锛岃鑱旂郴绠$悊鍛橈紒' - }) - return - } else if (res.member_type === 'personal' && res.registry_date) { - let saveDelay = 0 - try { - saveDelay = parseInt((new Date().getTime() - new Date(res.registry_date).getTime()) / 4320000) - sessionStorage.setItem('mkDelay', saveDelay) - } catch(e) {} - } - } + // positecgroup + // if (window.GLOB.sysType === 'local' && window.GLOB.systemType !== 'production') { + // if (md5(('mk' + window.GLOB.appkey + res.sys_datetime + res.member_type + res.registry_date).toLowerCase()) !== res.secret_key) { + // Modal.warning({ + // title: '瀵嗛挜閿欒锛岃鑱旂郴绠$悊鍛橈紒', + // okText: '鐭ラ亾浜�' + // }) + // this.setState({ + // auth: false, + // authError: '瀵嗛挜閿欒锛岃鑱旂郴绠$悊鍛橈紒' + // }) + // return + // } else if (res.member_type === 'personal' && res.registry_date) { + // let saveDelay = 0 + // try { + // saveDelay = parseInt((new Date().getTime() - new Date(res.registry_date).getTime()) / 4320000) + // sessionStorage.setItem('mkDelay', saveDelay) + // } catch(e) {} + // } + // } if (!['shutter', 'linkage_navigation', 'linkage', 'menu_board', 'menu_board_navigation'].includes(res.menu_type)) { res.menu_type = 'shutter' @@ -613,7 +625,18 @@ showline: res.split_line_show || 'true', webSite: res.WebSite || '', navBar: res.menu_type, // shutter 鐧惧彾绐椼�乴inkage_navigation 鑱斿姩鑿滃崟銆乴inkage 鑱斿姩鑿滃崟_鏃犲鑸爮銆乵enu_board 鑿滃崟闈㈡澘銆乵enu_board_navigation 鑿滃崟闈㈡澘_鏍囩椤� - app_version: res.app_version + app_version: res.app_version, + Member_Level: 0 + } + + if ([10, 20, 30, 40, 50, 60, 70, 80, 90, 100].includes(res.member_level)) { + systemMsg.Member_Level = md5('mksoft' + window.GLOB.appkey + res.member_level) + if (!window.GLOB.memberLevel) { + Object.defineProperty(window.GLOB, 'memberLevel', { + writable: false, + value: res.member_level + }) + } } let level = res.pwd_level || '' @@ -703,40 +726,33 @@ document.getElementsByTagName('head')[0].appendChild(link) } - let memberLevel = res.member_level - - if (typeof(memberLevel) === 'number' && memberLevel > 0 && parseInt(memberLevel / 10) * 10 === memberLevel) { - sessionStorage.setItem('Member_Level', md5('mksoft' + window.GLOB.appkey + new Date().getFullYear() + new Date().getMonth() + memberLevel)) - window.GLOB.memberLevel = memberLevel - } - // positecgroup - // if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { - // Api.genericInterface ({ - // func: 's_Get_local_u_deleted', - // users_upt_date: res.users_upt_date, - // userid: result.UserID, - // LoginUID: result.LoginUID - // }).then(localres => { - // if (!localres.status) return - // Api.getSystemConfig({ - // func: 's_get_sso_u_create', - // user_ids: localres.user_ids, - // user_ids_local: localres.user_ids_local, - // users_upt_date: localres.users_upt_date, - // userid: result.UserID, - // LoginUID: result.LoginUID - // }).then(ssores => { - // if (!ssores.status) return - // Api.genericInterface ({ - // func: 's_get_local_u_create', - // user_ids_local: ssores.user_ids_local, - // userid: result.UserID, - // LoginUID: result.LoginUID - // }) - // }) - // }) - // } + if (res.users_upt === 'true' && window.GLOB.systemType === 'production') { + Api.genericInterface({ + func: 's_Get_local_u_deleted', + users_upt_date: res.users_upt_date, + userid: result.UserID, + LoginUID: result.LoginUID + }).then(localres => { + if (!localres.status) return + Api.getSystemConfig({ + func: 's_get_sso_u_create', + user_ids: localres.user_ids, + user_ids_local: localres.user_ids_local, + users_upt_date: localres.users_upt_date, + userid: result.UserID, + LoginUID: result.LoginUID + }).then(ssores => { + if (!ssores.status) return + Api.genericInterface({ + func: 's_get_local_u_create', + user_ids_local: ssores.user_ids_local, + userid: result.UserID, + LoginUID: result.LoginUID + }) + }) + }) + } } else { message.warning(res.message) } @@ -846,6 +862,59 @@ }) } + codeSubmit = () => { + const { verify } = this.state + this.codeRef.handleConfirm().then(res => { + this.setState({ + codeLoading: true + }) + Api.verifycode({...verify, code: res.code}).then(result => { + this.setState({ + codeVisible: false, + codeLoading: false + }) + + if (result.verifyResult === 'success') { + let level = localStorage.getItem(_href + 'pwdlevel') + if (level) { + let visible = false + let tip = '瀵嗙爜寮哄害涓嶅锛岃淇敼瀵嗙爜锛�' + if (verify.$password.length < 8) { + visible = true + } else if (level === 'letter_num' && /^([^0-9]*|[^a-zA-Z]*)$/.test(verify.$password)) { + visible = true + } else if ((level === 'char_num' || level === 'char_num_90') && /^([^0-9]*|[^a-zA-Z]*|[^!@#$%^&*()_]*)$/.test(verify.$password)) { + visible = true + } else if (level === 'char_num_90' && verify.modifydate) { + let s = (new Date().getTime() - new Date(verify.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 + } + } + + this.props.history.replace('/main') + } else { + notification.warning({ + top: 92, + message: '楠岃瘉鐮佹棤鏁堬紝璇烽噸鏂扮櫥褰曪紒', + duration: 5 + }) + } + }) + }, () => {}) + } + /** * @description 缁勪欢閿�姣侊紝娓呴櫎state鏇存柊 */ @@ -905,6 +974,20 @@ </Modal> {/* 淇敼瀵嗙爜 */} <Resetpwd /> + {/* 浜屾楠岃瘉 */} + <Modal + title="浜屾楠岃瘉" + okText={this.state.dict['login.ok']} + cancelText={this.state.dict['login.cancel']} + visible={this.state.codeVisible} + onOk={this.codeSubmit} + maskClosable={false} + confirmLoading={this.state.codeLoading} + onCancel={() => this.setState({codeVisible: false, codeLoading: false})} + destroyOnClose + > + <LoginCodeForm verify={this.state.verify} wrappedComponentRef={(inst) => this.codeRef = inst} handleSubmit={this.codeSubmit}/> + </Modal> </div> ) } -- Gitblit v1.8.0