chao 9 kuukautta sitten
vanhempi
commit
ffbd11eeab
3 muutettua tiedostoa jossa 85 lisäystä ja 8 poistoa
  1. 56 0
      package-lock.json
  2. 1 0
      package.json
  3. 28 8
      src/complates/Sidebar.js

+ 56 - 0
package-lock.json

@@ -12,6 +12,7 @@
         "@testing-library/react": "^13.4.0",
         "@testing-library/user-event": "^13.5.0",
         "antd": "^5.18.3",
+        "axios": "^1.7.2",
         "mammoth": "^1.8.0",
         "react": "^18.3.1",
         "react-dom": "^18.3.1",
@@ -5698,6 +5699,29 @@
         "node": ">=4"
       }
     },
+    "node_modules/axios": {
+      "version": "1.7.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
+      "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
+      "dependencies": {
+        "follow-redirects": "^1.15.6",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      }
+    },
+    "node_modules/axios/node_modules/form-data": {
+      "version": "4.0.0",
+      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+      "dependencies": {
+        "asynckit": "^0.4.0",
+        "combined-stream": "^1.0.8",
+        "mime-types": "^2.1.12"
+      },
+      "engines": {
+        "node": ">= 6"
+      }
+    },
     "node_modules/axobject-query": {
       "version": "3.1.1",
       "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
@@ -15112,6 +15136,11 @@
         "node": ">= 0.10"
       }
     },
+    "node_modules/proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+    },
     "node_modules/psl": {
       "version": "1.9.0",
       "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",
@@ -23344,6 +23373,28 @@
       "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.9.1.tgz",
       "integrity": "sha512-QbUdXJVTpvUTHU7871ppZkdOLBeGUKBQWHkHrvN2V9IQWGMt61zf3B45BtzjxEJzYuj0JBjBZP/hmYS/R9pmAw=="
     },
+    "axios": {
+      "version": "1.7.2",
+      "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.2.tgz",
+      "integrity": "sha512-2A8QhOMrbomlDuiLeK9XibIBzuHeRcqqNOHp0Cyp5EoJ1IFDh+XZH3A6BkXtv0K4gFGCI0Y4BM7B1wOEi0Rmgw==",
+      "requires": {
+        "follow-redirects": "^1.15.6",
+        "form-data": "^4.0.0",
+        "proxy-from-env": "^1.1.0"
+      },
+      "dependencies": {
+        "form-data": {
+          "version": "4.0.0",
+          "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
+          "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
+          "requires": {
+            "asynckit": "^0.4.0",
+            "combined-stream": "^1.0.8",
+            "mime-types": "^2.1.12"
+          }
+        }
+      }
+    },
     "axobject-query": {
       "version": "3.1.1",
       "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.1.1.tgz",
@@ -29943,6 +29994,11 @@
         }
       }
     },
+    "proxy-from-env": {
+      "version": "1.1.0",
+      "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz",
+      "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg=="
+    },
     "psl": {
       "version": "1.9.0",
       "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz",

+ 1 - 0
package.json

@@ -8,6 +8,7 @@
     "@testing-library/react": "^13.4.0",
     "@testing-library/user-event": "^13.5.0",
     "antd": "^5.18.3",
+    "axios": "^1.7.2",
     "mammoth": "^1.8.0",
     "react": "^18.3.1",
     "react-dom": "^18.3.1",

+ 28 - 8
src/complates/Sidebar.js

@@ -1,6 +1,7 @@
 import React, { useState } from "react";
 import { Modal, Flex, Input, Typography, Checkbox, Button, Collapse } from "antd";
 import "../asstes/css/Sidebar.css"
+import axios from "axios";
 
 import Img1 from '../asstes/img/goUpper.png'
 import Img2 from '../asstes/img/任务卡片.png'
@@ -17,7 +18,9 @@ function Sidebar() {
     const [isModalOpen2, setIsModalOpen2] = useState(false);
     const [isModalOpen3, setIsModalOpen3] = useState(false);
     const [isModalOpen4, setIsModalOpen4] = useState(false);
-
+    const [name, setName] = useState('');
+    const [phone, setPhone] = useState('');
+    const [school, setSchool] = useState('');
 
     const handleOk1 = () => {
         setIsModalOpen1(false);
@@ -42,6 +45,23 @@ function Sidebar() {
     const onChangeCollapse = (key) => {
         console.log(key);
     }
+    const submit = () => {
+        // https://traininguser-api.cocorobo.cn/sendEmail
+        console.log(name, school, phone)
+        let params = {
+            content: "",
+            content_type: "",
+            email: "jidechao@cocorobo.cc,1025103647@qq.com,xujiawei@cocorobo.cc",
+            subject: "训练平台"
+        }
+        axios.post('https://traininguser-api.cocorobo.cn/sendEmail', {
+            name: name,
+            school: school,
+            phone: phone
+        }).then(res => {
+            console.log(res)
+        })
+    }
     return (
         <div className="Sidebar">
             <div>
@@ -72,19 +92,19 @@ function Sidebar() {
                 footer={[]}>
                 <h3 className="Model_h3_title">CocoClass賬號申請</h3>
 
-                <img src={codeImg} alt="反饋" style={{margin: '0 auto',display:'block',padding:15}} />
-                {/* <Flex vertical gap={16}>
+                {/* <img src={codeImg} alt="反饋" style={{margin: '0 auto',display:'block',padding:15}} /> */}
+                <Flex vertical gap={16}>
                     <div>
                         <Typography.Title level={5}>學校名稱</Typography.Title>
-                        <Input placeholder="請輸入" />
+                        <Input placeholder="請輸入" value={school} onChange={(e) => setSchool(e.target.value)} />
                     </div>
                     <div>
                         <Typography.Title level={5}>賬戶(請輸入電郵)</Typography.Title>
-                        <Input placeholder="請輸入" />
+                        <Input placeholder="請輸入" value={phone} onChange={(e) => setPhone(e.target.value)} />
                     </div>
                     <div>
                         <Typography.Title level={5}>姓名</Typography.Title>
-                        <Input placeholder="請輸入" />
+                        <Input placeholder="請輸入" value={name} onChange={(e) => setName(e.target.value)} />
                     </div>
                 </Flex>
                 <p className="model_p_text">*請填寫以上申請信息,我們將在工作日24小時内回復您。您的信息將被嚴格保密,不會被用於其他用途。</p>
@@ -92,8 +112,8 @@ function Sidebar() {
                     <i className="model_checkbox_i" onClick={() => setIsModalOpen3(true)}>服務條款</i>和
                     <i className="model_checkbox_i" onClick={() => setIsModalOpen4(true)}>隱私政策</i>,並確認您已年滿18歲。</span>
                 <div style={{ textAlign: 'center', marginTop: 20 }}>
-                    <Button type="primary" onClick={() => setIsModalOpen1(false)}>提交</Button>
-                </div> */}
+                    <Button type="primary" onClick={() => submit()}>提交</Button>
+                </div>
             </Modal>
 
             <Modal open={isModalOpen2} onOk={handleOk2} onCancel={() => setIsModalOpen2(false)}