|
|
@ -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'
|
|
|
@ -18,12 +18,12 @@ const TechLoginView = () => {
|
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -94,33 +94,33 @@ const TechLoginView = () => {
|
|
|
|
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">密 码:</span>
|
|
|
|
<span className="bk-row-tip">密 码:</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>
|
|
|
@ -128,8 +128,8 @@ const TechLoginView = () => {
|
|
|
|
setLoginType("qrcode")
|
|
|
|
setLoginType("qrcode")
|
|
|
|
}}>移动终端</Button> */}
|
|
|
|
}}>移动终端</Button> */}
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div className='bk-weblogin' style={{display: loginType == "account" ? "flex" : "none"}}>
|
|
|
|
<div className='bk-weblogin' style={{ display: loginType == "account" ? "flex" : "none" }}>
|
|
|
|
<Form.Item style={{display: loginType == "account" ? "inherit" : "none"}}>
|
|
|
|
<Form.Item style={{ display: loginType == "account" ? "inherit" : "none" }}>
|
|
|
|
<Button loading={isLoading} className={styles.loginButton} size="large" block type="primary" htmlType="submit">
|
|
|
|
<Button loading={isLoading} className={styles.loginButton} size="large" block type="primary" htmlType="submit">
|
|
|
|
{' '}登 录{' '}
|
|
|
|
{' '}登 录{' '}
|
|
|
|
</Button>
|
|
|
|
</Button>
|
|
|
@ -148,7 +148,7 @@ const TechLoginView = () => {
|
|
|
|
}} 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>
|
|
|
|