index.html 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077
  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. .menu-btn-add {
  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. }
  252. .menu-btn-add:nth-last-child(1) {
  253. margin-left: 10px;
  254. background-color: #3498db;
  255. }
  256. .step-container {
  257. display: none;
  258. }
  259. .step-container.active {
  260. display: block;
  261. }
  262. .competition-grid {
  263. display: grid;
  264. grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  265. gap: 20px;
  266. margin-bottom: 30px;
  267. }
  268. .competition-card {
  269. border: 1px solid #e0e0e0;
  270. border-radius: 10px;
  271. padding: 20px;
  272. text-align: center;
  273. cursor: pointer;
  274. transition: all 0.3s;
  275. }
  276. .competition-card:hover {
  277. border-color: #1a73e8;
  278. box-shadow: 0 4px 12px rgba(26, 115, 232, 0.15);
  279. transform: translateY(-5px);
  280. }
  281. .competition-card.selected {
  282. border-color: #1a73e8;
  283. background-color: #e8f0fe;
  284. }
  285. .competition-icon {
  286. font-size: 36px;
  287. color: #1a73e8;
  288. margin-bottom: 15px;
  289. }
  290. .competition-name {
  291. font-weight: 500;
  292. color: #202124;
  293. }
  294. .btn {
  295. padding: 12px 30px;
  296. border-radius: 8px;
  297. font-size: 16px;
  298. font-weight: 500;
  299. cursor: pointer;
  300. transition: all 0.3s;
  301. border: none;
  302. }
  303. .btn-prev {
  304. background-color: #f8f9fa;
  305. color: #5f6368;
  306. }
  307. .btn-prev:hover {
  308. background-color: #e8f0fe;
  309. color: #1a73e8;
  310. }
  311. .btn-next {
  312. background-color: #1a73e8;
  313. color: white;
  314. }
  315. .btn-next:hover {
  316. background-color: #0d47a1;
  317. }
  318. .btn-submit {
  319. background-color: #34a853;
  320. color: white;
  321. }
  322. .btn-submit:hover {
  323. background-color: #2d9249;
  324. }
  325. .error {
  326. color: #ea4335;
  327. font-size: 14px;
  328. margin-top: 5px;
  329. display: none;
  330. }
  331. .button-group {
  332. display: flex;
  333. justify-content: space-between;
  334. margin-top: 30px;
  335. }
  336. .step-title {
  337. font-size: 18px;
  338. color: #202124;
  339. margin-bottom: 20px;
  340. padding-bottom: 10px;
  341. border-bottom: 1px solid #e0e0e0;
  342. }
  343. .button-Contestant{
  344. display: none;
  345. margin-right: 20px;
  346. }
  347. .button-Contestant.active{
  348. display: block;
  349. }
  350. #registerBtn1{
  351. display: none;
  352. }
  353. </style>
  354. <script src="https://sdk.amazonaws.com/js/aws-sdk-2.235.1.min.js"></script>
  355. <script>
  356. var credentials = {
  357. accessKeyId: 'AKIATLPEDU37QV5CHLMH',
  358. secretAccessKey: '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'
  359. }; //秘鑰形式的登錄上傳
  360. window.AWS.config.update(credentials);
  361. window.AWS.config.region = 'cn-northwest-1'; //設置區域
  362. </script>
  363. </head>
  364. <body>
  365. <!-- 导航栏 -->
  366. <nav>
  367. <img src="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/logo.png" alt="logo"
  368. style="width: 40px;margin-right: 15px;"></img>
  369. <div class="event-name">第六届广东省青少年创新思维及科技实践大赛(创新思维类选手报名)</div>
  370. </nav>
  371. <!-- 主内容区域 -->
  372. <div class="main-container">
  373. <!-- 左侧菜单 -->
  374. <div class="sidebar">
  375. <button class="menu-btn active" id="downloadBtn">资料下载</button>
  376. <button class="menu-btn" id="registerBtn">在线报名</button>
  377. <button class="menu-btn" id="registerBtn1">资格确认</button>
  378. </div>
  379. <!-- 右侧内容区域 -->
  380. <div class="content-area">
  381. <!-- 下载区域 -->
  382. <div class="download-section active" id="downloadSection">
  383. <h2 class="content-header">比赛资料下载</h2>
  384. <div class="download-list">
  385. <div class="download-item">
  386. <div class="file-icon">📋</div>
  387. <div class="file-info">
  388. <div class="file-title">第六届广东省青少年创新思维及科技实践大赛创新思维挑战赛</div>
  389. </div>
  390. <a target="_blank"
  391. 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"
  392. class="download-btn" download="第六届广东省青少年创新思维及科技实践大赛创新思维挑战赛.pdf">下载</a>
  393. </div>
  394. <div class="download-item">
  395. <div class="file-icon">📊</div>
  396. <div class="file-info">
  397. <div class="file-title">第六届广东省青少年创新思维及科技实践大赛的通知</div>
  398. </div>
  399. <a target="_blank"
  400. 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"
  401. class="download-btn" download="第六届广东省青少年创新思维及科技实践大赛的通知.pdf">下载</a>
  402. </div>
  403. <div class="download-item">
  404. <div class="file-icon">📄</div>
  405. <div class="file-info">
  406. <div class="file-title">报名表模板</div>
  407. <div class="file-desc">完成在线报名后,请先下载该模板,经所在学校盖章确认后,将盖章后的模板上传至【资格确认】板块,即可完成赛前准备。</div>
  408. </div>
  409. <a target="_blank"
  410. href="https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/a/%E6%8A%A5%E5%90%8D%E8%A1%A8.docx"
  411. class="download-btn" download>下载</a>
  412. </div>
  413. </div>
  414. </div>
  415. <!-- 报名区域 -->
  416. <div class="registration-section " id="registrationSection">
  417. <!-- <div class="select-type">
  418. <select id="selectType" class="form-input" required >
  419. <option value="">请选择参赛类型</option>
  420. <option value="1">桌游设计挑战类</option>
  421. <option value="2">智能体应用类</option>
  422. </select>
  423. </div> -->
  424. <div class="content-header" style="display: flex;justify-content: space-between;">
  425. <h2 style="display: inline-block;font-size: 24px;">参赛信息登记</h2>
  426. <div class="button-Contestant">
  427. <button class="menu-btn-add" onclick="removeContestant()">删除选手</button>
  428. <button class="menu-btn-add" onclick="addContestant()">添加选手</button>
  429. </div>
  430. </div>
  431. <!-- 步骤1:选择比赛类型 -->
  432. <div id="step1" class="step-container active">
  433. <div class="step-title">第一步:请选择您要报名的比赛类型</div>
  434. <div class="competition-grid">
  435. <div class="competition-card" data-id="1">
  436. <div class="competition-icon">🧮</div>
  437. <div class="competition-name">桌游设计挑战</div>
  438. </div>
  439. <div class="competition-card" data-id="2">
  440. <div class="competition-icon">💻</div>
  441. <div class="competition-name">智能体应用</div>
  442. </div>
  443. </div>
  444. <div class="button-group">
  445. <div></div> <!-- 占位 -->
  446. <button class="btn btn-next" id="nextToStep2">下一步</button>
  447. </div>
  448. </div>
  449. <!-- 步骤2:填写报名信息 -->
  450. <div id="step2" class="step-container">
  451. <div class="step-title">第二步:填写报名信息</div>
  452. <div class="form-container" id="formContainer">
  453. <input type="hidden" id="competitionType" value="">
  454. <h3>选手1:</h3>
  455. <br />
  456. <form id="registrationForm1">
  457. <div class="form-row">
  458. <div class="form-col">
  459. <div class="form-group">
  460. <label class="form-label required" for="name">姓名</label>
  461. <input type="text" id="name1" class="form-input" required>
  462. <div class="error" id="name-error1">请输入姓名</div>
  463. </div>
  464. </div>
  465. <div class="form-col">
  466. <div class="form-group">
  467. <label class="form-label required" for="gender">性别</label>
  468. <select id="gender1" class="form-input" required>
  469. <option value="">请选择</option>
  470. <option value="1">男</option>
  471. <option value="2">女</option>
  472. </select>
  473. <div class="error" id="gender-error1">请选择性别</div>
  474. </div>
  475. </div>
  476. </div>
  477. <div class="form-row">
  478. <div class="form-col">
  479. <div class="form-group">
  480. <label class="form-label required" for="ethnicity">民族</label>
  481. <input type="text" id="ethnicity1" class="form-input" required>
  482. <div class="error" id="ethnicity-error1">请输入民族</div>
  483. </div>
  484. </div>
  485. <div class="form-col">
  486. <div class="form-group">
  487. <label class="form-label required" for="birthdate">出生年月</label>
  488. <input type="date" id="birthdate1" class="form-input" required>
  489. <div class="error" id="birthdate-error1">请选择出生年月</div>
  490. </div>
  491. </div>
  492. </div>
  493. <div class="form-row">
  494. <div class="form-col">
  495. <div class="form-group">
  496. <label class="form-label required" for="email">电子邮箱</label>
  497. <input type="email" id="email1" class="form-input" required>
  498. <div class="error" id="email-error1">请输入有效的电子邮箱</div>
  499. </div>
  500. </div>
  501. <div class="form-col">
  502. <div class="form-group">
  503. <label class="form-label required" for="idNumber">身份证号码</label>
  504. <input type="text" id="idNumber1" class="form-input" required
  505. pattern="\d{17}[\dXx]">
  506. <div class="error" id="idNumber-error1">请输入18位身份证号码</div>
  507. </div>
  508. </div>
  509. </div>
  510. <div class="form-row">
  511. <div class="form-col">
  512. <div class="form-group">
  513. <label class="form-label required" for="group">组别</label>
  514. <select id="group1" class="form-input" required>
  515. <option value="">请选择</option>
  516. <option value="1">小学低龄</option>
  517. <option value="2">小学高龄</option>
  518. <option value="3">中学</option>
  519. <option value="4">高校</option>
  520. </select>
  521. <div class="error" id="group-error1">请选择组别</div>
  522. </div>
  523. </div>
  524. <div class="form-col">
  525. <div class="form-group">
  526. <label class="form-label required" for="grade">年级</label>
  527. <input type="text" id="grade1" class="form-input" required>
  528. <div class="error" id="grade-error1">请输入年级</div>
  529. </div>
  530. </div>
  531. </div>
  532. <div class="form-row">
  533. <div class="form-col">
  534. <div class="form-group">
  535. <label class="form-label required" for="school">所在学校</label>
  536. <input type="text" id="school1" class="form-input" required>
  537. <div class="error" id="school-error1">请输入学校名称</div>
  538. </div>
  539. </div>
  540. <div class="form-col">
  541. <div class="form-group">
  542. <label class="form-label required" for="schoolRegion">学校所在地区</label>
  543. <input type="text" id="schoolRegion1" class="form-input" required
  544. placeholder="省/市/区">
  545. <div class="error" id="schoolRegion-error1">请输入学校所在地区</div>
  546. </div>
  547. </div>
  548. </div>
  549. <div class="form-group">
  550. <label class="form-label required" for="phone">联系电话</label>
  551. <input type="tel" id="phone1" class="form-input" required pattern="[0-9]{11}">
  552. <div class="error" id="phone-error1">请输入11位手机号码</div>
  553. </div>
  554. </form>
  555. </div>
  556. <div class="button-group">
  557. <button type="button" class="btn btn-prev" id="prevToStep1">上一步</button>
  558. <button type="submit" class="btn btn-submit" onclick="submitData()">提交报名</button>
  559. </div>
  560. </div>
  561. </div>
  562. <!-- 上传报名表单 -->
  563. <div class="registration-section" id="uploadSection">
  564. <h2 class="content-header">上传报名表</h2>
  565. <div class="download-list">
  566. <div class="form-row">
  567. <div class="form-col">
  568. <div class="form-group">
  569. <label class="form-label required" for="idNumber">身份证号码</label>
  570. <input type="text" id="id_number" class="form-input" required pattern="\d{17}[\dXx]"
  571. placeholder="请填写在线报名时,团队内任一选手的身份证号码">
  572. </div>
  573. </div>
  574. </div>
  575. <div class="file-upload">
  576. <label class="form-label required" for="photo">上传文件</label>
  577. <input type="file" id="registration" required>
  578. </div>
  579. <button type="submit" class="submit-btn" onclick="submitRegistration()">提交报名表</button>
  580. </div>
  581. </div>
  582. </div>
  583. </div>
  584. <script>
  585. const requesturl = window.location.href;
  586. console.log("requesturl:", requesturl);
  587. const nowTime = new Date();
  588. const givenTime = new Date("2025-10-13")
  589. if(givenTime - nowTime > 0){
  590. document.getElementById('registerBtn1').style.display = "none";
  591. }else{
  592. document.getElementById('registerBtn1').style.display = "block";
  593. }
  594. // 切换下载和报名区域
  595. document.getElementById('downloadBtn').addEventListener('click', function () {
  596. document.getElementById('downloadBtn').classList.add('active');
  597. document.getElementById('registerBtn').classList.remove('active');
  598. document.getElementById('registerBtn1').classList.remove('active');
  599. document.getElementById('downloadSection').classList.add('active');
  600. document.getElementById('registrationSection').classList.remove('active');
  601. document.getElementById('uploadSection').classList.remove('active');
  602. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  603. });
  604. document.getElementById('registerBtn1').addEventListener('click', function () {
  605. document.getElementById('registerBtn1').classList.add('active');
  606. document.getElementById('downloadBtn').classList.remove('active');
  607. document.getElementById('registerBtn').classList.remove('active');
  608. document.getElementById('downloadSection').classList.remove('active');
  609. document.getElementById('registrationSection').classList.remove('active');
  610. document.getElementById('uploadSection').classList.add('active');
  611. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  612. });
  613. let buttonContestant = false
  614. document.getElementById('registerBtn').addEventListener('click', function () {
  615. document.getElementById('registerBtn').classList.add('active');
  616. document.getElementById('downloadBtn').classList.remove('active');
  617. document.getElementById('registerBtn1').classList.remove('active');
  618. document.getElementById('registrationSection').classList.add('active');
  619. document.getElementById('downloadSection').classList.remove('active');
  620. document.getElementById('uploadSection').classList.remove('active');
  621. console.log("selectedCompetitionId:", selectedCompetitionId);
  622. if(buttonContestant){
  623. document.getElementsByClassName("button-Contestant")[0].classList.add('active');
  624. }else{
  625. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  626. }
  627. });
  628. let uploadFileUrl = ''
  629. // 比赛类型选择
  630. const competitionCards = document.querySelectorAll('.competition-card');
  631. let selectedCompetitionId = null;
  632. competitionCards.forEach(card => {
  633. card.addEventListener('click', function () {
  634. // 移除所有卡片的selected类
  635. competitionCards.forEach(c => {
  636. c.classList.remove('selected');
  637. });
  638. // 添加当前卡片的selected类
  639. this.classList.add('selected');
  640. // 存储选择的比赛ID
  641. selectedCompetitionId = this.getAttribute('data-id');
  642. });
  643. });
  644. // 步骤切换
  645. document.getElementById('nextToStep2').addEventListener('click', function () {
  646. if (!selectedCompetitionId) {
  647. alert('请先选择比赛类型');
  648. return;
  649. }
  650. // 切换到步骤2
  651. document.getElementById('step1').classList.remove('active');
  652. document.getElementById('step2').classList.add('active');
  653. document.getElementsByClassName("button-Contestant")[0].classList.add('active');
  654. buttonContestant = true
  655. });
  656. document.getElementById('prevToStep1').addEventListener('click', function () {
  657. // 切换回步骤1
  658. document.getElementById('step2').classList.remove('active');
  659. document.getElementById('step1').classList.add('active');
  660. document.getElementsByClassName("button-Contestant")[0].classList.remove('active');
  661. buttonContestant = false
  662. });
  663. let num = 1;
  664. function addContestant() {
  665. num = num + 1;
  666. const html = document.getElementById('formContainer');
  667. const h3Create = document.createElement('h3');
  668. h3Create.innerText = `选手${num}:`;
  669. html.appendChild(h3Create);
  670. const brCreate = document.createElement('br');
  671. html.appendChild(brCreate);
  672. const formCrate = document.createElement('form');
  673. formCrate.id = `registrationForm${num}`;
  674. formCrate.innerHTML = `<div class="form-row">
  675. <div class="form-col">
  676. <div class="form-group">
  677. <label class="form-label required" for="name">姓名</label>
  678. <input type="text" id="name${num}" class="form-input" required>
  679. <div class="error" id="name-error${num}">请输入姓名</div>
  680. </div>
  681. </div>
  682. <div class="form-col">
  683. <div class="form-group">
  684. <label class="form-label required" for="gender">性别</label>
  685. <select id="gender${num}" class="form-input" required>
  686. <option value="">请选择</option>
  687. <option value="1">男</option>
  688. <option value="2">女</option>
  689. </select>
  690. <div class="error" id="gender-error${num}">请选择性别</div>
  691. </div>
  692. </div>
  693. </div>
  694. <div class="form-row">
  695. <div class="form-col">
  696. <div class="form-group">
  697. <label class="form-label required" for="ethnicity">民族</label>
  698. <input type="text" id="ethnicity${num}" class="form-input" required>
  699. <div class="error" id="ethnicity-error${num}">请输入民族</div>
  700. </div>
  701. </div>
  702. <div class="form-col">
  703. <div class="form-group">
  704. <label class="form-label required" for="birthdate">出生年月</label>
  705. <input type="date" id="birthdate${num}" class="form-input" required>
  706. <div class="error" id="birthdate-error${num}">请选择出生年月</div>
  707. </div>
  708. </div>
  709. </div>
  710. <div class="form-row">
  711. <div class="form-col">
  712. <div class="form-group">
  713. <label class="form-label required" for="email">电子邮箱</label>
  714. <input type="email" id="email${num}" class="form-input" required>
  715. <div class="error" id="email-error${num}">请输入有效的电子邮箱</div>
  716. </div>
  717. </div>
  718. <div class="form-col">
  719. <div class="form-group">
  720. <label class="form-label required" for="idNumber">身份证号码</label>
  721. <input type="text" id="idNumber${num}" class="form-input" required pattern="\d{17}[\dXx]">
  722. <div class="error" id="idNumber-error${num}">请输入18位身份证号码</div>
  723. </div>
  724. </div>
  725. </div>
  726. <div class="form-row">
  727. <div class="form-col">
  728. <div class="form-group">
  729. <label class="form-label required" for="group">组别</label>
  730. <select id="group${num}" class="form-input" required>
  731. <option value="">请选择</option>
  732. <option value="1">小学低龄</option>
  733. <option value="2">小学高龄</option>
  734. <option value="3">中学</option>
  735. <option value="4">高校</option>
  736. </select>
  737. <div class="error" id="group-error${num}">请选择组别</div>
  738. </div>
  739. </div>
  740. <div class="form-col">
  741. <div class="form-group">
  742. <label class="form-label required" for="grade">年级</label>
  743. <input type="text" id="grade${num}" class="form-input" required>
  744. <div class="error" id="grade-error${num}">请输入年级</div>
  745. </div>
  746. </div>
  747. </div>
  748. <div class="form-row">
  749. <div class="form-col">
  750. <div class="form-group">
  751. <label class="form-label required" for="school">所在学校</label>
  752. <input type="text" id="school${num}" class="form-input" required>
  753. <div class="error" id="school-error${num}">请输入学校名称</div>
  754. </div>
  755. </div>
  756. <div class="form-col">
  757. <div class="form-group">
  758. <label class="form-label required" for="schoolRegion">学校所在地区</label>
  759. <input type="text" id="schoolRegion${num}" class="form-input" required
  760. placeholder="省/市/区">
  761. <div class="error" id="schoolRegion-error${num}">请输入学校所在地区</div>
  762. </div>
  763. </div>
  764. </div>
  765. <div class="form-group">
  766. <label class="form-label required" for="phone">联系电话</label>
  767. <input type="tel" id="phone${num}" class="form-input" required pattern="[0-9]{11}">
  768. <div class="error" id="phone-error${num}">请输入11位手机号码</div>
  769. </div>`;
  770. html.appendChild(formCrate);
  771. }
  772. function removeContestant() {
  773. if (num <= 1) {
  774. alert("至少需要保留一名选手");
  775. return;
  776. }
  777. const html = document.getElementById('formContainer');
  778. // 移除最后一个选手的 h3、br 和 form
  779. // h3
  780. let lastH3 = html.querySelector(`h3:last-of-type`);
  781. if (lastH3) html.removeChild(lastH3);
  782. // br
  783. let lastBr = html.querySelector(`br:last-of-type`);
  784. if (lastBr) html.removeChild(lastBr);
  785. // form
  786. let lastForm = html.querySelector(`form#registrationForm${num}`);
  787. if (lastForm) html.removeChild(lastForm);
  788. num = num - 1;
  789. }
  790. async function submitData() {
  791. const requiredFields = ['name', 'gender', 'ethnicity', 'birthdate', 'email',
  792. 'idNumber', 'group', 'grade', 'school', 'schoolRegion', 'phone',];
  793. let formData = [];
  794. let idNumber = '';
  795. let idError = '';
  796. let phone = '';
  797. let phoneError = '';
  798. for (let i = 1; i <= num; i++) {
  799. let element = null;
  800. let errorElement = null;
  801. let isValid = true;
  802. requiredFields.forEach(field => {
  803. element = document.getElementById(field + i);
  804. errorElement = document.getElementById(`${field}-error` + i);
  805. if (!element.value) {
  806. errorElement.style.display = 'block';
  807. isValid = false;
  808. } else {
  809. errorElement.style.display = 'none';
  810. }
  811. });
  812. // 验证身份证格式
  813. idNumber = document.getElementById('idNumber' + i);
  814. idError = document.getElementById('idNumber-error' + i);
  815. if (!/^\d{17}[\dXx]$/.test(idNumber.value)) {
  816. idError.style.display = 'block';
  817. isValid = false;
  818. } else {
  819. idError.style.display = 'none';
  820. }
  821. // 验证手机号格式
  822. phone = document.getElementById('phone' + i);
  823. phoneError = document.getElementById('phone-error' + i);
  824. if (!/^[0-9]{11}$/.test(phone.value)) {
  825. phoneError.style.display = 'block';
  826. isValid = false;
  827. } else {
  828. phoneError.style.display = 'none';
  829. }
  830. if (!isValid) {
  831. alert(`选手${num}填写信息有误,请重新填写`);
  832. return;
  833. };
  834. formData.push({
  835. name: document.getElementById('name' + i).value,
  836. gender: document.getElementById('gender' + i).value,
  837. ethnicity: document.getElementById('ethnicity' + i).value,
  838. birthdate: document.getElementById('birthdate' + i).value,
  839. email: document.getElementById('email' + i).value,
  840. id_number: document.getElementById('idNumber' + i).value,
  841. group: document.getElementById('group' + i).value,
  842. grade: document.getElementById('grade' + i).value,
  843. school: document.getElementById('school' + i).value,
  844. schoolRegion: document.getElementById('schoolRegion' + i).value,
  845. phone: document.getElementById('phone' + i).value,
  846. })
  847. }
  848. try {
  849. // 收集表单数据
  850. const formDataObj = {
  851. type: selectedCompetitionId, // 报名类型,1桌游,2智能体
  852. uploadUrl: uploadFileUrl, // 上传文件的URL
  853. idCard: formData.map(item => item.id_number).join(","), // 选手身份证号拼接
  854. registrationFormUrl: "", // 报名表上传URL
  855. user: JSON.stringify(formData),
  856. };
  857. if (!confirm('提交之后无法再修改信息,是否确认提交?')) {
  858. return;
  859. }
  860. // 发送报名信息请求
  861. const registerResponse = await fetch(requesturl + 'api/user', {
  862. method: 'POST',
  863. headers: {
  864. 'Content-Type': 'application/json'
  865. },
  866. body: JSON.stringify(formDataObj)
  867. });
  868. if (!registerResponse.ok) {
  869. throw new Error('报名提交失败');
  870. }
  871. const registerData = await registerResponse.json();
  872. console.log(registerData);
  873. if (registerData.status == "ok") {
  874. alert("报名完成,审核情况会通过邮箱通知,请注意邮箱信息");
  875. } else {
  876. alert(registerData.message);
  877. }
  878. // document.getElementById('registrationForm').reset();
  879. } catch (error) {
  880. console.error('提交错误:', error);
  881. alert(`报名失败: ${error.message}`);
  882. }
  883. }
  884. let RegistrationUrl = "";
  885. document.getElementById('registration').addEventListener('change', function (e) {
  886. const idNumber = document.getElementById('id_number').value;
  887. if (!idNumber) {
  888. alert('请先填写身份证号');
  889. e.target.value = ''; // 清空已选择的文件
  890. return;
  891. }
  892. const file = e.target.files[0];
  893. if (!file) return;
  894. console.log('选择文件:', file);
  895. const fileName = `${idNumber}/${file.name}`;
  896. var bucket = new window.AWS.S3({ params: { Bucket: 'ccrb' } });
  897. var params = {
  898. Key: fileName,
  899. ContentType: file.type,
  900. Body: file,
  901. 'Access-Control-Allow-Credentials': '*',
  902. 'ACL': 'public-read'
  903. };
  904. bucket.upload(params, function (err, data) {
  905. if (err) {
  906. console.error('上传失败:', err);
  907. alert('文件上传失败');
  908. } else {
  909. console.log('上传成功:', data);
  910. RegistrationUrl = data.Location;
  911. alert('文件上传成功');
  912. }
  913. });
  914. });
  915. async function submitRegistration() {
  916. const idNumber = document.getElementById('id_number').value;
  917. if (!idNumber) {
  918. alert('请先填写身份证号');
  919. e.target.value = ''; // 清空已选择的文件
  920. return;
  921. }
  922. if (!RegistrationUrl) {
  923. alert('请先上传文件');
  924. }
  925. if (!confirm('确定提交吗?')) {
  926. return;
  927. }
  928. try {
  929. const response = await fetch(requesturl + "api/update", {
  930. method: "POST",
  931. headers: {
  932. "Content-Type": "application/json"
  933. },
  934. body: JSON.stringify({
  935. url: RegistrationUrl,
  936. id_number: idNumber
  937. })
  938. })
  939. if (!response.ok) {
  940. throw new Error('信息更新失败');
  941. }
  942. const registerData = await response.json();
  943. console.log(registerData);
  944. alert(registerData.message);
  945. } catch (error) {
  946. console.error('信息更新失败:', error);
  947. alert(error.message);
  948. }
  949. }
  950. </script>
  951. </body>
  952. </html>