java script在线考试系统_一个基于 Spring Boot 的在线考试系统

a31fddd4ee45bed51b04845efd9c6d0f.png

今天推荐一款超级美观的在线考试系统,感兴趣可以先去预览地址看看该项目。

在线 Demo预览,http://129.211.88.191 ,账户分别是admin、teacher、student,密码是admin123

GitHub地址:github.com/19920625lsg/spring-boot-online-exam

功能简介支持单选题、多选题、判断题

支持学生(student)、教师(teacher)、管理员(admin)三种角色学生:参加考试和查看我的考试

教师:学生的所有权限+创建/编辑题目+创建/编辑考试

管理员:教师的所有权限+管理用户

软件架构前后端分离,前段组件化,方便二次开发;后端后端采用SpringBoot+JPA++Swagger2+JWT校验,根据不同用户的权限返回给用户不同的数据

前端采用Vue+AntDesign,组件化拆分,封装了很多年公共组件,方便维护和二次开发

使用教程

1.下载代码git clone https://github.com/19920625lsg/spring-boot-online-exam.git

2.初始化数据库安装mysql的步骤这里省略,网上的教程很多。

安装好mysql后,新建exam数据库,密码和spring-boot-online-exam/backend/exam/src/main/resources/application.yml的password: xxxxxx保持一致,然后导入spring-boot-online-exam/doc/sql/exam.sql

3.启动后端打开spring-boot-online-exam/backend/exam这个Maven项目,可以在IDE里启动或者执行mvn install生成jar包启动

4.启动前端进入到前端代码路径 cd spring-boot-online-exam/frontend/exam/

安装依赖 npm install

启动前端 npm run serve

5.部署完毕,查看效果

打开 http://localhost:8000 或者 http://本机ip:8000 即可查看演示效果

登陆

首页

32519ef3a588e41ac5b8607d542e3dce.png

04cf92346c6b2a47a4cdab2dd5fecdf3.png

答题

3987a870e2602eaf688ec24bcec2aa60.png

考试管理

f11b8f4680cdea8f6901f7adea6a0757.png

考试列表

79cc07faaf846ea98f30343d2114ee54.png

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
附录 本文所述的生鲜超市管理系统是基于 Spring Boot 框架开发的,使用的技术栈包括:Spring BootSpring Data JPA、Thymeleaf、Bootstrap、jQuery 等。 以下是系统的部分代码示例,仅供参考。 1. UserController.java ```java @Controller @RequestMapping("/user") public class UserController { @Autowired private UserService userService; // 用户列表页面 @GetMapping("/list") public String list(Model model) { List<User> userList = userService.findAll(); model.addAttribute("userList", userList); return "user/list"; } // 新增用户页面 @GetMapping("/add") public String add(Model model) { model.addAttribute("user", new User()); return "user/form"; } // 编辑用户页面 @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, Model model) { User user = userService.findById(id); model.addAttribute("user", user); return "user/form"; } // 保存用户 @PostMapping("/save") public String save(@Valid User user, BindingResult result) { if (result.hasErrors()) { return "user/form"; } userService.save(user); return "redirect:/user/list"; } // 删除用户 @GetMapping("/delete/{id}") public String delete(@PathVariable("id") Long id) { userService.deleteById(id); return "redirect:/user/list"; } } ``` 2. UserService.java ```java public interface UserService { List<User> findAll(); User findById(Long id); void save(User user); void deleteById(Long id); } ``` 3. UserRepository.java ```java public interface UserRepository extends JpaRepository<User, Long> { } ``` 4. User.java ```java @Entity @Table(name = "user") public class User { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; @NotEmpty(message = "用户名不能为空") private String username; @NotEmpty(message = "密码不能为空") private String password; private String email; // 省略 getter 和 setter 方法 } ``` 5. list.html ```html <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>用户列表</title> <link rel="stylesheet" href="/webjars/bootstrap/4.3.1/css/bootstrap.min.css"/> <script src="/webjars/jquery/3.4.1/jquery.min.js"></script> <script src="/webjars/bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <h2>用户列表</h2> <table class="table table-bordered table-striped"> <thead> <tr> <th>ID</th> <th>用户名</th> <th>邮箱</th> <th>操作</th> </tr> </thead> <tbody> <tr th:each="user : ${userList}"> <td th:text="${user.id}"></td> <td th:text="${user.username}"></td> <td th:text="${user.email}"></td> <td> <a th:href="@{/user/edit/{id}(id=${user.id})}">编辑</a> <a th:href="@{/user/delete/{id}(id=${user.id})}" onclick="return confirm('确定删除吗?')">删除</a> </td> </tr> </tbody> </table> <a href="/user/add" class="btn btn-primary">新增用户</a> </div> </body> </html> ``` 6. form.html ```html <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head> <meta charset="UTF-8"> <title>用户表单</title> <link rel="stylesheet" href="/webjars/bootstrap/4.3.1/css/bootstrap.min.css"/> <script src="/webjars/jquery/3.4.1/jquery.min.js"></script> <script src="/webjars/bootstrap/4.3.1/js/bootstrap.min.js"></script> </head> <body> <div class="container-fluid"> <h2>用户表单</h2> <form th:action="@{/user/save}" method="post" th:object="${user}"> <input type="hidden" th:field="*{id}"/> <div class="form-group"> <label for="username">用户名</label> <input type="text" class="form-control" id="username" th:field="*{username}"/> <span th:if="${#fields.hasErrors('username')}" th:errors="*{username}"></span> </div> <div class="form-group"> <label for="password">密码</label> <input type="password" class="form-control" id="password" th:field="*{password}"/> <span th:if="${#fields.hasErrors('password')}" th:errors="*{password}"></span> </div> <div class="form-group"> <label for="email">邮箱</label> <input type="email" class="form-control" id="email" th:field="*{email}"/> <span th:if="${#fields.hasErrors('email')}" th:errors="*{email}"></span> </div> <button type="submit" class="btn btn-primary">保存</button> <a href="/user/list" class="btn btn-secondary">取消</a> </form> </div> </body> </html> ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值