code4eat 2 lat temu
rodzic
commit
8b8378d9b4

+ 2 - 2
src/components/topBar/index.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-11-16 09:12:37
- * @LastEditTime: 2022-12-05 11:23:46
+ * @LastEditTime: 2022-12-08 10:22:42
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/index/components/topBar/index.tsx
@@ -228,7 +228,7 @@ const TopBar: React.FC<TopBarType> = (props) => {
   //   }
   // },[currentSelectedSys])
   
-
+  
   useEffect(() => {
 
     _systemTabClickHandle(currentSelectedTabFromLocal);  //恢复选中的tab

+ 106 - 57
src/pages/login/index.tsx

@@ -1,14 +1,14 @@
 /*
  * @Author: your name
  * @Date: 2021-11-09 14:58:08
- * @LastEditTime: 2022-11-17 09:28:57
+ * @LastEditTime: 2022-12-13 11:22:53
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/login/index.tsx
  */
 
-import React, { useRef, useEffect, useState, Children } from 'react';
-import { Select, message } from 'antd';
+import React, { useRef, useEffect, useState, Children, ReactEventHandler } from 'react';
+import { Select, message, Row, Col } from 'antd';
 import './style.less';
 
 import { useModel, history, Location, Helmet } from 'umi';
@@ -30,15 +30,17 @@ export interface LoginPageType {
 }
 
 const LoginPage: React.FC<LoginPageType> = ({ location, children, title }) => {
- 
+
   const loginPageRef = useRef<HTMLDivElement>(null);
   const [subHospList, setSubHospList] = useState<{ name: string; value: string | number }[]>([]); //分院列表
   const [ifLoading, setIfLoading] = useState(false);
   // const [systemList, setSystemList] = useState<userRelationInfo.OwnAppsItem[]>([]); //可选平台列表
   const [currentHospName, setCurrentHospName] = useState('欢迎进入医务管理系统');
   const { initialState, setInitialState } = useModel('@@initialState');
+  const [windowWidth, set_windowWidth] = useState(0);
+  const [ifShowLeftBlock, set_ifShowLeftBlock] = useState(true);
+
 
-  
 
   //获取当前账号分院列表
   const getSubHospFunc = async () => {
@@ -58,7 +60,7 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children, title }) => {
 
   const onFinish = async (values: LoginPageTypes.LoginInfo) => {
     setIfLoading(true);
-    const hospSign = history.location.query?.hospSign as string;
+    const hospSign = localStorage.getItem('hospSign');
     if (!hospSign) {
       notification.error({
         message: '网址标记缺失,请检查网址!',
@@ -72,27 +74,51 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children, title }) => {
       hospSign: hospSign,
       // remember:false,
     });
+
     setIfLoading(false);
     if (resp) {
       localStorage.setItem('userData', JSON.stringify(resp));
-      localStorage.setItem('hospSign', hospSign);
-      setInitialState((s) => ({ ...s,userData:resp }));
+      setInitialState((s) => ({ ...s, userData: resp }));
       history.replace('/index');
 
       setIfLoading(false);
     }
   };
 
+  const handleResize = (e: Event) => {
+    // console.log('innerWidth',(e.target as Window).innerWidth);
+    set_windowWidth((e.target as Window).innerWidth);
+
+  }
+
 
   useEffect(() => {
     setCurrentHospName(title);
   }, [title]);
 
+  useEffect(() => {
+    if (windowWidth <= 1000) {
+      set_ifShowLeftBlock(false);
+    } else {
+      set_ifShowLeftBlock(true);
+    }
+  }, [windowWidth]);
+
 
   useEffect(() => {
     //根据hospSign获取分院信息
     location.pathname == '/login' && getSubHospFunc();
     setInitialState((s) => ({ ...s, currentSelectedSys: undefined, openedSysLists: [] }));
+
+    window.addEventListener('resize', (e) => handleResize(e)); //监听窗口大小改变
+
+    const hospSign = history.location.query?.hospSign as string;
+    localStorage.setItem('hospSign', hospSign);
+
+    return ()=>{
+      window.removeEventListener('resize',handleResize);
+    }
+
   }, []);
 
 
@@ -103,57 +129,80 @@ const LoginPage: React.FC<LoginPageType> = ({ location, children, title }) => {
       </Helmet>
 
       {location.pathname == '/login' ? (
-        <>
-          <div className='left'>
-            <div className='topLogo'>
-              <img className='logo' src={logo} alt="康程智医" />
-              <div className='logoDesc'>助力医疗机构高质量发展</div>
-            </div>
-            <img className='loginbanner' src={require('../../../public/images/loginBannner.png')} alt="" />
-          </div>
-          <div className="rightLoginArea">
-            <div className="subHospSelector">
-              {subHospList.length > 0 && (
-                <KCSelect
-                  allowClear={false}
-                  style={{ width: 180}}
-                  defaultValue={subHospList[0].value}
-                  suffixIcon={<img style={{ width: '10px', height: '6px' }} src={require('../../../public/images/arrow.png')} />}
-                >
-                  {subHospList.map((item) => {
-                    return (
-                      <Option value={item.value} key={item.value}>
-                        {item.name}
-                      </Option>
-                    );
-                  })}
-                </KCSelect>
-              )}
-            </div>
-            <div className="systemName">{currentHospName}</div>
-            <Form onFinish={onFinish}>
-              <Form.Item name="account" rules={[{ required: true, message: '请输入用户名!' }]}>
-                <Input className="input" placeholder="请输入用户名" />
-              </Form.Item>
-
-              <Form.Item name="password" rules={[{ required: true, message: '请输入密码!' }]}>
-                <Input.Password className="input" placeholder="请输入密码" />
-              </Form.Item>
-
-              <Form.Item>
-                <Button className="loginBtn" type="primary" htmlType="submit" loading={ifLoading}>
-                  登录
-                </Button>
-              </Form.Item>
-              {/* <Form.Item name="remember" valuePropName="checked">
+        <Row style={{ height: '100%' }}>
+          {
+            ifShowLeftBlock && (
+              <Col flex="500px">
+                <div className='left'>
+                  <div className='topLogo'>
+                    <img className='logo' src={logo} alt="康程智医" />
+                    <div className='logoDesc'>助力医疗机构高质量发展</div>
+                  </div>
+                  <img className='loginbanner' src={require('../../../public/images/loginBannner.png')} alt="" />
+                </div>
+              </Col>
+            )
+          }
+          <Col flex="auto">
+            <div className="rightLoginArea">
+              {
+                !ifShowLeftBlock && (
+                  <div className='topLogo'>
+                    <img className='logo' src={logo} alt="康程智医" />
+                    <div className='logoDesc'>助力医疗机构高质量发展</div>
+                  </div>
+                )
+              }
+
+              <div className="subHospSelector">
+                {subHospList.length > 0 && (
+                  <KCSelect
+                    allowClear={false}
+                    style={{ width: 180 }}
+                    defaultValue={subHospList[0].value}
+                    onSelect={(val:any)=>{
+                      localStorage.removeItem('hospSign');
+                      localStorage.setItem('hospSign', val);
+                    }}
+                    suffixIcon={<img style={{ width: '10px', height: '6px' }} src={require('../../../public/images/arrow.png')} />}
+                  >
+                    {subHospList.map((item) => {
+                      return (
+                        <Option value={item.value} key={item.value}>
+                          {item.name}
+                        </Option>
+                      );
+                    })}
+                  </KCSelect>
+                )}
+              </div>
+              <div className="systemName">{currentHospName}</div>
+              <Form onFinish={onFinish}>
+
+                <Form.Item name="account" rules={[{ required: true, message: '请输入用户名!' }]}>
+                  <Input className="input" placeholder="请输入用户名" />
+                </Form.Item>
+
+                <Form.Item name="password" rules={[{ required: true, message: '请输入密码!' }]}>
+                  <Input.Password className="input" placeholder="请输入密码" />
+                </Form.Item>
+
+                <Form.Item>
+                  <Button className="loginBtn" type="primary" htmlType="submit" loading={ifLoading}>
+                    登录
+                  </Button>
+                </Form.Item>
+
+                {/* <Form.Item name="remember" valuePropName="checked">
                     <Checkbox className="checkBtn">记住密码</Checkbox>
                   </Form.Item> */}
-            </Form>
-            <div className='bottomCopyright'>© 2022 康程智医(成都)技术部出品</div>
-            <div className='versionInfo'>精益管理决策平台 V1.0</div>
-          </div>
-        </>
-        
+              </Form>
+              <div className='bottomCopyright'>© 2022 康程智医(成都)技术部出品</div>
+              <div className='versionInfo'>精益管理决策平台 V1.0</div>
+            </div>
+          </Col>
+        </Row>
+
       ) : (
         children
       )}

+ 27 - 4
src/pages/login/style.less

@@ -1,6 +1,6 @@
 .loginPage {
-  display: flex;
-  flex-direction: row;
+  // display: flex;
+  // flex-direction: row;
   position: relative;
   width: 100%;
   height: 100vh;
@@ -10,7 +10,7 @@
     display: flex;
     justify-content: center;
     align-items: center;
-    width: 40%;
+    width: 100%;
     height: 100%;
     position: relative;
     background: #F7FAFC;
@@ -43,12 +43,35 @@
   .rightLoginArea {
     position: relative;
     display: flex;
-    width: 60%;
+    width: 100%;
     height: 100%;
     flex-direction: column;
     justify-content: center;
     align-items: center;
 
+    .topLogo {
+      position: absolute;
+      top:40px;
+      left:40px;
+      display: flex;
+      flex-direction: row;
+      align-items: center;
+      .logo {
+        width: 160px;
+        height: 32px;
+      }
+      .logoDesc {
+        height: 16px;
+        font-size: 12px;
+        line-height: 16px;
+        font-family: SourceHanSansCN-Normal, SourceHanSansCN;
+        color: #7A8599;
+        margin-left: 16px;
+        padding-left: 16px;
+        border-left: 1px solid #CFD6E6;
+      }
+  }
+
     .subHospSelector {
       margin-bottom: 24px;
       .kcmp-ant-select .kcmp-ant-select-selector {

+ 3 - 3
src/pages/platform/_layout.tsx

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2022-01-06 15:25:39
- * @LastEditTime: 2022-09-07 14:32:26
+ * @LastEditTime: 2022-12-12 15:40:54
  * @LastEditors: code4eat awesomedema@gmail.com
  * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
  * @FilePath: /KC-MiddlePlatform/src/pages/platform/_layout.tsx
@@ -124,7 +124,6 @@ export default function Layout({ children, location, route, history, match, ...r
                         path: t['path'],
                         reportId: t['reportId'],
                         url: t['youshuUrl'],
-
                       });
                     }
                     if (t.children && t.children.length > 0) {
@@ -154,7 +153,8 @@ export default function Layout({ children, location, route, history, match, ...r
                     const childs = menuData[0].children;        
                     set_openKeys([menuData[0].key]);
                     set_selectedKeys([childs[0].key]);
-                    history.push(`${childs[0].path}`)
+                    history.push(`${childs[0].path}`);
+                    
                   }
                 }