Browse Source

fix:增加登录页面

zhaojing 1 year ago
parent
commit
66bd332542

+ 9 - 0
config/proxy.ts

@@ -34,6 +34,15 @@ export default {
         '^/sgadmin/duoduo-service': '/duoduo-service',
       },
     },
+    '/xiaojing': {
+      target: 'http://192.168.4.29:52015/',
+      //   target: 'http://10.100.28.79',
+      changeOrigin: true,
+      pathRewrite: {
+        // '^/sgadmin': '/sgadmin',
+        '^/xiaojing': '',
+      },
+    },
   },
 
   test: {

+ 3 - 16
config/routes.ts

@@ -1,22 +1,9 @@
 export default [
   {
-    path: '/user',
+    path: '/login',
+    name: 'login',
+    component: './Login',
     layout: false,
-    routes: [
-      //   {
-      //     path: '/user',
-      //     routes: [
-      //       {
-      //         name: 'login',
-      //         path: '/user/login',
-      //         component: './user/Login',
-      //       },
-      //     ],
-      //   },
-      //   {
-      //     component: './404',
-      //   },
-    ],
   },
   {
     path: '/',

File diff suppressed because it is too large
+ 17 - 0
src/assets/images/loginLogo.svg


+ 0 - 172
src/pages/Login/index copy.tsx

@@ -1,172 +0,0 @@
-import React, { useState, useEffect, useRef } from 'react';
-import { Button, Form, Input } from 'antd';
-import { history, useModel } from 'umi';
-import { login } from '@/services/sagacare_service/equipment';
-import { getUsersInfo } from '@/services/sagacare_service/environment';
-import './index.less';
-import UserStorage from '@/config/sagacare/sagacare_user';
-import QRCode from 'qrcodejs2';
-
-const Login: React.FC = () => {
-  const { refresh } = useModel('@@initialState');
-
-  const onFinish = (values: any) => {
-    console.log('Success:', values);
-    onSubmit(values);
-  };
-  const onFinishFailed = (errorInfo) => {
-    console.log('Failed:', errorInfo);
-  };
-  //输入用户名 密码的登录
-  const onSubmit = (values: any) => {
-    let params: any = values;
-    login(params)
-      .then((loginres) => {
-        let resData: any = loginres || {};
-        if (resData.result === 'success') {
-          localStorage.setItem('token', resData.token);
-          history.push('/equipment'); //登录成功跳转页面
-          refresh(); //这个方法会调用 getInitialState方法,getInitialState方法获取用户信息
-          // getUsersInfo()
-          //   .then((userres) => {
-          //     if (userres.result === 'success') {
-          //       var roles = userres.roles || [];
-          //       if (
-          //         roles.find((item: any) => {
-          //           return item.name == '上格云行政端';
-          //         })
-          //       ) {
-          //         let currentUser = {};
-          //         currentUser = {
-          //           name: userres.username,
-          //           phone: '',
-          //           id: userres.userId,
-          //         };
-          //         var userObj = UserStorage.getInstance();
-          //         userObj.setUser(currentUser);
-          //         //只有当用户名 密码正确,并且有权限时才跳转
-          //         history.push('/equipment');
-          //       } else {
-          //         localStorage.removeItem('token');
-          //       }
-          //     } else {
-          //       localStorage.removeItem('token');
-          //     }
-          //   })
-          //   .catch(() => {
-          //     localStorage.removeItem('token');
-          //   });
-        } else {
-          localStorage.removeItem('token');
-        }
-      })
-      .catch(() => {});
-  };
-
-  const codeCanvasRef = useRef();
-  const codeObjRef = useRef();
-  useEffect(() => {
-    //debugger;
-    console.log('codeCanvasRef.current', codeCanvasRef.current);
-    codeObjRef.current = new QRCode(codeCanvasRef.current, {
-      text: `texLoginCode34b79a15d56bca1739f82f708e88a937`,
-      width: 126,
-      height: 126,
-    });
-  }, []);
-
-  return (
-    <div className="homeContent">
-      <div className="home-left">
-        <div className="box">
-          <img alt="" src={require('@/assets/images/sagalogo.svg')} />
-          <div className="logo-text">SagaCare</div>
-        </div>
-      </div>
-      <div className="home-right">
-        <div className="box" style={{ display: 'none' }}>
-          <Form
-            name="basic"
-            labelCol={{
-              span: 8,
-            }}
-            wrapperCol={{
-              span: 64,
-            }}
-            style={{
-              maxWidth: 600,
-            }}
-            initialValues={{
-              remember: true,
-              username: '',
-              password: '',
-            }}
-            onFinish={onFinish}
-            onFinishFailed={onFinishFailed}
-            autoComplete="off"
-          >
-            <Form.Item
-              label="用户名"
-              name="username"
-              rules={[
-                {
-                  required: true,
-                  message: 'Please input your username!',
-                },
-              ]}
-            >
-              <Input />
-            </Form.Item>
-            <Form.Item
-              label="密码"
-              name="password"
-              rules={[
-                {
-                  required: true,
-                  message: 'Please input your password!',
-                },
-              ]}
-            >
-              <Input.Password />
-            </Form.Item>
-            <Form.Item
-              wrapperCol={{
-                offset: 8,
-                span: 16,
-              }}
-            >
-              <Button type="primary" htmlType="submit" className="loginButton">
-                提交
-              </Button>
-            </Form.Item>
-          </Form>
-
-          {/* <van-form @submit="onSubmit" class="box-form">
-        <van-cell-group inset>
-          <van-field
-            v-model="username"
-            name="username"
-            placeholder="用户名"
-            :rules="[{ required: true, message: '请填写用户名' }]"
-          />
-          <van-field
-            v-model="password"
-            type="password"
-            name="password"
-            placeholder="密码"
-            :rules="[{ required: true, message: '请填写密码' }]"
-          />
-        </van-cell-group>
-        <div>
-          <van-button round block native-type="submit"> 提交 </van-button>
-        </div>
-      </van-form> */}
-        </div>
-        <div className="box">
-          <div ref={codeCanvasRef} title="" className="dddd"></div>
-        </div>
-      </div>
-    </div>
-  );
-};
-export default Login;

+ 25 - 0
src/pages/Login/index.less

@@ -0,0 +1,25 @@
+.loginWrap {
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  width: 100%;
+  height: 100%;
+  background: blue;
+  border-radius: 24px;
+  .loginBox {
+    width: 360px;
+    height: 480px;
+    background: #fff;
+    .image {
+      margin-top: 50px;
+      margin-bottom: 30px;
+      text-align: center;
+    }
+    .info {
+      color: #1b2129;
+      font-size: 16px;
+      line-height: 24px;
+      text-align: center;
+    }
+  }
+}

+ 20 - 0
src/pages/Login/index.tsx

@@ -0,0 +1,20 @@
+import React, { useState, useEffect, useCallback, useRef } from 'react';
+import { FormattedMessage, history, useModel } from 'umi';
+import { Spin, Popover } from 'antd';
+import styles from './index.less';
+import cx from 'classnames';
+
+export default () => {
+  const loginLogo = require('@/assets/images/loginLogo.svg');
+  return (
+    <div className={styles.loginWrap}>
+      <div className={styles.loginBox}>
+        <div className={styles.image}>
+          <img src={loginLogo} style={{ height: 110 }}></img>
+        </div>
+        <div className={styles.qrcode}></div>
+        <div className={styles.info}>请使用小程序扫码登录</div>
+      </div>
+    </div>
+  );
+};

+ 4 - 4
src/pages/Member/components/personModal/index.jsx

@@ -48,7 +48,7 @@ const PersonModal = ({
       var paramObj = {
         criteria: {
           userId: checkUser.userId,
-          companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+          companyId: 'ff80c708fe72446eb790b764c3a7b66b',
         },
       };
       queryUserInfo(paramObj)
@@ -77,7 +77,7 @@ const PersonModal = ({
   };
 
   const saveUser = () => {
-    debugger;
+    //debugger;
     form
       .validateFields()
       .then((value) => {
@@ -85,7 +85,7 @@ const PersonModal = ({
         var slist = checkedValues.map((item) => {
           if (item != 'special') {
             return {
-              companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+              companyId: 'ff80c708fe72446eb790b764c3a7b66b',
               spaceId: item,
               isPermanentSpace: radioValue == item ? true : false,
             };
@@ -93,7 +93,7 @@ const PersonModal = ({
         });
 
         var param = {
-          companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+          companyId: 'ff80c708fe72446eb790b764c3a7b66b',
           controlSpaceUserList: slist,
           ...value,
         };

+ 9 - 10
src/pages/Member/index.tsx

@@ -173,7 +173,7 @@ const Member: React.FC = () => {
       criteria: {
         param: searchStr,
         status: 1,
-        companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+        companyId: 'ff80c708fe72446eb790b764c3a7b66b',
       },
       page: page.pageNum,
       size: page.pageSize,
@@ -204,7 +204,7 @@ const Member: React.FC = () => {
     //   '北京中海金融街|2层': [
     //     {
     //       id: '22',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b711',
     //       spaceName: 'D-303',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a11',
@@ -217,7 +217,7 @@ const Member: React.FC = () => {
     //     },
     //     {
     //       id: '33',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b722',
     //       spaceName: 'D-304',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a22',
@@ -230,7 +230,7 @@ const Member: React.FC = () => {
     //     },
     //     {
     //       id: '55',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b733',
     //       spaceName: 'D-306',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a',
@@ -245,7 +245,7 @@ const Member: React.FC = () => {
     //   '北京中海金融街|3层': [
     //     {
     //       id: '22',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b744',
     //       spaceName: 'C-303',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a',
@@ -258,7 +258,7 @@ const Member: React.FC = () => {
     //     },
     //     {
     //       id: '33',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b755',
     //       spaceName: 'C-304',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a',
@@ -271,7 +271,7 @@ const Member: React.FC = () => {
     //     },
     //     {
     //       id: '55',
-    //       companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+    //       companyId: 'ff80c708fe72446eb790b764c3a7b66b',
     //       spaceId: 'Sp110102000292ab218dd67011e88bee87db7e0ad2b766',
     //       spaceName: 'C-306',
     //       floorId: 'Fl1101020002bf10b9cad5c811e88bee1113190f5c6a',
@@ -288,8 +288,7 @@ const Member: React.FC = () => {
     //查询受控列表
     var paramObj = {
       criteria: {
-        //spaceName: '',
-        companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96',
+        companyId: 'ff80c708fe72446eb790b764c3a7b66b',
       },
     };
     queryControlSpaceCompany(paramObj)
@@ -298,7 +297,7 @@ const Member: React.FC = () => {
         setSpaceMap(data);
       })
       .catch((err) => {});
-    queryCompanyOAById({ companyId: '30bd3cf2b9ed4742b607fd5ea2c00d96' })
+    queryCompanyOAById({ companyId: 'ff80c708fe72446eb790b764c3a7b66b' })
       .then((res) => {
         var isSyncOa = res?.isSyncOa;
         setIsSyncOa(isSyncOa == 1 ? true : false);

+ 4 - 4
src/sagacare_components/Search/index.tsx

@@ -49,10 +49,10 @@ const SearchInput: React.FC<SearchInputProps> = ({ setSearchStr }) => {
       debugger;
       setSearchStr(value);
     }
-    if (value) {
-      //防抖
-      ref.current = setTimeout(fake2, 600);
-    } else {
+    //防抖
+    ref.current = setTimeout(fake2, 600);
+
+    if (!value) {
       setMatchData([]);
     }
   };