index.html 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <title>第六届广东省青少年创新思维及科技实践大赛(创新思维类选手报名)</title>
  7. <style>
  8. * {
  9. margin: 0;
  10. padding: 0;
  11. box-sizing: border-box;
  12. }
  13. body {
  14. font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
  15. height: 100vh;
  16. display: flex;
  17. flex-direction: column;
  18. overflow: hidden;
  19. background-color: #f5f7fa;
  20. }
  21. /* 导航栏样式 */
  22. nav {
  23. background: linear-gradient(135deg, #1a73e8, #0d47a1);
  24. color: white;
  25. padding: 15px 30px;
  26. display: flex;
  27. align-items: center;
  28. box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  29. z-index: 100;
  30. }
  31. .logo {
  32. font-size: 24px;
  33. font-weight: bold;
  34. margin-right: 15px;
  35. }
  36. .event-name {
  37. font-size: 20px;
  38. flex-grow: 1;
  39. }
  40. /* 主内容区域 */
  41. .main-container {
  42. display: flex;
  43. flex: 1;
  44. overflow: hidden;
  45. }
  46. /* 左侧菜单 */
  47. .sidebar {
  48. width: 200px;
  49. background-color: #2c3e50;
  50. color: white;
  51. display: flex;
  52. flex-direction: column;
  53. padding: 20px 0;
  54. }
  55. .menu-btn {
  56. padding: 15px 20px;
  57. margin: 10px 15px;
  58. background-color: #3498db;
  59. color: white;
  60. border: none;
  61. border-radius: 5px;
  62. font-size: 16px;
  63. cursor: pointer;
  64. transition: all 0.3s;
  65. text-align: center;
  66. }
  67. .menu-btn:hover {
  68. background-color: #2980b9;
  69. transform: translateY(-2px);
  70. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  71. }
  72. .menu-btn.active {
  73. background-color: #1abc9c;
  74. }
  75. /* 右侧内容区域 */
  76. .content-area {
  77. flex: 1;
  78. display: flex;
  79. flex-direction: column;
  80. padding: 20px;
  81. background-color: white;
  82. border-radius: 10px;
  83. margin: 20px;
  84. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  85. overflow: hidden;
  86. }
  87. .content-header {
  88. font-size: 24px;
  89. color: #2c3e50;
  90. margin-bottom: 20px;
  91. padding-bottom: 10px;
  92. border-bottom: 2px solid #3498db;
  93. }
  94. /* 下载区域 */
  95. .download-section {
  96. display: none;
  97. flex-direction: column;
  98. height: 100%;
  99. }
  100. .download-section.active {
  101. display: flex;
  102. }
  103. .download-list {
  104. overflow-y: auto;
  105. flex: 1;
  106. }
  107. .download-item {
  108. width: calc(100% - 30px);
  109. background-color: #f8f9fa;
  110. border: 1px solid #e9ecef;
  111. border-radius: 8px;
  112. padding: 15px;
  113. margin-bottom: 15px;
  114. display: flex;
  115. align-items: center;
  116. transition: all 0.3s;
  117. }
  118. .download-item:hover {
  119. transform: translateX(5px);
  120. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  121. border-color: #3498db;
  122. }
  123. .file-icon {
  124. font-size: 24px;
  125. margin-right: 15px;
  126. color: #3498db;
  127. }
  128. .file-info {
  129. flex: 1;
  130. }
  131. .file-title {
  132. font-weight: bold;
  133. margin-bottom: 5px;
  134. }
  135. .file-desc {
  136. color: #6c757d;
  137. font-size: 14px;
  138. }
  139. .download-btn {
  140. background-color: #28a745;
  141. color: white;
  142. border: none;
  143. padding: 8px 15px;
  144. border-radius: 5px;
  145. cursor: pointer;
  146. transition: background-color 0.3s;
  147. text-decoration: none;
  148. }
  149. .download-btn:hover {
  150. background-color: #218838;
  151. }
  152. /* 报名区域 */
  153. .registration-section {
  154. display: none;
  155. flex-direction: column;
  156. height: 100%;
  157. overflow-y: auto;
  158. position: relative;
  159. }
  160. .registration-section.active {
  161. display: flex;
  162. }
  163. .form-container {
  164. flex: 1;
  165. padding-right: 10px;
  166. }
  167. .form-group {
  168. margin-bottom: 20px;
  169. }
  170. .form-label {
  171. display: block;
  172. margin-bottom: 8px;
  173. font-weight: bold;
  174. color: #495057;
  175. }
  176. .required::after {
  177. content: " *";
  178. color: #e74c3c;
  179. }
  180. .form-input {
  181. width: 100%;
  182. padding: 12px;
  183. border: 1px solid #ced4da;
  184. border-radius: 5px;
  185. font-size: 16px;
  186. transition: border-color 0.3s;
  187. }
  188. .form-input:focus {
  189. border-color: #3498db;
  190. outline: none;
  191. box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
  192. }
  193. .form-row {
  194. display: flex;
  195. gap: 20px;
  196. }
  197. .form-col {
  198. flex: 1;
  199. }
  200. .file-upload {
  201. border: 2px dashed #ced4da;
  202. padding: 30px;
  203. text-align: center;
  204. border-radius: 8px;
  205. margin: 20px 0;
  206. background-color: #f8f9fa;
  207. transition: all 0.3s;
  208. }
  209. .file-upload:hover {
  210. border-color: #3498db;
  211. background-color: #e3f2fd;
  212. }
  213. .upload-icon {
  214. font-size: 40px;
  215. color: #3498db;
  216. margin-bottom: 15px;
  217. }
  218. .submit-btn {
  219. background-color: #1a73e8;
  220. color: white;
  221. border: none;
  222. padding: 14px 25px;
  223. border-radius: 5px;
  224. font-size: 18px;
  225. cursor: pointer;
  226. transition: all 0.3s;
  227. margin-top: 20px;
  228. width: 100%;
  229. }
  230. .submit-btn:hover {
  231. background-color: #0d47a1;
  232. transform: translateY(-2px);
  233. box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  234. }
  235. .error {
  236. color: #e74c3c;
  237. font-size: 14px;
  238. margin-top: 5px;
  239. display: none;
  240. }
  241. .remove-Contestant {
  242. padding: 7px 15px;
  243. font-size: 14px;
  244. background-color: #db3434;
  245. color: white;
  246. border: none;
  247. border-radius: 5px;
  248. cursor: pointer;
  249. transition: all 0.3s;
  250. text-align: center;
  251. position: absolute;
  252. top: 0;
  253. left: 80px;
  254. }
  255. .menu-btn-add:nth-last-child(1) {
  256. padding: 7px 15px;
  257. font-size: 14px;
  258. color: white;
  259. border: none;
  260. border-radius: 5px;
  261. cursor: pointer;
  262. transition: all 0.3s;
  263. text-align: center;
  264. background-color: #3498db;
  265. }
  266. .step-container {
  267. display: none;
  268. }
  269. .step-container.active {
  270. display: block;
  271. }
  272. .competition-grid {
  273. display: grid;
  274. grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  275. gap: 20px;
  276. margin-bottom: 30px;
  277. }
  278. .competition-card {
  279. border: 1px solid #e0e0e0;
  280. border-radius: 10px;
  281. padding: 20px;
  282. text-align: center;
  283. cursor: pointer;
  284. transition: all 0.3s;
  285. }
  286. .competition-card:hover {
  287. border-color: #1a73e8;
  288. box-shadow: 0 4px 12px rgba(26, 115, 232, 0.15);
  289. transform: translateY(-5px);
  290. }
  291. .competition-card.selected {
  292. border-color: #1a73e8;
  293. background-color: #e8f0fe;
  294. }
  295. .competition-icon {
  296. font-size: 36px;
  297. color: #1a73e8;
  298. margin-bottom: 15px;
  299. }
  300. .competition-name {
  301. font-weight: 500;
  302. color: #202124;
  303. }
  304. .btn {
  305. padding: 12px 30px;
  306. border-radius: 8px;
  307. font-size: 16px;
  308. font-weight: 500;
  309. cursor: pointer;
  310. transition: all 0.3s;
  311. border: none;
  312. }
  313. .btn-prev {
  314. background-color: #f8f9fa;
  315. color: #5f6368;
  316. }
  317. .btn-prev:hover {
  318. background-color: #e8f0fe;
  319. color: #1a73e8;
  320. }
  321. .btn-next {
  322. background-color: #1a73e8;
  323. color: white;
  324. }
  325. .btn-next:hover {
  326. background-color: #0d47a1;
  327. }
  328. .btn-submit {
  329. background-color: #34a853;
  330. color: white;
  331. }
  332. .btn-submit:hover {
  333. background-color: #2d9249;
  334. }
  335. .error {
  336. color: #ea4335;
  337. font-size: 14px;
  338. margin-top: 5px;
  339. display: none;
  340. }
  341. .button-group {
  342. display: flex;
  343. justify-content: space-between;
  344. margin-top: 30px;
  345. }
  346. .step-title {
  347. font-size: 18px;
  348. color: #202124;
  349. margin-bottom: 20px;
  350. padding-bottom: 10px;
  351. border-bottom: 1px solid #e0e0e0;
  352. }
  353. .button-Contestant {
  354. display: none;
  355. margin-right: 20px;
  356. }
  357. .button-Contestant.active {
  358. display: block;
  359. }
  360. #registerBtn1 {
  361. display: none;
  362. }
  363. </style>
  364. <script src="https://sdk.amazonaws.com/js/aws-sdk-2.235.1.min.js"></script>
  365. <script>
  366. var credentials = {
  367. accessKeyId: 'AKIATLPEDU37QV5CHLMH',
  368. secretAccessKey: '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'
  369. }; //秘鑰形式的登錄上傳
  370. window.AWS.config.update(credentials);
  371. window.AWS.config.region = 'cn-northwest-1'; //設置區域
  372. </script>
  373. </head>
  374. <body>
  375. <!-- 导航栏 -->
  376. <nav>
  377. <img src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/logo.png" alt="logo"
  378. style="width: 40px;margin-right: 15px;"></img>
  379. <div class="event-name">第六届广东省青少年创新思维及科技实践大赛(创新思维类选手报名)</div>
  380. </nav>
  381. <!-- 主内容区域 -->
  382. <div class="main-container">
  383. <!-- 左侧菜单 -->
  384. <div class="sidebar">
  385. <button class="menu-btn active" id="downloadBtn">资料下载</button>
  386. <button class="menu-btn" id="registerBtn">在线报名</button>
  387. <button class="menu-btn" id="registerBtn1">资格确认</button>
  388. </div>
  389. <!-- 右侧内容区域 -->
  390. <div class="content-area">
  391. <!-- 下载区域 -->
  392. <div class="download-section active" id="downloadSection">
  393. <h2 class="content-header">比赛资料下载</h2>
  394. <div class="download-list">
  395. <div class="download-item">
  396. <div class="file-icon">📋</div>
  397. <div class="file-info">
  398. <div class="file-title">第六届广东省青少年创新思维及科技实践大赛创新思维挑战赛</div>
  399. </div>
  400. <a target="_blank"
  401. href="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/%E5%88%9B%E6%96%B0%E6%80%9D%E7%BB%B4%E7%B1%BB-%E5%88%9B%E6%96%B0%E6%80%9D%E7%BB%B4%E6%8C%91%E6%88%98%E8%B5%9B.pdf"
  402. class="download-btn" download="第六届广东省青少年创新思维及科技实践大赛创新思维挑战赛.pdf">下载</a>
  403. </div>
  404. <div class="download-item">
  405. <div class="file-icon">📊</div>
  406. <div class="file-info">
  407. <div class="file-title">第六届广东省青少年创新思维及科技实践大赛的通知</div>
  408. </div>
  409. <a target="_blank"
  410. href="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/%E5%85%B3%E4%BA%8E%E4%B8%BE%E5%8A%9E%E7%AC%AC%E5%85%AD%E5%B1%8A%E5%B9%BF%E4%B8%9C%E7%9C%81%E9%9D%92%E5%B0%91%E5%B9%B4%E5%88%9B%E6%96%B0%E6%80%9D%E7%BB%B4%E5%8F%8A%E7%A7%91%E6%8A%80%E5%AE%9E%E8%B7%B5%E5%A4%A7%E8%B5%9B%E7%9A%84%E9%80%9A%E7%9F%A5%286%29.pdf"
  411. class="download-btn" download="第六届广东省青少年创新思维及科技实践大赛的通知.pdf">下载</a>
  412. </div>
  413. <div class="download-item">
  414. <div class="file-icon">📄</div>
  415. <div class="file-info">
  416. <div class="file-title">报名表模板</div>
  417. <div class="file-desc">完成在线报名后,请先下载该模板,经所在学校盖章确认后,将盖章后的模板上传至【资格确认】板块,即可完成赛前准备。</div>
  418. </div>
  419. <a target="_blank"
  420. href="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/%E6%8A%A5%E5%90%8D%E8%A1%A8.docx"
  421. class="download-btn" download>下载</a>
  422. </div>
  423. </div>
  424. </div>
  425. <!-- 报名区域 -->
  426. <div class="registration-section " id="registrationSection">
  427. <!-- <div class="select-type">
  428. <select id="selectType" class="form-input" required >
  429. <option value="">请选择参赛类型</option>
  430. <option value="1">桌游设计挑战类</option>
  431. <option value="2">智能体应用类</option>
  432. </select>
  433. </div> -->
  434. <div class="content-header" style="display: flex;justify-content: space-between;">
  435. <h2 style="display: inline-block;font-size: 24px;">参赛信息登记</h2>
  436. <div class="button-Contestant">
  437. <button class="menu-btn-add" onclick="addContestant()">添加选手</button>
  438. </div>
  439. </div>
  440. <!-- 步骤1:选择比赛类型 -->
  441. <div id="step1" class="step-container active">
  442. <div class="step-title">第一步:请选择您要报名的比赛类型</div>
  443. <div class="competition-grid">
  444. <div class="competition-card" data-id="1">
  445. <div class="competition-icon">🧮</div>
  446. <div class="competition-name">桌游设计挑战</div>
  447. </div>
  448. <div class="competition-card" data-id="2">
  449. <div class="competition-icon">💻</div>
  450. <div class="competition-name">智能体应用</div>
  451. </div>
  452. </div>
  453. <div class="button-group">
  454. <div></div> <!-- 占位 -->
  455. <button class="btn btn-next" id="nextToStep2">下一步</button>
  456. </div>
  457. </div>
  458. <!-- 步骤2:填写报名信息 -->
  459. <div id="step2" class="step-container">
  460. <div class="step-title">第二步:填写报名信息</div>
  461. <div class="form-group" style="display: flex;align-items: center;">
  462. <label class="form-label required" for="name">指导教师</label>
  463. <input style="width: 200px;margin-left: 20px;margin-right: 15px;" type="text" id="teacher" class="form-input" required>
  464. <div class="error" id="name-error1">请输入指导教师</div>
  465. </div>
  466. <div class="form-container" id="formContainer">
  467. <input type="hidden" id="competitionType" value="">
  468. <h3>选手1:</h3>
  469. <br />
  470. <form id="registrationForm1">
  471. <div class="form-row">
  472. <div class="form-col">
  473. <div class="form-group">
  474. <label class="form-label required" for="name">姓名</label>
  475. <input type="text" id="name1" class="form-input" required>
  476. <div class="error" id="name-error1">请输入姓名</div>
  477. </div>
  478. </div>
  479. <div class="form-col">
  480. <div class="form-group">
  481. <label class="form-label required" for="gender">性别</label>
  482. <select id="gender1" class="form-input" required>
  483. <option value="">请选择</option>
  484. <option value="1">男</option>
  485. <option value="2">女</option>
  486. </select>
  487. <div class="error" id="gender-error1">请选择性别</div>
  488. </div>
  489. </div>
  490. </div>
  491. <div class="form-row">
  492. <div class="form-col">
  493. <div class="form-group">
  494. <label class="form-label required" for="ethnicity">民族</label>
  495. <input type="text" id="ethnicity1" class="form-input" required>
  496. <div class="error" id="ethnicity-error1">请输入民族</div>
  497. </div>
  498. </div>
  499. <div class="form-col">
  500. <div class="form-group">
  501. <label class="form-label required" for="birthdate">出生年月</label>
  502. <input type="date" id="birthdate1" class="form-input" required>
  503. <div class="error" id="birthdate-error1">请选择出生年月</div>
  504. </div>
  505. </div>
  506. </div>
  507. <div class="form-row">
  508. <div class="form-col">
  509. <div class="form-group">
  510. <label class="form-label required" for="email">电子邮箱</label>
  511. <input type="email" id="email1" class="form-input" required>
  512. <div class="error" id="email-error1">请输入有效的电子邮箱</div>
  513. </div>
  514. </div>
  515. <div class="form-col">
  516. <div class="form-group">
  517. <label class="form-label required" for="idNumber">身份证号码</label>
  518. <input type="text" id="idNumber1" class="form-input" required
  519. pattern="\d{17}[\dXx]">
  520. <div class="error" id="idNumber-error1">请输入18位身份证号码</div>
  521. </div>
  522. </div>
  523. </div>
  524. <div class="form-row">
  525. <div class="form-col">
  526. <div class="form-group">
  527. <label class="form-label required" for="group">组别</label>
  528. <select id="group1" class="form-input" required>
  529. <option value="">请选择</option>
  530. <option value="1">小学低龄</option>
  531. <option value="2">小学高龄</option>
  532. <option value="3">中学</option>
  533. <option value="4">高校</option>
  534. </select>
  535. <div class="error" id="group-error1">请选择组别</div>
  536. </div>
  537. </div>
  538. <div class="form-col">
  539. <div class="form-group">
  540. <label class="form-label required" for="grade">年级</label>
  541. <input type="text" id="grade1" class="form-input" required>
  542. <div class="error" id="grade-error1">请输入年级</div>
  543. </div>
  544. </div>
  545. </div>
  546. <div class="form-row">
  547. <div class="form-col">
  548. <div class="form-group">
  549. <label class="form-label required" for="school">所在学校</label>
  550. <input type="text" id="school1" class="form-input" required>
  551. <div class="error" id="school-error1">请输入学校名称</div>
  552. </div>
  553. </div>
  554. <div class="form-col">
  555. <div class="form-group">
  556. <label class="form-label required" for="schoolRegion">学校所在地区</label>
  557. <input type="text" id="schoolRegion1" class="form-input" required
  558. placeholder="省/市/区">
  559. <div class="error" id="schoolRegion-error1">请输入学校所在地区</div>
  560. </div>
  561. </div>
  562. </div>
  563. <div class="form-group">
  564. <label class="form-label required" for="phone">联系电话</label>
  565. <input type="tel" id="phone1" class="form-input" required pattern="[0-9]{11}">
  566. <div class="error" id="phone-error1">请输入11位手机号码</div>
  567. </div>
  568. </form>
  569. </div>
  570. <div class="button-group">
  571. <button type="button" class="btn btn-prev" id="prevToStep1">上一步</button>
  572. <button type="submit" class="btn btn-submit" onclick="submitData()">提交报名</button>
  573. </div>
  574. </div>
  575. </div>
  576. <!-- 上传报名表单 -->
  577. <div class="registration-section" id="uploadSection">
  578. <h2 class="content-header">上传报名表</h2>
  579. <div class="download-list">
  580. <div class="form-row">
  581. <div class="form-col">
  582. <div class="form-group">
  583. <label class="form-label required" for="idNumber">身份证号码</label>
  584. <input type="text" id="id_number" class="form-input" required pattern="\d{17}[\dXx]"
  585. placeholder="请填写在线报名时,团队内任一选手的身份证号码">
  586. </div>
  587. </div>
  588. </div>
  589. <div class="file-upload">
  590. <label class="form-label required" for="photo">上传文件</label>
  591. <input type="file" id="registration" required>
  592. </div>
  593. <button type="submit" class="submit-btn" onclick="submitRegistration()">提交报名表</button>
  594. </div>
  595. </div>
  596. </div>
  597. </div>
  598. <script>
  599. const requesturl = window.location.href.indexOf("localhost") > -1 ? "http://localhost:11111" : "http://183.36.25.93:555/";
  600. console.log("requesturl:", requesturl);
  601. const nowTime = new Date();
  602. const givenTime = new Date("2025-10-13")
  603. if (givenTime - nowTime > 0) {
  604. document.getElementById('registerBtn1').style.display = "none";
  605. } else {
  606. document.getElementById('registerBtn1').style.display = "block";
  607. }
  608. // 切换下载和报名区域
  609. document.getElementById('downloadBtn').addEventListener('click', function () {
  610. document.getElementById('downloadBtn').classList.add('active');
  611. document.getElementById('registerBtn').classList.remove('active');
  612. document.getElementById('registerBtn1').classList.remove('active');
  613. document.getElementById('downloadSection').classList.add('active');
  614. document.getElementById('registrationSection').classList.remove('active');
  615. document.getElementById('uploadSection').classList.remove('active');
  616. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  617. });
  618. document.getElementById('registerBtn1').addEventListener('click', function () {
  619. document.getElementById('registerBtn1').classList.add('active');
  620. document.getElementById('downloadBtn').classList.remove('active');
  621. document.getElementById('registerBtn').classList.remove('active');
  622. document.getElementById('downloadSection').classList.remove('active');
  623. document.getElementById('registrationSection').classList.remove('active');
  624. document.getElementById('uploadSection').classList.add('active');
  625. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  626. });
  627. let buttonContestant = false
  628. document.getElementById('registerBtn').addEventListener('click', function () {
  629. document.getElementById('registerBtn').classList.add('active');
  630. document.getElementById('downloadBtn').classList.remove('active');
  631. document.getElementById('registerBtn1').classList.remove('active');
  632. document.getElementById('registrationSection').classList.add('active');
  633. document.getElementById('downloadSection').classList.remove('active');
  634. document.getElementById('uploadSection').classList.remove('active');
  635. console.log("selectedCompetitionId:", selectedCompetitionId);
  636. if (buttonContestant) {
  637. document.getElementsByClassName("button-Contestant")[0].classList.add('active');
  638. } else {
  639. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  640. }
  641. });
  642. let uploadFileUrl = ''
  643. // 比赛类型选择
  644. const competitionCards = document.querySelectorAll('.competition-card');
  645. let selectedCompetitionId = null;
  646. competitionCards.forEach(card => {
  647. card.addEventListener('click', function () {
  648. // 移除所有卡片的selected类
  649. competitionCards.forEach(c => {
  650. c.classList.remove('selected');
  651. });
  652. // 添加当前卡片的selected类
  653. this.classList.add('selected');
  654. // 存储选择的比赛ID
  655. selectedCompetitionId = this.getAttribute('data-id');
  656. });
  657. });
  658. // 步骤切换
  659. document.getElementById('nextToStep2').addEventListener('click', function () {
  660. if (!selectedCompetitionId) {
  661. alert('请先选择比赛类型');
  662. return;
  663. }
  664. // 切换到步骤2
  665. document.getElementById('step1').classList.remove('active');
  666. document.getElementById('step2').classList.add('active');
  667. document.getElementsByClassName("button-Contestant")[0].classList.add('active');
  668. buttonContestant = true
  669. });
  670. document.getElementById('prevToStep1').addEventListener('click', function () {
  671. // 切换回步骤1
  672. document.getElementById('step2').classList.remove('active');
  673. document.getElementById('step1').classList.add('active');
  674. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  675. buttonContestant = false
  676. });
  677. let num = 1;
  678. let addList = []
  679. function addContestant() {
  680. num = num + 1;
  681. addList.push(num)
  682. const ifFirst = addList.find(item => item === 1);
  683. let addListLength = addList.length+1;
  684. if (ifFirst) {
  685. addListLength = addList.length
  686. }
  687. const html = document.getElementById('formContainer');
  688. const createDiv = document.createElement('div');
  689. createDiv.id = `addformContainer${num}`;
  690. createDiv.style.position = 'relative';
  691. const h3Create = document.createElement('h3');
  692. h3Create.innerText = `选手${addListLength}:`;
  693. createDiv.appendChild(h3Create);
  694. const delButton = document.createElement('button');
  695. delButton.innerText = `删除选手${addListLength}`;
  696. delButton.className = 'menu-btn-add remove-Contestant';
  697. delButton.onclick = removeContestant;
  698. createDiv.appendChild(delButton);
  699. const brCreate = document.createElement('br');
  700. createDiv.appendChild(brCreate);
  701. const formCrate = document.createElement('form');
  702. formCrate.id = `registrationForm${num}`;
  703. formCrate.innerHTML = `<div class="form-row">
  704. <div class="form-col">
  705. <div class="form-group">
  706. <label class="form-label required" for="name">姓名</label>
  707. <input type="text" id="name${num}" class="form-input" required>
  708. <div class="error" id="name-error${num}">请输入姓名</div>
  709. </div>
  710. </div>
  711. <div class="form-col">
  712. <div class="form-group">
  713. <label class="form-label required" for="gender">性别</label>
  714. <select id="gender${num}" class="form-input" required>
  715. <option value="">请选择</option>
  716. <option value="1">男</option>
  717. <option value="2">女</option>
  718. </select>
  719. <div class="error" id="gender-error${num}">请选择性别</div>
  720. </div>
  721. </div>
  722. </div>
  723. <div class="form-row">
  724. <div class="form-col">
  725. <div class="form-group">
  726. <label class="form-label required" for="ethnicity">民族</label>
  727. <input type="text" id="ethnicity${num}" class="form-input" required>
  728. <div class="error" id="ethnicity-error${num}">请输入民族</div>
  729. </div>
  730. </div>
  731. <div class="form-col">
  732. <div class="form-group">
  733. <label class="form-label required" for="birthdate">出生年月</label>
  734. <input type="date" id="birthdate${num}" class="form-input" required>
  735. <div class="error" id="birthdate-error${num}">请选择出生年月</div>
  736. </div>
  737. </div>
  738. </div>
  739. <div class="form-row">
  740. <div class="form-col">
  741. <div class="form-group">
  742. <label class="form-label required" for="email">电子邮箱</label>
  743. <input type="email" id="email${num}" class="form-input" required>
  744. <div class="error" id="email-error${num}">请输入有效的电子邮箱</div>
  745. </div>
  746. </div>
  747. <div class="form-col">
  748. <div class="form-group">
  749. <label class="form-label required" for="idNumber">身份证号码</label>
  750. <input type="text" id="idNumber${num}" class="form-input" required pattern="\d{17}[\dXx]">
  751. <div class="error" id="idNumber-error${num}">请输入18位身份证号码</div>
  752. </div>
  753. </div>
  754. </div>
  755. <div class="form-row">
  756. <div class="form-col">
  757. <div class="form-group">
  758. <label class="form-label required" for="group">组别</label>
  759. <select id="group${num}" class="form-input" required>
  760. <option value="">请选择</option>
  761. <option value="1">小学低龄</option>
  762. <option value="2">小学高龄</option>
  763. <option value="3">中学</option>
  764. <option value="4">高校</option>
  765. </select>
  766. <div class="error" id="group-error${num}">请选择组别</div>
  767. </div>
  768. </div>
  769. <div class="form-col">
  770. <div class="form-group">
  771. <label class="form-label required" for="grade">年级</label>
  772. <input type="text" id="grade${num}" class="form-input" required>
  773. <div class="error" id="grade-error${num}">请输入年级</div>
  774. </div>
  775. </div>
  776. </div>
  777. <div class="form-row">
  778. <div class="form-col">
  779. <div class="form-group">
  780. <label class="form-label required" for="school">所在学校</label>
  781. <input type="text" id="school${num}" class="form-input" required>
  782. <div class="error" id="school-error${num}">请输入学校名称</div>
  783. </div>
  784. </div>
  785. <div class="form-col">
  786. <div class="form-group">
  787. <label class="form-label required" for="schoolRegion">学校所在地区</label>
  788. <input type="text" id="schoolRegion${num}" class="form-input" required
  789. placeholder="省/市/区">
  790. <div class="error" id="schoolRegion-error${num}">请输入学校所在地区</div>
  791. </div>
  792. </div>
  793. </div>
  794. <div class="form-group">
  795. <label class="form-label required" for="phone">联系电话</label>
  796. <input type="tel" id="phone${num}" class="form-input" required pattern="[0-9]{11}">
  797. <div class="error" id="phone-error${num}">请输入11位手机号码</div>
  798. </div>`;
  799. createDiv.appendChild(formCrate);
  800. html.appendChild(createDiv);
  801. }
  802. function removeContestant(e) {
  803. const parentElement = Number(e.target.parentElement.id && e.target.parentElement.id.slice(16));
  804. addList = addList.filter(item => item !== parentElement);
  805. const html = document.getElementById('formContainer');
  806. let selectForm = html.querySelector(`div#addformContainer${parentElement}`);
  807. if (selectForm) html.removeChild(selectForm);
  808. // 依次递增更新剩余选手的序号
  809. addList.forEach((item, idx) => {
  810. let formDiv = html.querySelector(`div#addformContainer${item}`);
  811. if (formDiv) {
  812. formDiv.querySelector('h3').innerText = `选手${idx + 2}:`;
  813. formDiv.querySelector('button').innerText = `删除选手${idx + 2}`;
  814. }
  815. });
  816. // num = num - 1;
  817. }
  818. async function submitData() {
  819. const requiredFields = ['name', 'gender', 'ethnicity', 'birthdate', 'email',
  820. 'idNumber', 'group', 'grade', 'school', 'schoolRegion', 'phone',];
  821. let formData = [];
  822. let idNumber = '';
  823. let idError = '';
  824. let phone = '';
  825. let phoneError = '';
  826. let i = 0
  827. let isFirst = addList.find(item => item === 1);
  828. if(!isFirst) addList.unshift(1);
  829. for (let j = 0; j <= addList.length-1; j++) {
  830. let element = null;
  831. let errorElement = null;
  832. let isValid = true;
  833. i = addList[j]
  834. requiredFields.forEach(field => {
  835. element = document.getElementById(field + i);
  836. errorElement = document.getElementById(`${field}-error` + i);
  837. if (!element.value) {
  838. errorElement.style.display = 'block';
  839. isValid = false;
  840. } else {
  841. errorElement.style.display = 'none';
  842. }
  843. });
  844. // 验证身份证格式
  845. idNumber = document.getElementById('idNumber' + i);
  846. idError = document.getElementById('idNumber-error' + i);
  847. if (!/^\d{17}[\dXx]$/.test(idNumber.value)) {
  848. idError.style.display = 'block';
  849. isValid = false;
  850. } else {
  851. idError.style.display = 'none';
  852. }
  853. // 验证手机号格式
  854. phone = document.getElementById('phone' + i);
  855. phoneError = document.getElementById('phone-error' + i);
  856. if (!/^[0-9]{11}$/.test(phone.value)) {
  857. phoneError.style.display = 'block';
  858. isValid = false;
  859. } else {
  860. phoneError.style.display = 'none';
  861. }
  862. if (!isValid) {
  863. alert(`选手${j+1}填写信息有误,请重新填写`);
  864. return;
  865. };
  866. formData.push({
  867. name: document.getElementById('name' + i).value,
  868. gender: document.getElementById('gender' + i).value,
  869. ethnicity: document.getElementById('ethnicity' + i).value,
  870. birthdate: document.getElementById('birthdate' + i).value,
  871. email: document.getElementById('email' + i).value,
  872. id_number: document.getElementById('idNumber' + i).value,
  873. group: document.getElementById('group' + i).value,
  874. grade: document.getElementById('grade' + i).value,
  875. school: document.getElementById('school' + i).value,
  876. schoolRegion: document.getElementById('schoolRegion' + i).value,
  877. phone: document.getElementById('phone' + i).value,
  878. })
  879. }
  880. const teacher = document.getElementById('teacher').value;
  881. if(!teacher) {
  882. alert('请填写指导老师');
  883. return;
  884. }
  885. try {
  886. // 收集表单数据
  887. const formDataObj = {
  888. type: selectedCompetitionId, // 报名类型,1桌游,2智能体
  889. uploadUrl: teacher, // 上传文件的URL
  890. idCard: formData.map(item => item.id_number).join(","), // 选手身份证号拼接
  891. registrationFormUrl: "", // 报名表上传URL
  892. user: JSON.stringify(formData),
  893. };
  894. if (!confirm('提交之后无法再修改信息,是否确认提交?')) {
  895. return;
  896. }
  897. // 发送报名信息请求
  898. const registerResponse = await fetch(requesturl + 'api/user', {
  899. method: 'POST',
  900. headers: {
  901. 'Content-Type': 'application/json'
  902. },
  903. body: JSON.stringify(formDataObj)
  904. });
  905. if (!registerResponse.ok) {
  906. throw new Error('报名提交失败');
  907. }
  908. const registerData = await registerResponse.json();
  909. console.log(registerData);
  910. if (registerData.status == "ok") {
  911. alert("报名完成,审核情况会通过邮箱通知,请注意邮箱信息");
  912. } else {
  913. alert(registerData.message);
  914. }
  915. // document.getElementById('registrationForm').reset();
  916. } catch (error) {
  917. console.error('提交错误:', error);
  918. alert(`报名失败: ${error.message}`);
  919. }
  920. }
  921. let RegistrationUrl = "";
  922. document.getElementById('registration').addEventListener('change', function (e) {
  923. const idNumber = document.getElementById('id_number').value;
  924. if (!idNumber) {
  925. alert('请先填写身份证号');
  926. e.target.value = ''; // 清空已选择的文件
  927. return;
  928. }
  929. const file = e.target.files[0];
  930. if (!file) return;
  931. console.log('选择文件:', file);
  932. const fileName = `${idNumber}/${file.name}`;
  933. var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } });
  934. var params = {
  935. Key: fileName,
  936. ContentType: file.type,
  937. Body: file,
  938. 'Access-Control-Allow-Credentials': '*',
  939. 'ACL': 'public-read'
  940. };
  941. bucket.upload(params, function (err, data) {
  942. if (err) {
  943. console.error('上传失败:', err);
  944. alert('文件上传失败');
  945. } else {
  946. console.log('上传成功:', data);
  947. RegistrationUrl = data.Location;
  948. alert('文件上传成功');
  949. }
  950. });
  951. });
  952. async function submitRegistration() {
  953. const idNumber = document.getElementById('id_number').value;
  954. if (!idNumber) {
  955. alert('请先填写身份证号');
  956. e.target.value = ''; // 清空已选择的文件
  957. return;
  958. }
  959. if (!RegistrationUrl) {
  960. alert('请先上传文件');
  961. }
  962. if (!confirm('确定提交吗?')) {
  963. return;
  964. }
  965. try {
  966. const response = await fetch(requesturl + "api/update", {
  967. method: "POST",
  968. headers: {
  969. "Content-Type": "application/json"
  970. },
  971. body: JSON.stringify({
  972. url: RegistrationUrl,
  973. id_number: idNumber
  974. })
  975. })
  976. if (!response.ok) {
  977. throw new Error('信息更新失败');
  978. }
  979. const registerData = await response.json();
  980. console.log(registerData);
  981. alert(registerData.message);
  982. } catch (error) {
  983. console.error('信息更新失败:', error);
  984. alert(error.message);
  985. }
  986. }
  987. </script>
  988. </body>
  989. </html>