2020-09-24 09:55:31 +08:00
|
|
|
|
# 目录
|
|
|
|
|
|
2020-09-27 21:08:40 +08:00
|
|
|
|
## 项目介绍
|
2020-09-24 09:55:31 +08:00
|
|
|
|
|
2020-11-19 09:22:12 +08:00
|
|
|
|
学之思在线考试系统是一款 java + vue 的前后端分离的考试系统。主要优点是开发、部署简单快捷、界面设计友好、代码结构清晰。支持web端和微信小程序,能覆盖到pc机和手机等设备。 支持多种部署方式:集成部署、前后端分离部署、docker部署。
|
2020-09-24 09:55:31 +08:00
|
|
|
|
|
2020-09-27 21:08:40 +08:00
|
|
|
|
## 开源版使用须知
|
|
|
|
|
|
2020-10-22 10:05:55 +08:00
|
|
|
|
仅用个人学习
|
2020-09-27 21:08:40 +08:00
|
|
|
|
|
|
|
|
|
禁止将本项目的代码和资源进行任何形式的出售,产生的一切任何后果责任由侵权者自负
|
|
|
|
|
|
2020-12-22 10:10:30 +08:00
|
|
|
|
## 学之思仓库地址
|
2020-10-09 09:46:08 +08:00
|
|
|
|
|
|
|
|
|
gitee - mysql :[https://gitee.com/mindskip/xzs-mysql](https://gitee.com/mindskip/xzs-mysql)
|
|
|
|
|
|
|
|
|
|
github - mysql :[https://github.com/mindskip/xzs-mysql](https://github.com/mindskip/xzs-mysql)
|
|
|
|
|
|
2020-09-24 09:55:31 +08:00
|
|
|
|
## 运行环境
|
|
|
|
|
|
|
|
|
|
| 环境 | 版本 |
|
|
|
|
|
| ---- | ---- |
|
|
|
|
|
| 操作系统 | Windows / Linux |
|
2021-03-05 13:21:11 +08:00
|
|
|
|
| Jdk | 1.8 |
|
2020-11-09 08:27:36 +08:00
|
|
|
|
| Redis | 6.0 |
|
2020-12-21 11:31:39 +08:00
|
|
|
|
| Mysql | 8.0 |
|
2020-10-14 10:05:50 +08:00
|
|
|
|
|
2020-11-13 09:22:47 +08:00
|
|
|
|
## 技术栈列表
|
|
|
|
|
|
2020-11-16 09:37:54 +08:00
|
|
|
|
### 后台系统
|
|
|
|
|
|
2020-11-13 09:22:47 +08:00
|
|
|
|
* spring-boot 2.1.6.RELEASE
|
2020-12-04 10:00:11 +08:00
|
|
|
|
* spring-boot-security 用户登录验证
|
|
|
|
|
* undertow web容器
|
2020-12-21 11:31:39 +08:00
|
|
|
|
* mysql 最流行的开源数据库
|
2020-11-13 09:22:47 +08:00
|
|
|
|
* redis 缓存,提升系统性能
|
|
|
|
|
* mybatis 数据库中间件
|
|
|
|
|
* hikari 速度最快的数据库连接池
|
2020-12-16 10:08:33 +08:00
|
|
|
|
* 七牛云存储 分布式文件存储中心
|
2020-11-13 09:22:47 +08:00
|
|
|
|
|
2020-11-16 09:37:54 +08:00
|
|
|
|
### 前台系统
|
|
|
|
|
|
2020-12-16 10:08:33 +08:00
|
|
|
|
* vue 采用新版,使用了vue-cli4搭建的系统,减少大量配置文件
|
|
|
|
|
* element-ui 最流行的vue UI框架
|
|
|
|
|
* vue-element-admin 深度定制版
|
2020-11-13 09:22:47 +08:00
|
|
|
|
* echarts 图表统计
|
2020-12-16 10:08:33 +08:00
|
|
|
|
* ueditor 深度定制版
|
2020-11-13 09:22:47 +08:00
|
|
|
|
|
2020-11-16 09:37:54 +08:00
|
|
|
|
### 微信小程序
|
|
|
|
|
|
2020-11-13 09:22:47 +08:00
|
|
|
|
* iView 主题样式
|
|
|
|
|
|
2020-12-21 11:31:39 +08:00
|
|
|
|
## 架构图
|
|
|
|
|
|
2021-03-01 20:43:36 +08:00
|
|
|
|
![架构图](1.png)
|
2020-12-21 11:31:39 +08:00
|
|
|
|
|
2021-02-18 09:26:06 +08:00
|
|
|
|
## 数据库设计
|
|
|
|
|
|
2021-02-19 09:53:55 +08:00
|
|
|
|
### 试卷表 t_exam_paper
|
2021-02-18 09:26:06 +08:00
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
2021-02-19 09:53:55 +08:00
|
|
|
|
| id | int | |
|
|
|
|
|
| name | varchar | 试卷名称 |
|
|
|
|
|
| subject_id | int | 学科 |
|
|
|
|
|
| paper_type | int | 试卷类型( 1固定试卷 4.时段试卷 6.任务试卷) |
|
|
|
|
|
| grade_level | int | 年级 |
|
|
|
|
|
| score | int | 试卷总分(千分制) |
|
|
|
|
|
| question_count | int | 题目数量 |
|
|
|
|
|
| suggest_time | int | 建议时长(分钟) |
|
|
|
|
|
| limit_start_time | datetime | 时段试卷 开始时间 |
|
|
|
|
|
| limit_end_time | datetime | 时段试卷 结束时间 |
|
|
|
|
|
| frame_text_content_id | int | 试卷框架 内容为JSON |
|
|
|
|
|
| create_user | int | |
|
|
|
|
|
| create_time | datetime | |
|
2021-02-18 09:26:06 +08:00
|
|
|
|
| deleted | bit | |
|
|
|
|
|
| task_exam_id | int | |
|
|
|
|
|
|
2021-02-19 09:53:55 +08:00
|
|
|
|
### 试卷答案表 t_exam_paper_answer
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
2021-02-20 13:38:39 +08:00
|
|
|
|
| id | int | |
|
2021-02-19 09:53:55 +08:00
|
|
|
|
| exam_paper_id | int | |
|
|
|
|
|
| paper_name | varchar | 试卷名称 |
|
|
|
|
|
| paper_type | int | 试卷类型( 1固定试卷 2临时试卷 3班级试卷 4.时段试卷 ) |
|
|
|
|
|
| subject_id | int | 学科 |
|
|
|
|
|
| system_score | int | 系统判定得分 |
|
|
|
|
|
| user_score | int | 最终得分(千分制) |
|
|
|
|
|
| paper_score | int | 试卷总分 |
|
|
|
|
|
| question_correct | int | 做对题目数量 |
|
|
|
|
|
| question_count | int | 题目总数量 |
|
|
|
|
|
| do_time | int | 做题时间(秒) |
|
|
|
|
|
| status | int | 试卷状态(1待判分 2完成) |
|
|
|
|
|
| create_user | int | 学生 |
|
|
|
|
|
| create_time | datetime | 提交时间 |
|
|
|
|
|
| task_exam_id | int | |
|
|
|
|
|
|
2021-02-20 13:38:39 +08:00
|
|
|
|
### 试卷题目答案表 t_exam_paper_question_customer_answer
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| question_id | int | 题目Id |
|
|
|
|
|
| exam_paper_id | int | 答案Id |
|
|
|
|
|
| exam_paper_answer_id | int | |
|
|
|
|
|
| question_type | int | 题型 |
|
|
|
|
|
| subject_id | int | 学科 |
|
|
|
|
|
| customer_score | int | 得分 |
|
|
|
|
|
| question_score | int | 题目原始分数 |
|
|
|
|
|
| question_text_content_id | int | 问题内容 |
|
|
|
|
|
| answer | varchar | 做题答案 |
|
|
|
|
|
| text_content_id | int | 做题内容 |
|
|
|
|
|
| do_right | bit | 是否正确 |
|
|
|
|
|
| create_user | int | 做题人 |
|
|
|
|
|
| create_time | datetime | |
|
|
|
|
|
| item_order | int | |
|
|
|
|
|
|
2021-02-22 09:55:07 +08:00
|
|
|
|
### 消息表 t_message
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| title | varchar | 标题 |
|
|
|
|
|
| content | varchar | 内容 |
|
|
|
|
|
| create_time | datetime | |
|
|
|
|
|
| send_user_id | int | 发送者用户ID |
|
|
|
|
|
| send_user_name | varchar | 发送者用户名 |
|
|
|
|
|
| send_real_name | varchar | 发送者真实姓名 |
|
|
|
|
|
| receive_user_count | int | 接收人数 |
|
|
|
|
|
| read_count | int | 已读人数 |
|
|
|
|
|
|
2021-02-25 10:01:56 +08:00
|
|
|
|
### 用户消息表 t_message_user
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| message_id | int | 消息内容ID |
|
|
|
|
|
| receive_user_id | int | 接收人ID |
|
|
|
|
|
| receive_user_name | varchar | 接收人用户名 |
|
|
|
|
|
| receive_real_name | varchar | 接收人真实姓名 |
|
|
|
|
|
| readed | bit | 是否已读 |
|
|
|
|
|
| create_time | datetime | |
|
|
|
|
|
| read_time | datetime | 阅读时间 |
|
|
|
|
|
|
2021-02-26 10:35:52 +08:00
|
|
|
|
### 题目表 t_question
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| question_type | int | 1.单选题 2.多选题 3.判断题 4.填空题 5.简答题 |
|
|
|
|
|
| subject_id | int | 学科 |
|
|
|
|
|
| score | int | 题目总分(千分制) |
|
|
|
|
|
| grade_level | int | 级别 |
|
|
|
|
|
| difficult | int | 题目难度 |
|
|
|
|
|
| correct | text | 正确答案 |
|
|
|
|
|
| info_text_content_id | int | 题目 填空、 题干、解析、答案等信息 |
|
|
|
|
|
| create_user | int | 创建人 |
|
|
|
|
|
| status | int | 1.正常 |
|
|
|
|
|
| create_time | datetime | 创建时间 |
|
|
|
|
|
| deleted | bit | |
|
|
|
|
|
|
2021-03-02 13:11:27 +08:00
|
|
|
|
### 学科表 t_subject
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| name | varchar | 语文 数学 英语 等 |
|
|
|
|
|
| level | int | 年级 (1-12) 小学 初中 高中 大学 |
|
|
|
|
|
| level_name | varchar | 一年级、二年级等 |
|
|
|
|
|
| item_order | int | 排序 |
|
|
|
|
|
| deleted | bit | |
|
|
|
|
|
|
2021-03-03 12:52:29 +08:00
|
|
|
|
### 任务表 t_task_exam
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| title | varchar | |
|
|
|
|
|
| grade_level | int | 级别 |
|
|
|
|
|
| frame_text_content_id | int | 任务框架 内容为JSON |
|
|
|
|
|
| create_user | int | |
|
|
|
|
|
| create_time | datetime | |
|
|
|
|
|
| deleted | bit | |
|
|
|
|
|
| create_user_name | varchar | |
|
|
|
|
|
|
2021-03-04 12:39:47 +08:00
|
|
|
|
### 用户任务表 t_task_exam_customer_answer
|
|
|
|
|
|
|
|
|
|
| 字段名 | 类型 | 注释 |
|
|
|
|
|
| ---- | ---- | ---- |
|
|
|
|
|
| id | int | |
|
|
|
|
|
| task_exam_id | int | |
|
|
|
|
|
| create_user | int | |
|
|
|
|
|
| create_time | datetime | |
|
|
|
|
|
| text_content_id | int | 任务完成情况(Json) |
|
|
|
|
|
|
2020-11-19 09:22:12 +08:00
|
|
|
|
## 项目开发
|
|
|
|
|
|
|
|
|
|
### 开发说明
|
2020-10-14 10:05:50 +08:00
|
|
|
|
|
2020-10-27 09:13:58 +08:00
|
|
|
|
* redis 安装
|
|
|
|
|
* 进群获取到数据库脚本,创建表初始化数据,数据库名称为xzs
|
2020-12-21 11:31:39 +08:00
|
|
|
|
* 代码分为 mysql版本,配合相应的数据库使用
|
2020-12-22 10:10:30 +08:00
|
|
|
|
* 安装mysql ,导入xzs-mysql.sql脚本。
|
2020-11-20 08:45:05 +08:00
|
|
|
|
* 学生端默认账号:student / 123456
|
|
|
|
|
* 管理端默认账号:admin / 123456
|
2020-10-27 09:13:58 +08:00
|
|
|
|
|
2020-11-19 09:22:12 +08:00
|
|
|
|
### 后端开发
|
2020-10-27 09:13:58 +08:00
|
|
|
|
|
|
|
|
|
* /uexam/source/xzs为后台代码,建议使用IntelliJ IDEA打开
|
|
|
|
|
* 打开application-dev.yml文件中,配置好postgesql/mysql、redis的服务地址
|
2020-12-03 10:21:04 +08:00
|
|
|
|
* 去七牛云官网申请好云存储账号,修改application.yml中的qn相关的配置
|
2020-10-27 09:13:58 +08:00
|
|
|
|
* 启动后台程序,默认端口为8000。
|
2020-11-26 11:58:20 +08:00
|
|
|
|
* 学生系统地址:<http://ip:8000/student>
|
|
|
|
|
* 管理端地址:<http://ip:8000/admin>
|
2020-10-27 09:13:58 +08:00
|
|
|
|
|
2020-11-19 09:22:12 +08:00
|
|
|
|
### 前端开发
|
2020-10-27 09:13:58 +08:00
|
|
|
|
|
|
|
|
|
* 前端使用webstorm或者vscode,分别打开文件夹打开源代码\source\vue\xzs-student和source\vue\xzs-admin
|
|
|
|
|
* 执行下面2个命令,安装node_module:
|
2020-10-26 09:05:50 +08:00
|
|
|
|
|
|
|
|
|
```npm
|
|
|
|
|
npm config set sass_binary_site https://npm.taobao.org/mirrors/node-sass/
|
|
|
|
|
npm install --registry https://registry.npm.taobao.org
|
|
|
|
|
```
|
2020-10-27 09:13:58 +08:00
|
|
|
|
|
|
|
|
|
* 执行下面命令,启动前端代码
|
2020-10-26 09:05:50 +08:00
|
|
|
|
|
|
|
|
|
```npm
|
|
|
|
|
npm run serve
|
|
|
|
|
```
|
2020-10-28 10:51:25 +08:00
|
|
|
|
|
2020-10-30 09:32:12 +08:00
|
|
|
|
* 打包命名
|
|
|
|
|
|
|
|
|
|
```npm
|
|
|
|
|
npm run build
|
|
|
|
|
```
|
|
|
|
|
|
2020-11-19 09:22:12 +08:00
|
|
|
|
### 微信小程序开发
|
2020-10-28 10:51:25 +08:00
|
|
|
|
|
2020-11-11 13:09:20 +08:00
|
|
|
|
* 去腾讯小程序官网注册账号,拿到appid和secret信息
|
2020-10-30 09:32:12 +08:00
|
|
|
|
* 下载好微信小程序开发工具
|
2020-10-28 10:51:25 +08:00
|
|
|
|
* 打开工具,导入代码 \source\wx\xzs-student
|
2020-11-11 13:09:20 +08:00
|
|
|
|
* 修改application.yml文件里的wx配置下面的appid和secret
|
2020-10-29 09:35:51 +08:00
|
|
|
|
* 启动小程序开发工具
|
2020-11-04 09:24:30 +08:00
|
|
|
|
|
2020-11-18 09:51:55 +08:00
|
|
|
|
## 项目部署
|
|
|
|
|
|
|
|
|
|
### 集成部署
|
2020-11-04 09:24:30 +08:00
|
|
|
|
|
|
|
|
|
* 分别在\source\vue\xzs-student目录和source\vue\xzs-admin目录,执行前端打包命令
|
|
|
|
|
|
|
|
|
|
```npm
|
|
|
|
|
npm run build
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
* 打包后的目录为student和admin
|
|
|
|
|
* 将文件放到\source\xzs\src\main\resources\static下,然后将java程序打包成jar包
|
2020-11-05 09:35:20 +08:00
|
|
|
|
* 修改application-prod.yml中的datasource和redis地址
|
2020-11-18 09:51:55 +08:00
|
|
|
|
* 学生端访问地址为:<http://ip:8000/student>
|
|
|
|
|
* 管理员端访问地址为:<http://ip:8000/admin>
|
2020-11-04 09:24:30 +08:00
|
|
|
|
* 执行下列命令,运行程序
|
|
|
|
|
|
|
|
|
|
```java
|
2021-01-29 09:14:39 +08:00
|
|
|
|
nohup java -Duser.timezone=Asia/Shanghai -jar -Dspring.profiles.active=prod xzs-3.2.0.jar > start1.log 2>&1 &
|
2020-11-04 09:24:30 +08:00
|
|
|
|
```
|
2020-11-17 09:05:27 +08:00
|
|
|
|
|
2020-11-18 09:51:55 +08:00
|
|
|
|
### 前后端分离部署
|
2020-11-17 09:05:27 +08:00
|
|
|
|
|
|
|
|
|
* 采用前后端分离方式部署,后端启动和部署方式1一样
|
|
|
|
|
* 前端采用nginx来装载静态页面,先创建/usr/local/xzs/web/目录,然后将打包后的student、admin放到此目录下
|
|
|
|
|
* 页面访问端口为8001,注意检查防火墙端口是否打开
|
2020-11-18 09:51:55 +08:00
|
|
|
|
* 学生端访问地址为:<http://ip:8001/student>
|
|
|
|
|
* 管理员端访问地址为:<http://ip:8001/admin>
|
2020-11-18 09:37:25 +08:00
|
|
|
|
* nginx配置如下:
|
2020-11-17 09:05:27 +08:00
|
|
|
|
|
|
|
|
|
```nginx
|
|
|
|
|
server {
|
|
|
|
|
listen 8001;
|
|
|
|
|
server_name xzs;
|
|
|
|
|
location / {
|
|
|
|
|
root /usr/local/xzs/web/;
|
|
|
|
|
index index.html;
|
|
|
|
|
}
|
|
|
|
|
location /api/ {
|
2021-01-12 09:25:05 +08:00
|
|
|
|
proxy_pass http://localhost:8000;
|
2020-11-17 09:05:27 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
2020-11-18 09:37:25 +08:00
|
|
|
|
|
2020-11-18 09:51:55 +08:00
|
|
|
|
### docker部署
|
2020-11-18 09:37:25 +08:00
|
|
|
|
|
|
|
|
|
* 先检查服务器端口、ip转发的是否配置正确,否则无法访问到docker内部
|
|
|
|
|
* docker内部镜像已经安装了java、mysql、redis、nginx,均已配置好,无需其他操作
|
2020-11-18 09:51:55 +08:00
|
|
|
|
* 执行下列docker命令,拉取镜像,启动容器
|
|
|
|
|
* 学生端访问地址为:<http://ip:8001/student>
|
|
|
|
|
* 管理员端访问地址为:<http://ip:8001/admin>
|
2020-11-18 09:37:25 +08:00
|
|
|
|
|
|
|
|
|
```docker
|
2021-02-01 10:01:11 +08:00
|
|
|
|
docker pull registry.cn-hangzhou.aliyuncs.com/mindskip/xzs:v3.2.0
|
|
|
|
|
docker run -d --name xzs --privileged -it -d -p 8001:8001 -v /etc/localtime:/etc/localtime:ro registry.cn-hangzhou.aliyuncs.com/mindskip/xzs:v3.2.0 /usr/sbin/init
|
2020-11-18 09:51:55 +08:00
|
|
|
|
```
|