修改登录日志

master
wuzuowei 2 months ago
parent 44a51b1f6f
commit 65ca323f1d

@ -37,6 +37,7 @@ export class SystemData extends RemoteRequest {
})
}
public setlog = async (obj: any) => {
// console.log("日志参数11111111111111", obj);
return request.post('/Personnel/Personnelapi/LogRecording', obj)
}

@ -164,7 +164,9 @@ export default class RuntimeUser {
OperateUser: loginId || "未登录",
Operate: `${loginId}登陆了工艺数据管理子系统`
}
await this.model.setlog(obj)
this.model.setlog(obj)
// console.log("日志参数", obj, loginId,);
return true
}
}

@ -5,7 +5,7 @@ import { useState, useLayoutEffect, useRef, useEffect } from 'react'
import styles from './index.less'
import { SystemData } from '@/microhost/models/system'
import Api from '@/config/Api'
import {defaultSetting as cfg} from "@/config/default"
import { defaultSetting as cfg } from "@/config/default"
import MicroApps from '@/microhost/system/apps'
import "./styles.less"
import { DesktopOutlined, KeyOutlined, MobileOutlined, UserOutlined } from '@ant-design/icons'
@ -13,17 +13,17 @@ import utils from "@/microhost/common"
import { isString } from 'lodash'
const TechLoginView = () => {
const [isLoading, setIsLoading] = useState<boolean>(false)
const [isLoading, setIsLoading] = useState<boolean>(false)
const [loginType, setLoginType] = useState<"account" | "qrcode">("account")
const cookieLoginKey = "_defs_ln"
const [thisForm] = Form.useForm()
const defln = utils.loadCookie(cookieLoginKey)
const [cookieLoginName, setCookieLoginName] = useState<string|undefined>(!!defln && defln != "null" ? defln : undefined)
const [cookieLoginName, setCookieLoginName] = useState<string | undefined>(!!defln && defln != "null" ? defln : undefined)
const isRemembered = useRef<boolean>(!!defln && defln != "null")
useEffect(() => {
let def = !!defln && defln != "null" ? defln : undefined
if(def){
if (def) {
thisForm.setFieldsValue({
loginId: def
})
@ -41,35 +41,35 @@ const TechLoginView = () => {
return;
}
if(isRemembered.current){
if (isRemembered.current) {
let month = new Date().getTime() + 1000 * 24 * 3600 * 30 * 3
utils.saveCookie(cookieLoginKey, loginId, month)
}
let result = await MicroApps.GetRuntimeUser().doLogin(loginId, password)
if(isString(result)){
if (isString(result)) {
message.error(result)
return
}
let redirect: any = history.location.query?.redirect
let jumpTo: string | undefined = undefined
if(redirect){
if (redirect) {
let rd = decodeURIComponent(redirect)
jumpTo = isUrl(rd) ? rd : undefined
}
if(jumpTo){
if (jumpTo) {
}
else{
else {
let routes = await MicroApps.BuildRouteTree(loginId)
if(!routes || routes.length == 0){
if (!routes || routes.length == 0) {
history.push("/noauth")
return
}
else{
else {
jumpTo = "/" //routes[0].defaultPath && routes[0].defaultPath.length > 0 ? routes[0].defaultPath : "/welcome"
}
}
@ -77,97 +77,97 @@ const TechLoginView = () => {
history.push(`/animate?url=${encodeURIComponent(jumpTo)}`)
}
const isUrl = (addr: any) => {
const isUrl = (addr: any) => {
var v = new RegExp(
'^((http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
'i',
'^((http|https|ftp)://|//)(?:\\S+(?::\\S*)?@)?(?:(?:(?:[1-9]\\d?|1\\d\\d|2[01]\\d|22[0-3])(?:\\.(?:1?\\d{1,2}|2[0-4]\\d|25[0-5])){2}(?:\\.(?:[0-9]\\d?|1\\d\\d|2[0-4]\\d|25[0-4]))|(?:(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)(?:\\.(?:[a-z\\u00a1-\\uffff0-9]+-?)*[a-z\\u00a1-\\uffff0-9]+)*(?:\\.(?:[a-z\\u00a1-\\uffff]{2,})))|localhost)(?::\\d{2,5})?(?:(/|\\?|#)[^\\s]*)?$',
'i',
);
let uri: string = addr;
uri = !uri || uri.length == 0 ? '' : uri[0] == '/' ? uri.substring(1) : uri;
return v.test(uri);
}
return (
<>
<div className={"bk-tech-login"}>
<Form form={thisForm} className={styles.loginPanel} onFinish={(values) => {
doLogin(values)
}}>
<img style={{ width: '80%', marginTop: '40px', marginBottom: '40px', filter: "brightness(8)" }} className="UnitParseAnyway" src={Api.statics.login.topic} />
<div className='bk-login-qrcode' style={{display: loginType == "qrcode" ? "block" : "none"}}>
<img className="UnitParseAnyway" height={148} style={{marginTop: "36px"}} src="/statics/home/qrcode-wap.png" />
</div>
<div className={"bk-login-row"} style={{display: loginType == "account" ? "flex" : "none"}}>
<UserOutlined style={{marginLeft: "8px"}} />
<span className="bk-row-tip"></span>
<Form.Item name="loginId" style={{marginBottom: 0}}>
<input autoFocus={true} className={styles.input} defaultValue={cookieLoginName ? cookieLoginName : ""} placeholder="" autoComplete='off' />
</Form.Item>
</div>
<div className={"bk-login-row"} style={{display: loginType == "account" ? "flex" : "none"}}>
<KeyOutlined style={{marginLeft: "8px"}} />
<span className="bk-row-tip">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<Form.Item name="password" style={{marginBottom: 0}}>
<input type="password" className={styles.input} placeholder="" />
</Form.Item>
</div>
<div className={"bk-login-row"} style={{display: loginType == "account" ? "flex" : "none", border: 0, background: "transparent", justifyContent: "flex-end"}}>
<Checkbox defaultChecked={!!cookieLoginName} style={{color: "#fff"}} onChange={(event) => {
let checked = event.target.checked
isRemembered.current = checked
if(checked){
let vals = thisForm.getFieldsValue()
let month = new Date().getTime() + 1000 * 24 * 3600 * 30 * 3
utils.saveCookie(cookieLoginKey, vals.loginId ? vals.loginId : "", month)
}
else{
utils.removeCookie(cookieLoginKey)
}
}}></Checkbox>
{/* <Button type='link' className='bk-login-switch' icon={<MobileOutlined />} onClick={() => {
return (
<>
<div className={"bk-tech-login"}>
<Form form={thisForm} className={styles.loginPanel} onFinish={(values) => {
doLogin(values)
}}>
<img style={{ width: '80%', marginTop: '40px', marginBottom: '40px', filter: "brightness(8)" }} className="UnitParseAnyway" src={Api.statics.login.topic} />
<div className='bk-login-qrcode' style={{ display: loginType == "qrcode" ? "block" : "none" }}>
<img className="UnitParseAnyway" height={148} style={{ marginTop: "36px" }} src="/statics/home/qrcode-wap.png" />
</div>
<div className={"bk-login-row"} style={{ display: loginType == "account" ? "flex" : "none" }}>
<UserOutlined style={{ marginLeft: "8px" }} />
<span className="bk-row-tip"></span>
<Form.Item name="loginId" style={{ marginBottom: 0 }}>
<input autoFocus={true} className={styles.input} defaultValue={cookieLoginName ? cookieLoginName : ""} placeholder="" autoComplete='off' />
</Form.Item>
</div>
<div className={"bk-login-row"} style={{ display: loginType == "account" ? "flex" : "none" }}>
<KeyOutlined style={{ marginLeft: "8px" }} />
<span className="bk-row-tip">&nbsp;&nbsp;&nbsp;&nbsp;</span>
<Form.Item name="password" style={{ marginBottom: 0 }}>
<input type="password" className={styles.input} placeholder="" />
</Form.Item>
</div>
<div className={"bk-login-row"} style={{ display: loginType == "account" ? "flex" : "none", border: 0, background: "transparent", justifyContent: "flex-end" }}>
<Checkbox defaultChecked={!!cookieLoginName} style={{ color: "#fff" }} onChange={(event) => {
let checked = event.target.checked
isRemembered.current = checked
if (checked) {
let vals = thisForm.getFieldsValue()
let month = new Date().getTime() + 1000 * 24 * 3600 * 30 * 3
utils.saveCookie(cookieLoginKey, vals.loginId ? vals.loginId : "", month)
}
else {
utils.removeCookie(cookieLoginKey)
}
}}></Checkbox>
{/* <Button type='link' className='bk-login-switch' icon={<MobileOutlined />} onClick={() => {
setLoginType("qrcode")
}}></Button> */}
</div>
<div className='bk-weblogin' style={{display: loginType == "account" ? "flex" : "none"}}>
<Form.Item style={{display: loginType == "account" ? "inherit" : "none"}}>
<Button loading={isLoading} className={styles.loginButton} size="large" block type="primary" htmlType="submit">
{' '}&nbsp;&nbsp;{' '}
</Button>
</Form.Item>
<div className='login-type-nid'>
<div className='nid-line'></div>
<div className='nid-bat'>使</div>
<div className='nid-line'></div>
</div>
<div className='login-method-other'>
<a href="ustbiet.qms:202102041703:iBKLinker:yinshi:12345:TPQC">
<div className='login-method method-exe hover-effective' title='打开客户端程序'></div>
</a>
{/* <div className='login-method method-mobile hover-effective' onClick={() => {
<div className='bk-weblogin' style={{ display: loginType == "account" ? "flex" : "none" }}>
<Form.Item style={{ display: loginType == "account" ? "inherit" : "none" }}>
<Button loading={isLoading} className={styles.loginButton} size="large" block type="primary" htmlType="submit">
{' '}&nbsp;&nbsp;{' '}
</Button>
</Form.Item>
<div className='login-type-nid'>
<div className='nid-line'></div>
<div className='nid-bat'>使</div>
<div className='nid-line'></div>
</div>
<div className='login-method-other'>
<a href="ustbiet.qms:202102041703:iBKLinker:yinshi:12345:TPQC">
<div className='login-method method-exe hover-effective' title='打开客户端程序'></div>
</a>
{/* <div className='login-method method-mobile hover-effective' onClick={() => {
setLoginType("qrcode")
}} title='手机端'></div> */}
</div>
</div>
</div>
<div className='bk-weblogin' style={{display: loginType == "qrcode" ? "flex" : "none"}}>
<div className='login-type-nid'>
<div className='nid-line'></div>
<div className='nid-bat'>使</div>
<div className='nid-line'></div>
</div>
<div className='login-method-other'>
<a href="ustbiet.qms:202102041703:iBKLinker:yinshi:12345:TPQC">
<div className='login-method method-exe hover-effective' title='打开客户端程序'></div>
</a>
<div className='login-method method-desktop hover-effective' onClick={() => {
setLoginType("account")
}} title='网页端'></div>
<div className='bk-weblogin' style={{ display: loginType == "qrcode" ? "flex" : "none" }}>
<div className='login-type-nid'>
<div className='nid-line'></div>
<div className='nid-bat'>使</div>
<div className='nid-line'></div>
</div>
<div className='login-method-other'>
<a href="ustbiet.qms:202102041703:iBKLinker:yinshi:12345:TPQC">
<div className='login-method method-exe hover-effective' title='打开客户端程序'></div>
</a>
<div className='login-method method-desktop hover-effective' onClick={() => {
setLoginType("account")
}} title='网页端'></div>
</div>
</div>
</div>
<img className="UnitParseAnyway" style={{ width: '50%', marginTop: '32px' }} src={Api.statics.login.bkd} />
</Form>
</div>
</>
)
<img className="UnitParseAnyway" style={{ width: '50%', marginTop: '32px' }} src={Api.statics.login.bkd} />
</Form>
</div>
</>
)
}
export default TechLoginView
Loading…
Cancel
Save