|
@@ -0,0 +1,179 @@
|
|
|
|
+<!DOCTYPE html>
|
|
|
|
+<html>
|
|
|
|
+ <head>
|
|
|
|
+ <meta charset="UTF-8">
|
|
|
|
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
|
|
+ <title>申泽智能科技</title>
|
|
|
|
+ <link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
|
|
+ <style>
|
|
|
|
+ body {
|
|
|
|
+ text-align: center;
|
|
|
|
+ background-color: #f2f2f2;
|
|
|
|
+ font-family: Arial, sans-serif;
|
|
|
|
+ margin: 0;
|
|
|
|
+ padding: 0;
|
|
|
|
+ }
|
|
|
|
+ #container {
|
|
|
|
+ width: auto;
|
|
|
|
+ max-width: 1000px;
|
|
|
|
+ margin: 50px auto;
|
|
|
|
+ padding: 20px;
|
|
|
|
+ background-color: #fff;
|
|
|
|
+ box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
|
|
|
|
+ border-radius: 5px;
|
|
|
|
+ background-image: url('./back.png');
|
|
|
|
+ background-size: cover;
|
|
|
|
+ background-position: top center;
|
|
|
|
+ background-repeat: no-repeat;
|
|
|
|
+ }
|
|
|
|
+ h1 {
|
|
|
|
+ font-size: 24px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: #0e0d0d;
|
|
|
|
+ margin-bottom: 30px;
|
|
|
|
+ }
|
|
|
|
+ label {
|
|
|
|
+ display: block;
|
|
|
|
+ text-align: left;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ margin-bottom: 5px;
|
|
|
|
+ margin-left: 10px;
|
|
|
|
+ }
|
|
|
|
+ textarea {
|
|
|
|
+ height: 150px;
|
|
|
|
+ }
|
|
|
|
+ input {
|
|
|
|
+ height: 30px;
|
|
|
|
+ }
|
|
|
|
+ textarea,
|
|
|
|
+ input[type="text"] {
|
|
|
|
+ width: 100%;
|
|
|
|
+ /* padding: 10px; */
|
|
|
|
+ border: 2px solid #f9ddcd8a;
|
|
|
|
+ border-radius: 5px; /* 边框圆角 */
|
|
|
|
+ resize: none;
|
|
|
|
+ margin-left: -4px;
|
|
|
|
+ margin-right: -4px;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ font-family: 'Microsoft YaHei', '微软雅黑', Arial, sans-serif;
|
|
|
|
+ }
|
|
|
|
+ input:focus,
|
|
|
|
+ textarea:focus {
|
|
|
|
+ outline: none;
|
|
|
|
+ border: 3px solid #e053018a;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ button {
|
|
|
|
+ background-color: #3f51b5;
|
|
|
|
+ color: #fff;
|
|
|
|
+ border: none;
|
|
|
|
+ padding: 10px 20px;
|
|
|
|
+ font-size: 16px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ border-radius: 3px;
|
|
|
|
+ cursor: pointer;
|
|
|
|
+ transition: background-color 0.3s ease;
|
|
|
|
+ margin-top: 10px;
|
|
|
|
+ }
|
|
|
|
+ button:hover {
|
|
|
|
+ background-color: #2f3d88;
|
|
|
|
+ }
|
|
|
|
+ .result-container {
|
|
|
|
+ margin-top: 20px;
|
|
|
|
+ }
|
|
|
|
+ .result-container h2 {
|
|
|
|
+ font-size: 18px;
|
|
|
|
+ margin-bottom: 10px;
|
|
|
|
+ color: #333;
|
|
|
|
+ }
|
|
|
|
+ .result-container p {
|
|
|
|
+ font-size: 24px;
|
|
|
|
+ font-weight: bold;
|
|
|
|
+ color: #014dff;
|
|
|
|
+ animation: blink 1.5s infinite;
|
|
|
|
+ }
|
|
|
|
+ @keyframes blink {
|
|
|
|
+ 0% {
|
|
|
|
+ opacity: 1;
|
|
|
|
+ }
|
|
|
|
+ 50% {
|
|
|
|
+ opacity: 0;
|
|
|
|
+ }
|
|
|
|
+ 100% {
|
|
|
|
+ opacity: 1;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ </style>
|
|
|
|
+ </head>
|
|
|
|
+ <body>
|
|
|
|
+ <div id="container">
|
|
|
|
+ <h1>申泽智能讲师文化活动抽奖环节</h1>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <label for="namesInput">请输入观众人名单:</label>
|
|
|
|
+ <textarea
|
|
|
|
+ id="namesInput"
|
|
|
|
+ rows="4"
|
|
|
|
+ placeholder="请使用英文逗号,分隔多个人名"
|
|
|
|
+ ></textarea>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <div>
|
|
|
|
+ <label for="excludedNamesInput"
|
|
|
|
+ >请输入被排除的主持人和讲师:</label
|
|
|
|
+ >
|
|
|
|
+ <input
|
|
|
|
+ type="text"
|
|
|
|
+ id="excludedNamesInput"
|
|
|
|
+ placeholder="请使用英文逗号,分隔多个人名"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
|
|
+ <button onclick="selectRandomName()">抽取随机人名</button>
|
|
|
|
+ <div class="result-container">
|
|
|
|
+ <h2>本次幸运观众是:</h2>
|
|
|
|
+ <p id="randomName"></p>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+
|
|
|
|
+ <script>
|
|
|
|
+ function selectRandomName() {
|
|
|
|
+ var namesInput = document.getElementById("namesInput").value;
|
|
|
|
+ var excludedNamesInput =
|
|
|
|
+ document.getElementById("excludedNamesInput").value;
|
|
|
|
+
|
|
|
|
+ var namesArray = namesInput.split(",").map((name) => name.trim());
|
|
|
|
+ var excludedNamesArray = excludedNamesInput.split(",").map((name) => name.trim());
|
|
|
|
+
|
|
|
|
+ var filteredNames = filterNames(namesArray, excludedNamesArray);
|
|
|
|
+ if (filteredNames.length === 0) {
|
|
|
|
+ document.getElementById("randomName").innerHTML = "没有可抽取的人名";
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // var randomIndex = Math.floor(Math.random() * filteredNames.length);
|
|
|
|
+ // var randomName = filteredNames[randomIndex];
|
|
|
|
+ // document.getElementById("randomName").innerHTML = randomName.trim();
|
|
|
|
+
|
|
|
|
+ var luckyPerson =
|
|
|
|
+ namesArray[Math.floor(Math.random() * namesArray.length)];
|
|
|
|
+ while (excludedNamesArray.includes(luckyPerson)) {
|
|
|
|
+ luckyPerson =
|
|
|
|
+ namesArray[Math.floor(Math.random() * namesArray.length)];
|
|
|
|
+ }
|
|
|
|
+ document.getElementById("randomName").innerHTML =
|
|
|
|
+ "恭喜 " + luckyPerson + " 中奖!";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function filterNames(namesArray, excludedNamesArray) {
|
|
|
|
+ var filteredNames = [];
|
|
|
|
+ for (var i = 0; i < namesArray.length; i++) {
|
|
|
|
+ var name = namesArray[i].trim();
|
|
|
|
+ if (name !== "" && !excludedNamesArray.includes(name)) {
|
|
|
|
+ filteredNames.push(name);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return filteredNames;
|
|
|
|
+ }
|
|
|
|
+ </script>
|
|
|
|
+ </body>
|
|
|
|
+</html>
|