|
@@ -1,7 +1,7 @@
|
|
|
/*
|
|
|
* @Author: your name
|
|
|
* @Date: 2021-11-09 14:58:08
|
|
|
- * @LastEditTime: 2022-02-14 14:29:52
|
|
|
+ * @LastEditTime: 2022-03-29 15:49:50
|
|
|
* @LastEditors: Please set LastEditors
|
|
|
* @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
|
|
|
* @FilePath: /KC-MiddlePlatform/src/pages/login/index.tsx
|
|
@@ -32,9 +32,8 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
const [transformObj, setTransformObj] = useState<string>();
|
|
|
const loginPageRef = useRef<HTMLDivElement>(null);
|
|
|
const [subHospList, setSubHospList] = useState<{ name: string; value: string | number }[]>([]); //分院列表
|
|
|
- const [ifSelectSystem, setIfSelectSystem] = useState(false); //是否跳转到选择系统界面
|
|
|
const [ifLoading, setIfLoading] = useState(false);
|
|
|
- const [systemList, setSystemList] = useState<userRelationInfo.OwnAppsItem[]>([]); //可选平台列表
|
|
|
+ // const [systemList, setSystemList] = useState<userRelationInfo.OwnAppsItem[]>([]); //可选平台列表
|
|
|
const [currentHospName, setCurrentHospName] = useState('欢迎进入医务管理系统');
|
|
|
const { initialState, setInitialState } = useModel('@@initialState');
|
|
|
|
|
@@ -100,25 +99,37 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
|
|
|
if (initialState && initialState.getHospSubSystemListFunc) {
|
|
|
const data = await initialState.getHospSubSystemListFunc();
|
|
|
+
|
|
|
+ console.log({ initialState });
|
|
|
+
|
|
|
await setInitialState((s) => ({
|
|
|
...s,
|
|
|
systemLists: data,
|
|
|
userData: resp,
|
|
|
}));
|
|
|
|
|
|
- setSystemList(data);
|
|
|
-
|
|
|
if (data.length > 1) {
|
|
|
//当前医院拥有多个子平台时,进入选择
|
|
|
- setIfSelectSystem(true);
|
|
|
history.replace('/index');
|
|
|
- } else {
|
|
|
- //否则直接进入首页
|
|
|
- const { query } = history.location;
|
|
|
- const { redirect } = query as { redirect: string };
|
|
|
- history.replace(redirect || '/index');
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
+ if (data.length == 1) {
|
|
|
+ //直接进入该应用
|
|
|
+ history.replace(data[0].path);
|
|
|
+ await setInitialState((s) => ({
|
|
|
+ ...s,
|
|
|
+ currentSelectedSys: data[0],
|
|
|
+ openedSysLists: [data[0]],
|
|
|
+ systemLists: data,
|
|
|
+ userData: resp,
|
|
|
+ }));
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (data.length == 0) {
|
|
|
+ history.replace('/login');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
setIfLoading(false);
|
|
@@ -128,13 +139,7 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
useEffect(() => {
|
|
|
//根据hospSign获取分院信息
|
|
|
location.pathname == '/login' && getSubHospFunc();
|
|
|
-
|
|
|
- // window.addEventListener('message',(e)=>{
|
|
|
- // console.log(e.origin)
|
|
|
- // if(e.origin == 'http://192.168.50.76:8902'){
|
|
|
- // console.log({e})
|
|
|
- // }
|
|
|
- // }, false);
|
|
|
+ setInitialState((s) => ({ ...s, currentSelectedSys: undefined, openedSysLists: [] }));
|
|
|
}, []);
|
|
|
|
|
|
// return (
|
|
@@ -144,21 +149,10 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
// )
|
|
|
|
|
|
return (
|
|
|
- <div
|
|
|
- className="loginPage"
|
|
|
- onMouseMove={onMouseMoveHandle}
|
|
|
- onMouseLeave={onMouseLeaveHandle}
|
|
|
- ref={loginPageRef}
|
|
|
- >
|
|
|
- <div
|
|
|
- className="circleBigOne"
|
|
|
- style={{ transform: transformObj, transition: transitionObj }}
|
|
|
- ></div>
|
|
|
+ <div className="loginPage" onMouseMove={onMouseMoveHandle} onMouseLeave={onMouseLeaveHandle} ref={loginPageRef}>
|
|
|
+ <div className="circleBigOne" style={{ transform: transformObj, transition: transitionObj }}></div>
|
|
|
<div className="circleBigerOne"></div>
|
|
|
- <div
|
|
|
- className="circleLittleOne"
|
|
|
- style={{ transform: transformObj, transition: transitionObj }}
|
|
|
- ></div>
|
|
|
+ <div className="circleLittleOne" style={{ transform: transformObj, transition: transitionObj }}></div>
|
|
|
{location.pathname == '/login' ? (
|
|
|
<div className="loginBlock">
|
|
|
<div className="left">
|
|
@@ -171,12 +165,7 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
allowClear={false}
|
|
|
style={{ width: 150 }}
|
|
|
defaultValue={subHospList[0].value}
|
|
|
- suffixIcon={
|
|
|
- <img
|
|
|
- style={{ width: '10px', height: '6px' }}
|
|
|
- src={require('../../../public/images/arrow.png')}
|
|
|
- />
|
|
|
- }
|
|
|
+ suffixIcon={<img style={{ width: '10px', height: '6px' }} src={require('../../../public/images/arrow.png')} />}
|
|
|
>
|
|
|
{subHospList.map((item) => {
|
|
|
return (
|
|
@@ -190,17 +179,11 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children }) => {
|
|
|
</div>
|
|
|
<div className="systemName">{currentHospName}</div>
|
|
|
<Form onFinish={onFinish}>
|
|
|
- <Form.Item
|
|
|
- name="account"
|
|
|
- rules={[{ required: true, message: 'Please input your username!' }]}
|
|
|
- >
|
|
|
+ <Form.Item name="account" rules={[{ required: true, message: 'Please input your username!' }]}>
|
|
|
<Input className="input" placeholder="请输入用户名" />
|
|
|
</Form.Item>
|
|
|
|
|
|
- <Form.Item
|
|
|
- name="password"
|
|
|
- rules={[{ required: true, message: 'Please input your password!' }]}
|
|
|
- >
|
|
|
+ <Form.Item name="password" rules={[{ required: true, message: 'Please input your password!' }]}>
|
|
|
<Input.Password className="input" placeholder="请输入密码" />
|
|
|
</Form.Item>
|
|
|
|