Ver código fonte

Merge branch 'v2' of http://git.ycjcjy.com/yunzhi/crm_pc into v2

fangmingyue 1 ano atrás
pai
commit
9d4f96ca4d

+ 43
- 0
src/components/Page/LeftIcon.jsx Ver arquivo

@@ -0,0 +1,43 @@
1
+import React from "react";
2
+import { ArrowLeftOutlined, LeftCircleFilled } from "@ant-design/icons";
3
+import { Typography } from "antd";
4
+import { useLocation, useNavigate } from "react-router-dom";
5
+import useRoute from "@/routes/hooks/useRoute";
6
+
7
+const titleStyle = {
8
+  display: "flex",
9
+  alignItems: "center",
10
+  padding: "12px 0",
11
+};
12
+const IconStyle = {
13
+  fontSize: "20px",
14
+  color: "#333",
15
+  padding: "0 0.5em",
16
+  display: "inlineBlack",
17
+  cursor: "pointer",
18
+};
19
+
20
+export default (props) => {
21
+  const { children, back } = props;
22
+  const navigate = useNavigate();
23
+  const goBack = (e) => {
24
+ 
25
+    const router = useRoute();
26
+    console.log(router);
27
+    e.preventDefault();
28
+    e.stopPropagation();
29
+
30
+    navigate(-1);
31
+  };
32
+  return (
33
+    <Typography.Title
34
+      level={3}
35
+      style={{ fontWeight: 400, flex: "none", margin: "0" }}
36
+    >
37
+      <div style={titleStyle}>
38
+        {back ? <LeftCircleFilled onClick={goBack} style={IconStyle} /> : ""}
39
+        {children}
40
+      </div>
41
+    </Typography.Title>
42
+  );
43
+};

+ 6
- 24
src/components/Page/index.jsx Ver arquivo

@@ -1,43 +1,25 @@
1 1
 import React from "react";
2 2
 import { Typography } from "antd";
3 3
 import useRoute from "@/routes/hooks/useRoute";
4
-import { ArrowLeftOutlined, LeftCircleFilled } from "@ant-design/icons";
5
-import { useNavigate } from "react-router-dom";
4
+import LeftIcon from "./LeftIcon";
6 5
 
7 6
 const pageStyle = {
8 7
   // margin: "0 24px 24px 24px",
9 8
   margin: "24px",
10 9
   minHeight: "calc(100% - 24px)",
11 10
 };
12
-const { Title } = Typography;
13
-const titleStyle = {
14
-  display: "flex",
15
-  alignItems: "flex-end",
16
-  padding: "12px 0",
17
-};
18
-const IconStyle = {
19
-  fontSize: "20px",
20
-  color: "#333",
21
-  padding: "0 0.5em",
22
-  display: "inlineBlack",
23
-  cursor: "pointer",
24
-};
11
+
12
+
25 13
 export default (props) => {
26 14
   const { meta = {} } = useRoute() || {};
27 15
   const style = meta.noLayout ? { height: "100%" } : pageStyle;
16
+
28 17
   const title = props.title || meta.title;
29
-  const navigator = useNavigate();
18
+
30 19
   return (
31 20
     <div style={style}>
32 21
       {title && !meta.noLayout && (
33
-        // <div style={titleStyle}>
34
-        //   <div>
35
-        //     <LeftCircleFilled onClick={()=>navigator(-1)} style={IconStyle} />
36
-        //   </div>
37
-        /* </div> */
38
-        <Title level={3} style={{ fontWeight: 400, flex: "none", margin: "0" }}>
39
-          {title}
40
-        </Title>
22
+        <LeftIcon back={props?.back}> {title}</LeftIcon>
41 23
       )}
42 24
       {props.children}
43 25
     </div>

+ 3
- 1
src/layouts/AuthLayout/components/Header/Exit.jsx Ver arquivo

@@ -18,7 +18,9 @@ export default (props) => {
18 18
         logout(); // 调用接口
19 19
         localStorage.removeItem("token");
20 20
         // setUser();
21
-        navigate("/login");
21
+        const tenantId = localStorage.getItem("tenantId");
22
+
23
+        navigate(`/login?id=${tenantId}`);
22 24
       },
23 25
     });
24 26
   };

+ 14
- 15
src/pages/custom/Edit.jsx Ver arquivo

@@ -1,5 +1,5 @@
1
-import React, { useRef, useState } from 'react'
2
-import { Button, Card, Form, Input, Select, Row, Col, Radio } from 'antd'
1
+import React, { useRef, useState } from "react";
2
+import { Button, Card, Form, Input, Select, Row, Col, Radio } from "antd";
3 3
 import {
4 4
   ProForm,
5 5
   ProFormDateTimeRangePicker,
@@ -10,7 +10,7 @@ import {
10 10
 } from "@ant-design/pro-components";
11 11
 import useBool from "@/utils/hooks/useBool";
12 12
 import { useSearchParams, useNavigate } from "react-router-dom";
13
-import Page from "@/components/Page";
13
+import Page from "@/components/Page/index";
14 14
 import { formItemLayout, tailFormItemLayout } from "@/utils/form";
15 15
 import { postTaCustom, putTaCustom, getTaCustomId } from "@/services/taCustom";
16 16
 const { Option } = Select;
@@ -19,9 +19,9 @@ export default (props) => {
19 19
   const formRef = useRef();
20 20
   const [submiting, startSubmit, cancelSubmit] = useBool();
21 21
 
22
-  const [searchParams] = useSearchParams()
23
-  const navigate = useNavigate()
24
-  const [isOrg, setIsOrg] = useState(0)
22
+  const [searchParams] = useSearchParams();
23
+  const navigate = useNavigate();
24
+  const [isOrg, setIsOrg] = useState(0);
25 25
 
26 26
   const id = searchParams.get("id");
27 27
 
@@ -32,20 +32,20 @@ export default (props) => {
32 32
         setIsOrg(res?.isOrg);
33 33
       });
34 34
     }
