Compare commits
No commits in common. 'FRONT_a' and 'main' have entirely different histories.
@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<annotationProcessing>
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="attendance" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="attendance" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AliControlFlowStatementWithoutBraces" enabled="true" level="WEAK WARNING" enabled_by_default="true" editorAttributes="INFO_ATTRIBUTES" />
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://repo.maven.apache.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="https://maven.aliyun.com/repository/public" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-17" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,99 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3b22332f-54e5-44db-aa06-c42dcb64501b" name="更改" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/AttendanceApplication.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/config/SecurityConfig.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/controller/RollCallController.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/controller/StudentController.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/controller/TeacherController.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/entity/PointsRequest.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/entity/RollCallResponse.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/entity/RollCallSettings.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/entity/Student.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/entity/Teacher.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/mapper/StudentMapper.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/mapper/TeacherMapper.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/RollCallService.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/StudentService.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/TeacherService.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/impl/RollCallServiceImpl.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/impl/StudentServiceImpl.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/service/impl/TeacherServiceImpl.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/com/example/attendance/util/JWTUtil.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/application.properties" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/example/attendance/AttendanceApplicationTests.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/example/attendance/PasswordEncryptor.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/example/attendance/RollCallServiceImplTest.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/example/attendance/StudentServiceImplTest.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/test/java/com/example/attendance/TeacherServiceImplTest.java" beforeDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 3
|
||||
}</component>
|
||||
<component name="ProjectId" id="2n7TontcBHYq0FZUtB4aOJMP8nL" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="openDirectoriesWithSingleClick" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"git-widget-placeholder": "main",
|
||||
"last_opened_file_path": "C:/Users/onelastkiss/Desktop/项目/bigbigmarket",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration default="true" type="JetRunConfigurationType">
|
||||
<module name="BACKEND_ATTENDANCE" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType">
|
||||
<module name="BACKEND_ATTENDANCE" />
|
||||
<option name="filePath" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="3b22332f-54e5-44db-aa06-c42dcb64501b" name="更改" comment="" />
|
||||
<created>1728323291653</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1728323291653</updated>
|
||||
<workItem from="1728323292792" duration="28000" />
|
||||
<workItem from="1728372981142" duration="128000" />
|
||||
<workItem from="1728379806368" duration="345000" />
|
||||
<workItem from="1728386733302" duration="673000" />
|
||||
<workItem from="1728402818365" duration="864000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,141 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.3</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<groupId>com.example</groupId>
|
||||
<artifactId>attendance</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>attendance</name>
|
||||
<description>attendance</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- Spring Boot Starter Web -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis Starter -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot DevTools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- MySQL Connector -->
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Lombok -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Boot Starter Test -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis Starter Test -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter-test</artifactId>
|
||||
<version>3.0.3</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- EasyExcel -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Spring Security for password encryption -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- JWT Library -->
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-api</artifactId>
|
||||
<version>0.11.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-impl</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.jsonwebtoken</groupId>
|
||||
<artifactId>jjwt-jackson</artifactId>
|
||||
<version>0.11.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- BCrypt for password hashing -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- Compiler Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<release>17</release> <!-- 设置 release 参数来简化配置 -->
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- Spring Boot Maven Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class AttendanceApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AttendanceApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package com.example.attendance.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.security.web.SecurityFilterChain;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity
|
||||
public class SecurityConfig {
|
||||
@Bean
|
||||
public PasswordEncoder passwordEncoder() {
|
||||
return new BCryptPasswordEncoder();
|
||||
}
|
||||
@Bean
|
||||
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
|
||||
http
|
||||
.csrf(csrf -> csrf.disable()) // 关闭 CSRF 保护
|
||||
.authorizeHttpRequests(authz -> authz
|
||||
.requestMatchers("/api/teacher/register", "/api/teacher/login").permitAll() // 允许注册和登录接口匿名访问
|
||||
.anyRequest().authenticated() // 其他请求需要认证
|
||||
)
|
||||
.formLogin(form -> form.disable()) // 关闭表单登录
|
||||
.httpBasic(httpBasic -> httpBasic.disable()); // 关闭基本认证
|
||||
|
||||
return http.build();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.example.attendance.controller;
|
||||
|
||||
import com.example.attendance.entity.RollCallResponse;
|
||||
import com.example.attendance.entity.RollCallSettings;
|
||||
import com.example.attendance.entity.Student;
|
||||
import com.example.attendance.service.RollCallService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/rollcall")
|
||||
public class RollCallController {
|
||||
|
||||
private final RollCallService rollCallService;
|
||||
|
||||
public RollCallController(RollCallService rollCallService) {
|
||||
this.rollCallService = rollCallService;
|
||||
}
|
||||
|
||||
@PostMapping("/start")
|
||||
public RollCallResponse startRollCall(@RequestBody List<Student> students, @RequestBody RollCallSettings settings) {
|
||||
return rollCallService.startRollCall(students, settings);
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.example.attendance.controller;
|
||||
|
||||
import com.example.attendance.service.TeacherService;
|
||||
import com.example.attendance.service.impl.TeacherServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@RestController
|
||||
@RequestMapping("/api/teacher")
|
||||
public class TeacherController {
|
||||
|
||||
@Autowired
|
||||
private TeacherService teacherService;
|
||||
|
||||
// 注册接口
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity<String> register(@RequestParam String username, @RequestParam String password) {
|
||||
try {
|
||||
// 调用 teacherService 的 register 方法注册用户
|
||||
teacherService.register(username, password);
|
||||
return ResponseEntity.ok("注册成功"); // 成功时返回 200 状态和消息
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body("注册失败: " + e.getMessage()); // 失败时返回 400 状态和错误信息
|
||||
}
|
||||
}
|
||||
|
||||
// 登录接口
|
||||
@PostMapping("/login")
|
||||
public ResponseEntity<String> login(@RequestParam String username, @RequestParam String password) {
|
||||
try {
|
||||
// 调用 teacherService 的 login 方法登录
|
||||
String token = teacherService.login(username, password);
|
||||
return ResponseEntity.ok("登录成功, Token: " + token); // 成功时返回 200 状态和 JWT token
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.badRequest().body("登录失败: " + e.getMessage()); // 失败时返回 400 状态和错误信息
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.example.attendance.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class PointsRequest {
|
||||
private BigDecimal pointsDelta;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.example.attendance.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class RollCallResponse {
|
||||
private String studentId;
|
||||
private String name;
|
||||
private BigDecimal points;
|
||||
private String message; // 显示结果信息
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.example.attendance.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class RollCallSettings {
|
||||
private String rollCallMode; // 点名("点名")或提问("提问")
|
||||
private String triggerRandomEvent; // 触发("触发")或不触发("不触发")随机事件
|
||||
private String wheelOfFortune; // 开启("是")或关闭("否")命运轮盘
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.example.attendance.entity;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class Student {
|
||||
private Long id;
|
||||
private String studentNumber; // 学号
|
||||
private String name; // 姓名
|
||||
private BigDecimal points; // 积分
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.example.attendance.entity;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Data
|
||||
public class Teacher {
|
||||
private Long id;
|
||||
private String username;
|
||||
private String password;
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package com.example.attendance.mapper;
|
||||
|
||||
import com.example.attendance.entity.Student;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface StudentMapper {
|
||||
|
||||
@Select("SELECT * FROM student WHERE id = #{id}")
|
||||
Student findById(Long id);
|
||||
|
||||
@Select("SELECT * FROM student WHERE student_number = #{studentNumber}")
|
||||
Student findByStudentNumber(String studentNumber);
|
||||
|
||||
@Select("SELECT * FROM student")
|
||||
List<Student> findAll();
|
||||
|
||||
@Insert("INSERT INTO student (student_number, name, points) VALUES (#{studentNumber}, #{name}, #{points})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
void save(Student student);
|
||||
|
||||
@Update("UPDATE student SET name = #{name}, points = #{points} WHERE student_number = #{studentNumber}")
|
||||
void update(Student student);
|
||||
|
||||
@Delete("DELETE FROM student WHERE id = #{id}")
|
||||
void delete(Long id);
|
||||
|
||||
@Insert({
|
||||
"<script>",
|
||||
"INSERT INTO student (student_number, name, points) VALUES ",
|
||||
"<foreach collection='students' item='student' separator=','>",
|
||||
"(#{student.studentNumber}, #{student.name}, #{student.points})",
|
||||
"</foreach>",
|
||||
"</script>"
|
||||
})
|
||||
void saveStudents(List<Student> students);
|
||||
|
||||
/**
|
||||
* 按积分从高到低排序的分页查询
|
||||
* @param offset 分页查询的偏移量
|
||||
* @param size 每页显示的记录数
|
||||
* @return 排行榜学生列表
|
||||
*/
|
||||
@Select("SELECT * FROM student ORDER BY points DESC LIMIT #{size} OFFSET #{offset}")
|
||||
List<Student> findStudentsByRanking(@Param("offset") int offset, @Param("size") int size);
|
||||
|
||||
/**
|
||||
* 查询所有学生的姓名
|
||||
* @return 学生姓名的字符串数组
|
||||
*/
|
||||
@Select("SELECT name FROM student")
|
||||
String[] findAllStudentNames();
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.example.attendance.mapper;
|
||||
|
||||
import com.example.attendance.entity.Teacher;
|
||||
import org.apache.ibatis.annotations.Insert;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
@Mapper
|
||||
public interface TeacherMapper {
|
||||
|
||||
@Insert("INSERT INTO teacher (username, password) VALUES (#{username}, #{password})")
|
||||
void save(Teacher teacher);
|
||||
|
||||
@Select("SELECT * FROM teacher WHERE username = #{username}")
|
||||
Teacher findByUsername(String username);
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.example.attendance.service;
|
||||
import com.example.attendance.entity.RollCallResponse;
|
||||
import com.example.attendance.entity.RollCallSettings;
|
||||
import com.example.attendance.entity.Student;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface RollCallService {
|
||||
RollCallResponse startRollCall(List<Student> students, RollCallSettings settings); // 处理点名逻辑
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.attendance.service;
|
||||
|
||||
import com.example.attendance.entity.Student;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
public interface StudentService {
|
||||
void importStudents(MultipartFile file) throws Exception ;
|
||||
void exportStudents(OutputStream outputStream) throws Exception;
|
||||
void adjustPoints(String studentNumber, BigDecimal pointsDelta);
|
||||
List<Student> getStudentRanking(int page, int size);
|
||||
Student findById(Long id);
|
||||
Student findByStudentNumber(String studentNumber);
|
||||
List<Student> findAll();
|
||||
void save(Student student);
|
||||
void update(Student student);
|
||||
void delete(Long id);
|
||||
|
||||
String[] getAllStudentNames();
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.example.attendance.service;
|
||||
|
||||
public interface TeacherService {
|
||||
|
||||
/**
|
||||
* 注册新教师
|
||||
*
|
||||
* @param username 教师的用户名
|
||||
* @param password 教师的密码
|
||||
* @throws Exception 注册过程中可能抛出的异常
|
||||
*/
|
||||
void register(String username, String password) throws Exception;
|
||||
|
||||
/**
|
||||
* 教师登录
|
||||
*
|
||||
* @param username 教师的用户名
|
||||
* @param password 教师的密码
|
||||
* @return 返回 JWT token
|
||||
* @throws Exception 登录失败时抛出的异常
|
||||
*/
|
||||
String login(String username, String password) throws Exception;
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package com.example.attendance.service.impl;
|
||||
|
||||
import com.example.attendance.mapper.TeacherMapper;
|
||||
import com.example.attendance.entity.Teacher;
|
||||
import com.example.attendance.service.TeacherService;
|
||||
import com.example.attendance.util.JWTUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class TeacherServiceImpl implements TeacherService {
|
||||
|
||||
@Autowired
|
||||
private TeacherMapper teacherMapper;
|
||||
|
||||
@Autowired
|
||||
private PasswordEncoder passwordEncoder; // 使用 PasswordEncoder 接口
|
||||
|
||||
@Override
|
||||
public void register(String username, String password) {
|
||||
Teacher teacher = new Teacher();
|
||||
teacher.setUsername(username);
|
||||
teacher.setPassword(passwordEncoder.encode(password)); // 密码加密
|
||||
teacherMapper.save(teacher);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String login(String username, String password) {
|
||||
Teacher teacher = teacherMapper.findByUsername(username);
|
||||
if (teacher == null || !passwordEncoder.matches(password, teacher.getPassword())) {
|
||||
throw new RuntimeException("用户名或密码不正确");
|
||||
}
|
||||
// 返回 JWT token
|
||||
return JWTUtil.generateToken(teacher);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package com.example.attendance.util;
|
||||
|
||||
import com.example.attendance.entity.Teacher;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.SignatureAlgorithm;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
import java.util.Date;
|
||||
|
||||
public class JWTUtil {
|
||||
|
||||
private static final SecretKey SECRET_KEY = Keys.secretKeyFor(SignatureAlgorithm.HS256);
|
||||
|
||||
// 生成 Token
|
||||
public static String generateToken(Teacher teacher) {
|
||||
return Jwts.builder()
|
||||
.setSubject(teacher.getUsername()) // 设置 Token 主题(用户名)
|
||||
.setIssuedAt(new Date()) // 设置 Token 签发时间
|
||||
.setExpiration(new Date(System.currentTimeMillis() + 60 * 60 * 1000)) // Token 有效期 1 小时
|
||||
.signWith(SignatureAlgorithm.HS256, SECRET_KEY) // 使用 HS256 签名算法和 SECRET_KEY 签名
|
||||
.compact();
|
||||
}
|
||||
|
||||
// 从 Token 中提取声明
|
||||
public static Claims extractClaims(String token) {
|
||||
try {
|
||||
return Jwts.parser()
|
||||
.setSigningKey(SECRET_KEY) // 设置签名密钥
|
||||
.parseClaimsJws(token) // 解析 Token
|
||||
.getBody();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Invalid JWT token", e); // 捕获并抛出异常
|
||||
}
|
||||
}
|
||||
|
||||
// 从 Token 中获取用户名
|
||||
public static String getUsernameFromToken(String token) {
|
||||
return extractClaims(token).getSubject();
|
||||
}
|
||||
|
||||
// 判断 Token 是否过期
|
||||
public static boolean isTokenExpired(String token) {
|
||||
return extractClaims(token).getExpiration().before(new Date());
|
||||
}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
spring.application.name=attendance
|
||||
spring.datasource.url=jdbc:mysql://localhost:3306/roll_call_system
|
||||
spring.datasource.username=root
|
||||
spring.datasource.password=123456789jk
|
||||
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||
|
||||
|
Before Width: | Height: | Size: 30 MiB After Width: | Height: | Size: 27 MiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
After Width: | Height: | Size: 134 KiB |
@ -0,0 +1,14 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/点名.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>点点小助手</title>
|
||||
<script type="module" crossorigin src="/assets/index-Cb5FnDWH.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-B1hDzaLh.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
Before Width: | Height: | Size: 649 KiB After Width: | Height: | Size: 649 KiB |
After Width: | Height: | Size: 1.9 KiB |
@ -0,0 +1,24 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
|
||||
public class PasswordEncryptor {
|
||||
public static void main(String[] args) {
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
|
||||
// 这里使用你希望的明文密码
|
||||
String rawPassword1 = "123456";
|
||||
String rawPassword2 = "654321";
|
||||
String rawPassword3 = "admin123";
|
||||
|
||||
// 加密密码
|
||||
String encodedPassword1 = passwordEncoder.encode(rawPassword1);
|
||||
String encodedPassword2 = passwordEncoder.encode(rawPassword2);
|
||||
String encodedPassword3 = passwordEncoder.encode(rawPassword3);
|
||||
|
||||
// 打印加密后的密码
|
||||
System.out.println("teacher1 密码: " + encodedPassword1);
|
||||
System.out.println("teacher2 密码: " + encodedPassword2);
|
||||
System.out.println("teacher3 密码: " + encodedPassword3);
|
||||
}
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import com.example.attendance.entity.Student;
|
||||
import com.example.attendance.mapper.StudentMapper;
|
||||
import com.example.attendance.service.impl.StudentServiceImpl;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class StudentServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private StudentServiceImpl studentService;
|
||||
|
||||
@Mock
|
||||
private StudentMapper studentMapper;
|
||||
|
||||
@Mock
|
||||
private MultipartFile file;
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
MockitoAnnotations.openMocks(this);
|
||||
}
|
||||
|
||||
@Test
|
||||
void testImportStudents() throws Exception {
|
||||
// 模拟 Excel 文件内容
|
||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||
var sheet = workbook.createSheet("Sheet 1");
|
||||
var header = sheet.createRow(0);
|
||||
header.createCell(0).setCellValue("Student Number");
|
||||
header.createCell(1).setCellValue("Name");
|
||||
header.createCell(2).setCellValue("Points");
|
||||
|
||||
var row1 = sheet.createRow(1);
|
||||
row1.createCell(0).setCellValue("1");
|
||||
row1.createCell(1).setCellValue("Alice");
|
||||
row1.createCell(2).setCellValue(50);
|
||||
|
||||
var row2 = sheet.createRow(2);
|
||||
row2.createCell(0).setCellValue("2");
|
||||
row2.createCell(1).setCellValue("Bob");
|
||||
row2.createCell(2).setCellValue(80);
|
||||
|
||||
// 将 workbook 写入 ByteArrayOutputStream
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
workbook.write(outputStream);
|
||||
workbook.close(); // 关闭 workbook
|
||||
|
||||
// 将 ByteArrayOutputStream 转换为 InputStream
|
||||
InputStream inputStream = new ByteArrayInputStream(outputStream.toByteArray());
|
||||
when(file.getInputStream()).thenReturn(inputStream);
|
||||
|
||||
// 调用 importStudents 方法
|
||||
studentService.importStudents(file);
|
||||
|
||||
// 验证是否保存了学生数据
|
||||
verify(studentMapper, times(1)).saveStudents(anyList());
|
||||
}
|
||||
|
||||
// 测试调整积分
|
||||
@Test
|
||||
void testAdjustPoints() {
|
||||
// 模拟学生数据
|
||||
Student student = new Student();
|
||||
student.setStudentNumber("1");
|
||||
student.setPoints(BigDecimal.valueOf(50));
|
||||
|
||||
when(studentMapper.findByStudentNumber("1")).thenReturn(student);
|
||||
|
||||
// 调用 adjustPoints 方法
|
||||
studentService.adjustPoints("1", BigDecimal.valueOf(10));
|
||||
|
||||
// 验证是否更新了学生数据
|
||||
assertEquals(BigDecimal.valueOf(60), student.getPoints());
|
||||
verify(studentMapper, times(1)).update(student);
|
||||
}
|
||||
|
||||
// 测试获取学生排行榜
|
||||
@Test
|
||||
void testGetStudentRanking() {
|
||||
List<Student> mockStudents = new ArrayList<>();
|
||||
Student student1 = new Student();
|
||||
student1.setName("Alice");
|
||||
student1.setPoints(BigDecimal.valueOf(100));
|
||||
|
||||
Student student2 = new Student();
|
||||
student2.setName("Bob");
|
||||
student2.setPoints(BigDecimal.valueOf(90));
|
||||
|
||||
mockStudents.add(student1);
|
||||
mockStudents.add(student2);
|
||||
|
||||
when(studentMapper.findStudentsByRanking(0, 2)).thenReturn(mockStudents);
|
||||
|
||||
// 调用 getStudentRanking 方法
|
||||
List<Student> ranking = studentService.getStudentRanking(0, 2);
|
||||
|
||||
// 验证返回结果是否正确
|
||||
assertEquals(2, ranking.size());
|
||||
assertEquals("Alice", ranking.get(0).getName());
|
||||
assertEquals("Bob", ranking.get(1).getName());
|
||||
}
|
||||
|
||||
// 测试根据学生编号查找
|
||||
@Test
|
||||
void testFindByStudentNumber() {
|
||||
Student student = new Student();
|
||||
student.setStudentNumber("1");
|
||||
student.setName("Alice");
|
||||
|
||||
when(studentMapper.findByStudentNumber("1")).thenReturn(student);
|
||||
|
||||
// 调用 findByStudentNumber 方法
|
||||
Student result = studentService.findByStudentNumber("1");
|
||||
|
||||
// 验证结果
|
||||
assertNotNull(result);
|
||||
assertEquals("Alice", result.getName());
|
||||
}
|
||||
|
||||
// 测试保存学生
|
||||
@Test
|
||||
void testSave() {
|
||||
Student student = new Student();
|
||||
student.setName("Alice");
|
||||
|
||||
// 调用 save 方法
|
||||
studentService.save(student);
|
||||
|
||||
// 验证是否保存了学生
|
||||
verify(studentMapper, times(1)).save(student);
|
||||
}
|
||||
|
||||
// 测试删除学生
|
||||
@Test
|
||||
void testDelete() {
|
||||
Long id = 1L;
|
||||
|
||||
// 调用 delete 方法
|
||||
studentService.delete(id);
|
||||
|
||||
// 验证是否删除了学生
|
||||
verify(studentMapper, times(1)).delete(id);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
package com.example.attendance;
|
||||
|
||||
import com.example.attendance.entity.Teacher;
|
||||
import com.example.attendance.mapper.TeacherMapper;
|
||||
import com.example.attendance.service.impl.TeacherServiceImpl;
|
||||
import com.example.attendance.util.JWTUtil;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
class TeacherServiceImplTest {
|
||||
|
||||
@InjectMocks
|
||||
private TeacherServiceImpl teacherService; // 使用 @InjectMocks 注入测试的服务类
|
||||
|
||||
@Mock
|
||||
private TeacherMapper teacherMapper; // 模拟 TeacherMapper
|
||||
|
||||
@Mock
|
||||
private PasswordEncoder passwordEncoder; // 模拟 PasswordEncoder
|
||||
|
||||
@BeforeEach
|
||||
void setUp() {
|
||||
MockitoAnnotations.openMocks(this); // 初始化 mocks
|
||||
}
|
||||
|
||||
// 测试注册功能
|
||||
@Test
|
||||
void testRegister() {
|
||||
// 模拟加密的密码
|
||||
String rawPassword = "password123";
|
||||
String encodedPassword = "encodedPassword123";
|
||||
|
||||
when(passwordEncoder.encode(rawPassword)).thenReturn(encodedPassword);
|
||||
|
||||
// 调用注册方法
|
||||
teacherService.register("testUser", rawPassword);
|
||||
|
||||
// 验证 teacherMapper.save 是否被调用,并且密码是加密的
|
||||
verify(teacherMapper, times(1)).save(any(Teacher.class));
|
||||
verify(passwordEncoder, times(1)).encode(rawPassword);
|
||||
}
|
||||
|
||||
// 测试登录功能
|
||||
@Test
|
||||
void testLogin_Success() {
|
||||
// 模拟数据库中保存的教师
|
||||
Teacher teacher = new Teacher();
|
||||
teacher.setUsername("testUser");
|
||||
teacher.setPassword("encodedPassword123");
|
||||
|
||||
// 模拟找到用户,并且密码匹配
|
||||
when(teacherMapper.findByUsername("testUser")).thenReturn(teacher);
|
||||
when(passwordEncoder.matches("password123", "encodedPassword123")).thenReturn(true);
|
||||
|
||||
// 模拟生成的 JWT token
|
||||
String token = "mockedJWTToken";
|
||||
mockStatic(JWTUtil.class); // mock 静态方法
|
||||
when(JWTUtil.generateToken(teacher)).thenReturn(token);
|
||||
|
||||
// 调用登录方法
|
||||
String resultToken = teacherService.login("testUser", "password123");
|
||||
|
||||
// 验证生成的 token 是否正确
|
||||
assertEquals(token, resultToken);
|
||||
|
||||
// 验证方法调用
|
||||
verify(teacherMapper, times(1)).findByUsername("testUser");
|
||||
verify(passwordEncoder, times(1)).matches("password123", "encodedPassword123");
|
||||
}
|
||||
|
||||
// 测试登录失败(用户名不正确)
|
||||
@Test
|
||||
void testLogin_Fail_UserNotFound() {
|
||||
// 模拟未找到用户
|
||||
when(teacherMapper.findByUsername("nonExistentUser")).thenReturn(null);
|
||||
|
||||
// 调用登录方法并捕获异常
|
||||
Exception exception = assertThrows(RuntimeException.class, () -> {
|
||||
teacherService.login("nonExistentUser", "password123");
|
||||
});
|
||||
|
||||
// 验证异常消息
|
||||
assertEquals("用户名或密码不正确", exception.getMessage());
|
||||
|
||||
// 验证 teacherMapper.findByUsername 被调用一次
|
||||
verify(teacherMapper, times(1)).findByUsername("nonExistentUser");
|
||||
}
|
||||
|
||||
// 测试登录失败(密码不匹配)
|
||||
@Test
|
||||
void testLogin_Fail_WrongPassword() {
|
||||
// 模拟找到用户,但密码不匹配
|
||||
Teacher teacher = new Teacher();
|
||||
teacher.setUsername("testUser");
|
||||
teacher.setPassword("encodedPassword123");
|
||||
|
||||
when(teacherMapper.findByUsername("testUser")).thenReturn(teacher);
|
||||
when(passwordEncoder.matches("wrongPassword", "encodedPassword123")).thenReturn(false);
|
||||
|
||||
// 调用登录方法并捕获异常
|
||||
Exception exception = assertThrows(RuntimeException.class, () -> {
|
||||
teacherService.login("testUser", "wrongPassword");
|
||||
});
|
||||
|
||||
// 验证异常消息
|
||||
assertEquals("用户名或密码不正确", exception.getMessage());
|
||||
|
||||
// 验证方法调用
|
||||
verify(teacherMapper, times(1)).findByUsername("testUser");
|
||||
verify(passwordEncoder, times(1)).matches("wrongPassword", "encodedPassword123");
|
||||
}
|
||||
}
|
@ -1,154 +0,0 @@
|
||||
.lucky-popup {
|
||||
/* background-image: url('../assets/image/bgcImg.png'); */
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/* position: relative; */
|
||||
/* position: fixed; */
|
||||
/* background-size: 100% 100%; */
|
||||
}
|
||||
|
||||
/* header */
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 20px 60px;
|
||||
padding-bottom: 0;
|
||||
font-size: 50px;
|
||||
font-weight: bold;
|
||||
color: #626868;
|
||||
}
|
||||
.icon {
|
||||
width: 45px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.icon:hover {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
|
||||
/* 姓名学号 */
|
||||
.lucky-info {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
margin-bottom: 200px;
|
||||
}
|
||||
|
||||
.lucky-icon {
|
||||
width: 700px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.stage-icon {
|
||||
position: absolute;
|
||||
width: 900px;
|
||||
top: 44%;
|
||||
}
|
||||
.student-info {
|
||||
position: absolute;
|
||||
text-align: center; /* 确保文本居中 */
|
||||
top: 34%;
|
||||
}
|
||||
|
||||
.student-id, .student-name {
|
||||
font-size: 75px;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
}
|
||||
/* .student-id {
|
||||
position: absolute;
|
||||
top: 33%;
|
||||
font-size: 75px;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
}
|
||||
.student-name {
|
||||
position: absolute;
|
||||
top: 45%;
|
||||
font-size: 75px;
|
||||
font-weight: bold;
|
||||
color: black;
|
||||
} */
|
||||
.student-msg {
|
||||
position: absolute;
|
||||
left: 5%;
|
||||
right: 5%;
|
||||
top: 62.5%;
|
||||
font-size: 33px;
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
||||
/* 分数按钮 */
|
||||
.score-buttons {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin: 0 5%;
|
||||
}
|
||||
|
||||
.score-btn {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 18px 115px;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
background-color: #A182FF;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
font-size: 30px;
|
||||
transition: background-color 0.3s;
|
||||
}
|
||||
|
||||
.score-btn.active, .score-btn:hover {
|
||||
background-color: #6231F5;
|
||||
}
|
||||
|
||||
.score-btn input {
|
||||
width: 50px;
|
||||
height: 28px;
|
||||
padding: 5px;
|
||||
border-radius: 5px;
|
||||
margin-right: 8px;
|
||||
font-size: 28px;
|
||||
border: none;
|
||||
background-color: #EBE4FF;
|
||||
color: #333;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* 底部 */
|
||||
.bottom{
|
||||
position: absolute;
|
||||
display: flex; align-items: center;justify-content: space-around;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 20px 0;
|
||||
background-color: #EBE4FF;
|
||||
}
|
||||
.cancel {
|
||||
width: auto;
|
||||
border-radius: 5px;
|
||||
padding: 10px 25px;
|
||||
font-size: 23px;
|
||||
background-color: #fff;
|
||||
color: #A182FF;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cancel:hover {
|
||||
background-color: #dfdede;
|
||||
}
|
||||
.confirm{
|
||||
width: auto;
|
||||
border-radius: 5px;
|
||||
padding: 10px 25px;
|
||||
font-size: 23px;
|
||||
background-color: #A182FF;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.confirm:hover {
|
||||
background-color: #6231F5;
|
||||
}
|
@ -1,142 +0,0 @@
|
||||
.container {
|
||||
position: relative;
|
||||
background-color: #fff;
|
||||
border-radius: 40px;
|
||||
height: 100%;
|
||||
padding-top: 10px;
|
||||
box-shadow: 5px 10px 10px 5px rgba(2, 2, 2, 0.1);
|
||||
overflow: hidden;
|
||||
}
|
||||
/* 头部 */
|
||||
.header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 15px 60px;
|
||||
font-size: 35px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.icon {
|
||||
width: 45px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.icon:hover {
|
||||
transform: scale(1.3);
|
||||
}
|
||||
|
||||
/* 搜索框 */
|
||||
.search-bar {
|
||||
padding: 20px 40px;
|
||||
display: flex;
|
||||
gap: 30px;
|
||||
}
|
||||
.search-input {
|
||||
flex-grow: 1;
|
||||
padding: 10px;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 10px;
|
||||
font-size: 20px;
|
||||
}
|
||||
.search-btn {
|
||||
background-color: #A182FF;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 10px 30px;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
font-size: 30px;
|
||||
}
|
||||
.search-btn:hover{
|
||||
background-color: #6231F5;
|
||||
}
|
||||
|
||||
/* 表格滚动容器样式 */
|
||||
.table-scroll-container {
|
||||
max-height: 480px; /* 设置一个合适的高度 */
|
||||
overflow-y: auto; /* 当内容超出时显示滚动条 */
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
th, td {
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
padding: 12px 40px;
|
||||
border-bottom: 1.5px solid #ddd;
|
||||
border-right: 1.5px solid #ddd;
|
||||
/* 防止换行 */
|
||||
/* white-space: nowrap; */
|
||||
&:last-child{
|
||||
border-right: none;
|
||||
}
|
||||
|
||||
}
|
||||
th {
|
||||
background-color: #EBE4FF;
|
||||
font-weight: normal;
|
||||
color: black;
|
||||
font-weight: bold;
|
||||
}
|
||||
.medal {
|
||||
font-size: 20px;
|
||||
}
|
||||
/* 分页 */
|
||||
.pagination {
|
||||
padding: 30px 20px 15px 0px;
|
||||
text-align: right;
|
||||
color: #797878;
|
||||
font-weight: bold;
|
||||
font-size: 18px;
|
||||
}
|
||||
.page-btn {
|
||||
background-color: #b39cf2;
|
||||
color: #fff;
|
||||
border: none;
|
||||
padding: 8px 15px;
|
||||
margin: 0 8px;
|
||||
font-size: 18px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.page-btn:hover {
|
||||
background-color: #9272f3;
|
||||
}
|
||||
|
||||
|
||||
/* 底部 */
|
||||
.bottom{
|
||||
position: absolute;
|
||||
display: flex; align-items: center; justify-content: right;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
padding: 30px 30px;
|
||||
background-color: #EBE4FF;
|
||||
}
|
||||
.cancel {
|
||||
width: auto;
|
||||
border-radius: 5px;
|
||||
padding: 20px 35px;
|
||||
margin-right: 70px;
|
||||
font-size: 28px;
|
||||
background-color: #fff;
|
||||
color: #A182FF;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cancel:hover {
|
||||
background-color: #dfdede;
|
||||
}
|
||||
.confirm{
|
||||
width: auto;
|
||||
border-radius: 5px;
|
||||
padding: 20px 35px;
|
||||
margin-right: 30px;
|
||||
font-size: 28px;
|
||||
background-color: #A182FF;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
}
|
||||
.confirm:hover {
|
||||
background-color: #6231F5;
|
||||
}
|
Before Width: | Height: | Size: 951 B |
Before Width: | Height: | Size: 830 B |
Before Width: | Height: | Size: 909 KiB |
Before Width: | Height: | Size: 739 B |