chao 2 days ago
parent
commit
95faed1ecf
3 changed files with 62 additions and 21 deletions
  1. 2 2
      index.js
  2. 1 8
      routes/router.js
  3. 59 11
      signUp.html

+ 2 - 2
index.js

@@ -13,8 +13,8 @@ app.use(express.urlencoded({ extended: false }));
 var http = require('http');
 
 const httpsOption = {
-    key : fs.readFileSync("/etc/letsencrypt/live/beta.api.cocorobo.cn/privkey.pem"),
-    cert: fs.readFileSync("/etc/letsencrypt/live/beta.api.cocorobo.cn/fullchain.pem")
+    // key : fs.readFileSync("/etc/letsencrypt/live/beta.api.cocorobo.cn/privkey.pem"),
+    // cert: fs.readFileSync("/etc/letsencrypt/live/beta.api.cocorobo.cn/fullchain.pem")
 }
 
 var httpsserver = http.createServer(httpsOption, app);

+ 1 - 8
routes/router.js

@@ -13,7 +13,7 @@ router.route('/user').post(async function (req, res) {
         console.log(data);
         if (data[0] && data[0][0] && data[0][0].type == 1) {
             console.log("报名成功");
-            res.send({ status: 'ok', user: user, message: '用户报名成功' });
+            res.send({ status: 'ok', message: '用户报名成功' });
         }
     });
 
@@ -21,11 +21,4 @@ router.route('/user').post(async function (req, res) {
 
 
 
-
-
-
-
-
-
-
 module.exports = router;

+ 59 - 11
signUp.html

@@ -307,7 +307,8 @@
 <body>
     <!-- 导航栏 -->
     <nav>
-        <img src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/logo.png" alt="logo" style="width: 40px;margin-right: 15px;"></img>
+        <img src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/logo.png" alt="logo"
+            style="width: 40px;margin-right: 15px;"></img>
         <div class="event-name">第六届广东省青少年创新思维及科技实践大赛创新思维挑战赛(选手报名)</div>
 
     </nav>
@@ -318,7 +319,7 @@
         <div class="sidebar">
             <button class="menu-btn active" id="downloadBtn">资料下载</button>
             <button class="menu-btn" id="registerBtn">在线报名</button>
-            <button class="menu-btn" id="registerBtn">资格确认</button>
+            <button class="menu-btn" id="registerBtn1">资格确认</button>
         </div>
 
         <!-- 右侧内容区域 -->
@@ -351,7 +352,7 @@
                         <div class="file-icon">📄</div>
                         <div class="file-info">
                             <div class="file-title">报名表模板</div>
-                            <div class="file-desc">请在完成在线报名后,下载文件完成学校盖章再上传报名表</div>
+                            <div class="file-desc">完成在线报名后,请先下载该模板,经所在学校盖章确认后,将盖章后的模板上传至【资格确认】板块,即可完成赛前准备。</div>
                         </div>
                         <a target="_blank"
                             href="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/%E6%8A%A5%E5%90%8D%E8%A1%A8.docx"
@@ -493,6 +494,37 @@
                 </div>
                 <button type="submit" class="submit-btn" onclick="submitData()">提交报名</button>
             </div>
+
+            <!-- 上传报名表单 -->
+            <div class="registration-section" id="uploadSection">
+                <h2 class="content-header">上传报名表</h2>
+                <div class="download-list">
+                    <div class="form-row">
+                        <div class="form-col">
+                            <div class="form-group">
+                                <label class="form-label required" for="name">姓名</label>
+                                <input type="text" id="name1" class="form-input" required>
+                                <div class="error" id="name-error1">请输入姓名</div>
+                            </div>
+                        </div>
+
+                        <div class="form-col">
+                            <div class="form-group">
+                                <label class="form-label required" for="idNumber">身份证号码</label>
+                                <input type="text" id="idNumber1" class="form-input" required pattern="\d{17}[\dXx]">
+                                <div class="error" id="idNumber-error1">请输入18位身份证号码</div>
+                            </div>
+                        </div>
+                    </div>
+
+                    <div class="file-upload">
+                        <label class="form-label required" for="photo">上传文件</label>
+                        <input type="file" id="photo" required>
+                        <div class="error" id="photo-error">请上传照片</div>
+                    </div>
+                    <button type="submit" class="submit-btn" onclick="submitRegistration()">提交报名表</button>
+                </div>
+            </div>
         </div>
     </div>
 
@@ -501,8 +533,18 @@
         document.getElementById('downloadBtn').addEventListener('click', function () {
             document.getElementById('downloadBtn').classList.add('active');
             document.getElementById('registerBtn').classList.remove('active');
+            document.getElementById('registerBtn1').classList.remove('active');
             document.getElementById('downloadSection').classList.add('active');
             document.getElementById('registrationSection').classList.remove('active');
+            document.getElementById('uploadSection').classList.remove('active');
+        });
+        document.getElementById('registerBtn1').addEventListener('click', function () {
+            document.getElementById('registerBtn1').classList.add('active');
+            document.getElementById('downloadBtn').classList.remove('active');
+            document.getElementById('registerBtn').classList.remove('active');
+            document.getElementById('downloadSection').classList.remove('active');
+            document.getElementById('registrationSection').classList.remove('active');
+            document.getElementById('uploadSection').classList.add('active');
         });
 
         document.getElementById('photo').addEventListener('change', function (e) {
@@ -542,8 +584,10 @@
         document.getElementById('registerBtn').addEventListener('click', function () {
             document.getElementById('registerBtn').classList.add('active');
             document.getElementById('downloadBtn').classList.remove('active');
+            document.getElementById('registerBtn1').classList.remove('active');
             document.getElementById('registrationSection').classList.add('active');
             document.getElementById('downloadSection').classList.remove('active');
+            document.getElementById('uploadSection').classList.remove('active');
         });
 
         let num = 1;
@@ -730,13 +774,14 @@
                 })
             }
             console.log('表单数据:', document.getElementById("selectType").value);
-            
+
             try {
                 // 收集表单数据
                 const formDataObj = {
                     type: 1, // 报名类型,1代表个人报名,2代表团队报名
                     uploadUrl: "", // 上传文件的URL
                     idCard: "", // 选手身份证号拼接
+                    registrationFormUrl: "", // 报名表上传URL
                     user: formData
                 };
 
@@ -762,18 +807,21 @@
                 alert(`报名失败: ${error.message}`);
             }
         }
-        
 
+        async function submitRegistration(){
+            const formData = new FormData();
+        }
 
-        fetch("http://localhost:8080/api/user",{
-            method:"POST",
-            headers:{
-                "Content-Type":"application/json"
+        fetch("http://localhost:8080/api/user", {
+            method: "POST",
+            headers: {
+                "Content-Type": "application/json"
             },
-            body:JSON.stringify({name:"张三",age:18} )
-        }).then(res=>res.json()).then(res=>{
+            body: JSON.stringify({ name: "张三", age: 18 })
+        }).then(res => res.json()).then(res => {
             console.log(res)
         })
+
     </script>
 </body>