35
-  }, [])
35
+  }, []);
36 36
   const onChange = (e) => {
37
-    setIsOrg(e.target.value)
38
-  }
37
+    setIsOrg(e.target.value);
38
+  };
39 39
 
40 40
   const onFinish = (values) => {
41
-    startSubmit()
42
-    let dutyParagraph = values?.isOrg
41
+    startSubmit();
42
+    let dutyParagraph = values?.isOrg;
43 43
     if (isOrg == 0) {
44
-      dutyParagraph = null
44
+      dutyParagraph = null;
45 45
     }
46 46
     if (id) {
47 47
       //修改
48
-      const customId = id
48
+      const customId = id;
49 49
       putTaCustom(id, { customId, dutyParagraph, isOrg, ...values })
50 50
         .then((res) => {
51 51
           cancelSubmit();
@@ -66,9 +66,8 @@ export default (props) => {
66 66
         });
67 67
     }
68 68
   };
69
-
70 69
   return (
71
-    <Page>
70
+    <Page back>
72 71
       <Card>
73 72
         <ProForm
74 73
           formRef={formRef}

+ 8
- 9
src/pages/login/LoginForm.jsx Ver arquivo

@@ -11,16 +11,15 @@ export default (props) => {
11 11
   const [loading, setLoading] = React.useState(false);
12 12
   const { user, getCurrentUser } = useModel("user");
13 13
 
14
-  var path = window.location.pathname;
15
-  var tenantId = path.split('/')[1];
16
-
17
-  // useEffect(() => {
18
-  //   pathTenantId();
19
-  // }, [pathTenantId()]);
14
+  // var path = window.location.pathname;
15
+  // var tenantIds = path.split("/")[1];
20 16
 
17
+  useEffect(() => {
18
+    pathTenantId();
19
+  }, [pathTenantId()]);
20
+  
21 21
   const onFinish = (values) => {
22
-    // const tenantId = localStorage.getItem("tenantId");
23
-
22
+    const tenantId = localStorage.getItem("tenantId");
24 23
     const data = {
25 24
       loginType: "admin.pc",
26 25
       loginName: values.loginName,
@@ -46,7 +45,7 @@ export default (props) => {
46 45
       form={form}
47 46
       layout="vertical"
48 47
       onFinish={onFinish}
49
-    // style={{ width: "260px", marginTop: "24px", paddingBottom: "24px" }}
48
+      // style={{ width: "260px", marginTop: "24px", paddingBottom: "24px" }}
50 49
     >
51 50
       <Form.Item
52 51
         label="用户名"

+ 8
- 5
src/pages/member/Edit.jsx Ver arquivo

@@ -6,6 +6,7 @@ import Page from "@/components/Page";
6 6
 import MemberInfo from "./components/MemberInfo";
7 7
 import MemberCardInfo from "./components/MemberCardInfo";
8 8
 import "./index.less";
9
+// import Pages from "./components/Pages";
9 10
 export default (props) => {
10 11
   const [params] = useSearchParams();
11 12
   const [activeTabKey, setActiveTabKey] = useState("tab1");
@@ -13,11 +14,11 @@ export default (props) => {
13 14
   const id = params.get("id");
14 15
 
15 16
   useEffect(() => {
16
-  if(id){
17
-    getTaMemberId(id).then((res) => {
17
+    if (id) {
18
+      getTaMemberId(id).then((res) => {
18 19
         setMemberList(res || {});
19 20
       });
20
-  }
21
+    }
21 22
   }, []);
22 23
 
23 24
   const tabList = [
@@ -34,10 +35,12 @@ export default (props) => {
34 35
     // 会员基本信息
35 36
     tab1: <MemberInfo key="1" memberList={memberList} />,
36 37
     // 会员卡信息
37
-    tab2: <MemberCardInfo key="2" taMemberCardList={memberList?.taMemberCardList} />,
38
+    tab2: (
39
+      <MemberCardInfo key="2" taMemberCardList={memberList?.taMemberCardList} />
40
+    ),
38 41
   };
39 42
   return (
40
-    <Page>
43
+    <Page back>
41 44
       <Card
42 45
         className="scorll"
43 46
         style={{ width: "100%", overflowY: "scroll", maxHeight: "700px" }}

+ 1
- 1
src/pages/project/Edit.jsx Ver arquivo

@@ -35,7 +35,7 @@ export default (props) => {
35 35
   }
36 36
 
37 37
   return (
38
-    <Page>
38
+    <Page back>
39 39
       <Card
40 40
         style={{ backgroundColor: '#F0F2F5' }}
41 41
         tabList={tabList}

+ 1
- 1
src/routes/routes.jsx Ver arquivo

@@ -138,7 +138,7 @@ export const authRoutes = [
138 138
         path: 'member/edit',
139 139
         element: <MemberEdit />,
140 140
         meta: {
141
-          title: '会员管理',
141
+          title: '会员详情',
142 142
           hideInMenu: true,
143 143
         },
144 144
       }