修改登录日志

master
wuzuowei 2 months ago
parent 44a51b1f6f
commit 65ca323f1d

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

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

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

Loading…
Cancel
Save