├── onlineExam ├── student │ ├── __init__.py │ ├── migrations │ │ ├── __init__.py │ │ ├── __pycache__ │ │ │ ├── __init__.cpython-37.pyc │ │ │ ├── 0001_initial.cpython-37.pyc │ │ │ ├── 0002_auto_20190609_1126.cpython-37.pyc │ │ │ ├── 0003_auto_20190609_1128.cpython-37.pyc │ │ │ ├── 0004_auto_20190609_1134.cpython-37.pyc │ │ │ ├── 0005_auto_20190609_1914.cpython-37.pyc │ │ │ └── 0006_auto_20200702_2217.cpython-37.pyc │ │ ├── 0002_auto_20190609_1126.py │ │ ├── 0003_auto_20190609_1128.py │ │ ├── 0005_auto_20190609_1914.py │ │ ├── 0006_auto_20200702_2217.py │ │ ├── 0004_auto_20190609_1134.py │ │ └── 0001_initial.py │ ├── tests.py │ ├── apps.py │ ├── admin.py │ ├── models.py │ └── views.py ├── onlineExam │ ├── __init__.py │ ├── __pycache__ │ │ ├── urls.cpython-37.pyc │ │ ├── wsgi.cpython-37.pyc │ │ ├── __init__.cpython-37.pyc │ │ └── settings.cpython-37.pyc │ ├── wsgi.py │ ├── urls.py │ └── settings.py ├── requirements.txt ├── __pycache__ │ └── manage.cpython-37.pyc ├── .idea │ ├── encodings.xml │ ├── modules.xml │ ├── misc.xml │ ├── watcherTasks.xml │ ├── inspectionProfiles │ │ └── Project_Default.xml │ ├── onlineExam.iml │ └── workspace.xml ├── manage.py ├── templates │ ├── test.html │ └── index.html └── static │ ├── css │ ├── main.css │ └── test.css │ ├── bootstrap-4.3.1-dist │ └── css │ │ ├── bootstrap-reboot.min.css │ │ ├── bootstrap-reboot.css │ │ ├── bootstrap-reboot.min.css.map │ │ └── bootstrap-grid.min.css │ └── js │ ├── jquery.easy-pie-chart.js │ └── jquery.countdown.js ├── 关于系统.txt ├── README.md └── mysql数据库 └── exam.sql /onlineExam/student/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /关于系统.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/关于系统.txt -------------------------------------------------------------------------------- /onlineExam/student/tests.py: -------------------------------------------------------------------------------- 1 | from django.test import TestCase 2 | 3 | # Create your tests here. 4 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/__init__.py: -------------------------------------------------------------------------------- 1 | import pymysql 2 | pymysql.version_info=(1,3,13,"final",0) 3 | pymysql.install_as_MySQLdb() -------------------------------------------------------------------------------- /onlineExam/requirements.txt: -------------------------------------------------------------------------------- 1 | asgiref==3.2.10 2 | Django==3.0.7 3 | PyMySQL==0.9.3 4 | pytz==2020.1 5 | sqlparse==0.3.1 6 | -------------------------------------------------------------------------------- /onlineExam/student/apps.py: -------------------------------------------------------------------------------- 1 | from django.apps import AppConfig 2 | 3 | 4 | class StudentConfig(AppConfig): 5 | name = 'student' 6 | -------------------------------------------------------------------------------- /onlineExam/__pycache__/manage.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/__pycache__/manage.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/urls.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/urls.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/wsgi.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/wsgi.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/onlineExam/__pycache__/settings.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/onlineExam/__pycache__/settings.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/__init__.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/__init__.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0001_initial.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0001_initial.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0002_auto_20190609_1126.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0002_auto_20190609_1126.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0003_auto_20190609_1128.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0003_auto_20190609_1128.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0004_auto_20190609_1134.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0004_auto_20190609_1134.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0005_auto_20190609_1914.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0005_auto_20190609_1914.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/student/migrations/__pycache__/0006_auto_20200702_2217.cpython-37.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wangjianlin1985/Python_Django_online_exam/HEAD/onlineExam/student/migrations/__pycache__/0006_auto_20200702_2217.cpython-37.pyc -------------------------------------------------------------------------------- /onlineExam/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /onlineExam/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/wsgi.py: -------------------------------------------------------------------------------- 1 | """ 2 | WSGI config for onlineExam project. 3 | 4 | It exposes the WSGI callable as a module-level variable named ``application``. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ 8 | """ 9 | 10 | import os 11 | 12 | from django.core.wsgi import get_wsgi_application 13 | 14 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineExam.settings') 15 | 16 | application = get_wsgi_application() 17 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0002_auto_20190609_1126.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:26 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0001_initial'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('2', 'general'), ('1', 'easy')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0003_auto_20190609_1128.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:28 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0002_auto_20190609_1126'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('1', 'easy'), ('3', 'difficult'), ('2', 'general')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0005_auto_20190609_1914.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 11:14 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0004_auto_20190609_1134'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('2', 'general'), ('1', 'easy')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/manage.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import os 3 | import sys 4 | 5 | if __name__ == '__main__': 6 | os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'onlineExam.settings') 7 | try: 8 | from django.core.management import execute_from_command_line 9 | except ImportError as exc: 10 | raise ImportError( 11 | "Couldn't import Django. Are you sure it's installed and " 12 | "available on your PYTHONPATH environment variable? Did you " 13 | "forget to activate a virtual environment?" 14 | ) from exc 15 | execute_from_command_line(sys.argv) 16 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0006_auto_20200702_2217.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 3.0.7 on 2020-07-02 14:17 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0005_auto_20190609_1914'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AlterField( 14 | model_name='question', 15 | name='level', 16 | field=models.CharField(choices=[('3', 'difficult'), ('1', 'easy'), ('2', 'general')], max_length=10, verbose_name='等级'), 17 | ), 18 | ] 19 | -------------------------------------------------------------------------------- /onlineExam/onlineExam/urls.py: -------------------------------------------------------------------------------- 1 | 2 | from django.contrib import admin 3 | from django.urls import path 4 | from django.conf.urls import url 5 | from student import views 6 | 7 | urlpatterns = [ 8 | #管理员登陆 9 | path('admin/', admin.site.urls), 10 | #学生登陆 11 | url(r'^studentLogin/',views.studentLogin), 12 | #教师登陆 13 | url(r'^teacherLogin/',views.teacherLogin), 14 | #默认访问首页 15 | url(r'^$',views.index), 16 | url(r'^toIndex/$',views.toIndex), 17 | url('showGrade',views.showGrade), 18 | url('queryStudent',views.queryStudent), 19 | url(r'^startExam/$',views.startExam), 20 | url(r'^calGrade/$',views.calGrade), 21 | url(r'^logout/$',views.logOut), 22 | ] 23 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0004_auto_20190609_1134.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:34 2 | 3 | from django.db import migrations, models 4 | 5 | 6 | class Migration(migrations.Migration): 7 | 8 | dependencies = [ 9 | ('student', '0003_auto_20190609_1128'), 10 | ] 11 | 12 | operations = [ 13 | migrations.AddField( 14 | model_name='grade', 15 | name='subject', 16 | field=models.CharField(default='', max_length=20, verbose_name='科目'), 17 | ), 18 | migrations.AlterField( 19 | model_name='question', 20 | name='level', 21 | field=models.CharField(choices=[('2', 'general'), ('1', 'easy'), ('3', 'difficult')], max_length=10, verbose_name='等级'), 22 | ), 23 | ] 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Python_Django_online_exam 2 | Python基于Django在线考试系统设计毕业源码案例设计 3 | 4 | ## 开发环境: Pycharm + Python3.7 + Django3.0 + mysql5.6 5 | 6 | ### 系统需求如下: 7 | (1)系统登录:验证登录用户的身份,根据用户身份进入不同的页面。 8 | (2)学生管理:供管理员使用,用于维护学生基本信息。 9 | (3)老师管理:供管理员使用,用于维护教师的基本信息。 10 | (4)试题管理:供教师管理,用于维护题库。 11 | (5)组卷:供教师使用,教师可以根据考试科目,从题库中选择一些符合条件的试题,形成一份试卷。为了方便教师组卷,应提供方便的查询功能,使教师能查询不同要求的试题。 12 | (6)在线考试:供学生使用,根据学生的班级和登录时间显示应考科目的试卷内容。试卷完成提交或考试时间到,不再允许学生修改试卷;实现自动评阅,记录学生的考试成绩,并将评阅结果提供给学生。 13 | (7)成绩统计:供教师使用,按照科目、班级等统计学生的考试成绩。 14 | (8)成绩查询:供教师和学生使用,提供不同查询方式,使教师和学生可以按需查询考试成绩。 15 | 16 | ### 2.设计思路 17 | (1)确定角色 18 | 由需求分析看出,系统有三个基本角色,学生、教师、管理员。 19 | 管理员负责后台信息的维护 20 | 系统要能实现自动阅卷功能 21 | (2)数据库表的设计 22 | 因此,我们至少需要如下几个表: 23 | 学生表 student 24 | 教师表 teacher 25 | 题库表 question(为了方便,题库中都为单项选择题) 26 | 试卷表 paper 27 | 学生成绩表 grade 28 | 设计完表,我们还需要确定表间的关系,是1对1(1:1),1对多(1:n),还是多对多(n:m),这很重要,因为后面我们在models.py中创建表时,需要指出表间关系。显然学生表和成绩表,1个学生可参加多门考试,会有多个成绩,学生表和成绩表为1:n;教师表和试卷表,1个教师会发布多套试卷,但1套试卷只能由1位教师发布,教师表和试卷表为1:n;试卷表和题库表,1套试卷里包含多道题,题库里的每道题也可出现在多个试卷中,故试卷表和题库表为n:m 29 | -------------------------------------------------------------------------------- /onlineExam/.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 16 | 24 | 25 | -------------------------------------------------------------------------------- /onlineExam/.idea/inspectionProfiles/Project_Default.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 22 | -------------------------------------------------------------------------------- /onlineExam/templates/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 测试成绩页 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | {% for result1 in result %} 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | {# #} 45 | 46 | 47 | {% endfor %} 48 | 49 |
学号姓名专业科目成绩
{{ result1.id }}{{ result1.name }}{{ result1.major }}{{ result1.subject }}{{ result1.grade }}#} 38 | {# {% for grade1 in result1.grade_set.all %}#} 39 | {##} 40 | {# {{ grade1.grade }}#} 41 | {##} 42 | {##} 43 | {# {% endfor %}#} 44 | {#
50 |
51 | 52 | 53 | -------------------------------------------------------------------------------- /onlineExam/.idea/onlineExam.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 29 | 30 | 31 | 34 | -------------------------------------------------------------------------------- /onlineExam/student/admin.py: -------------------------------------------------------------------------------- 1 | from django.contrib import admin 2 | from .models import Student,Teacher,Paper,Question,Grade 3 | # Register your models here. 4 | # 修改名称 5 | admin.site.site_header='在线考试系统后台' 6 | admin.site.site_title='在线考试系统' 7 | 8 | @admin.register(Student) 9 | class StudentAdmin(admin.ModelAdmin): 10 | list_display = ('id','name','sex','dept','major','password','email','birth')# 要显示哪些信息 11 | list_display_links = ('id','name')#点击哪些信息可以进入编辑页面 12 | search_fields = ['name','dept','major','birth'] #指定要搜索的字段,将会出现一个搜索框让管理员搜索关键词 13 | list_filter =['name','dept','major','birth']#指定列表过滤器,右边将会出现一个快捷的过滤选项 14 | 15 | @admin.register(Teacher) 16 | class TeacherAdmin(admin.ModelAdmin): 17 | list_display = ('id', 'name', 'sex', 'dept', 'password', 'email', 'birth') 18 | list_display_links = ('id', 'name') 19 | search_fields = ['name', 'dept', 'birth'] 20 | list_filter = ['name','dept'] 21 | 22 | @admin.register(Question) 23 | class QuestionAdmin(admin.ModelAdmin): 24 | list_display = ('id','subject','title','optionA','optionB','optionC','optionD','answer','level','score') 25 | 26 | 27 | @admin.register(Paper) 28 | class PaperAdmin(admin.ModelAdmin): 29 | list_display = ('tid','major','subject','examtime') 30 | list_display_links = ('major','subject','examtime') 31 | 32 | @admin.register(Grade) 33 | class GradeAdmin(admin.ModelAdmin): 34 | list_display = ('sid','subject','grade',) 35 | list_display_links = ('sid','subject','grade',) 36 | # fk_fields = ['sid'] -------------------------------------------------------------------------------- /onlineExam/static/css/main.css: -------------------------------------------------------------------------------- 1 | * {margin: 0; padding: 0;} 2 | html, body 3 | {width: 100%;height: 100%;overflow:auto;font-size:12px;margin:0;padding:0; font-family:"微软雅黑";background:#fff; text-align:center; 4 | } 5 | ul,li{ list-style:none;} 6 | a{ text-decoration:none; color:#666;} 7 | a:hover{text-decoration:none;} 8 | .hover{background:#0f6c8d;} 9 | 10 | i{font-style:normal;} 11 | 12 | /*@font-face{font-family:iconfont;*/ 13 | /* src:url(iconfont.eot?t=1493949807789);*/ 14 | /*src:*/ 15 | /*url(${pageContext.request.contextPath }/fonts/jzbh.eot?t=1493949807789#iefix) format('embedded-opentype'),*/ 16 | /*url(${pageContext.request.contextPath }/fonts/jzbh.woff?t=1493949807789) format('woff'),*/ 17 | /*url(${pageContext.request.contextPath }/fonts/jzbh.ttf?t=1493949807789) format('truetype'),*/ 18 | /*url(${pageContext.request.contextPath }/fonts/jzbh.svg?t=1493949807789#iconfont) format('svg')}*/ 19 | /*.iconfont{font-family:iconfont!important;font-style:normal;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;}*/ 20 | #active{font-size:12px; color:#289cd5; font-weight:bold;} 21 | .course_main{width:100%; height:100%;} 22 | 23 | /*top start*/ 24 | .top{width:100%; height:90px; background:#fff; color:#000;} 25 | .top_nr{width:1200px; margin:0 auto;} 26 | .top_left{height:90px; float:left;} 27 | /*.top_left i{width:180px; height:90px; display:block; float:left; background:../images/student/logo.png) no-repeat center;}*/ 28 | .top_left h1{line-height:100px; display:block; float:left; font-size:28px; } 29 | 30 | .top_right{height:90px; float:right; line-height:90px; padding-right:10px;} 31 | .top_right a{padding:0 10px; color:#000; font-size:14px; display:block; float:left;} 32 | .top_right a span{padding-right:5px; display:block; float:left;} 33 | .top_right a i{color:#f00; padding: 0 5px; display:block; float:left;} 34 | .top_right a b{display:block; float:left;} 35 | .top_right a img{margin-top:30px; display:block; float:left;} 36 | /*top end*/ 37 | /*nav start*/ 38 | .nav{width:100%; height:50px; background:#389fc3; margin-top:15px;} 39 | .nav_nr{width:1200px; height:50px; line-height:50px; margin:0 auto; font-size:14px;} 40 | .nav_nr ul{display:block; margin:0;} 41 | .nav_nr ul li{height:50px; display:block; float:left;} 42 | .nav_nr ul li a{ color:#fff; display:block; height:50px; float:left; padding:0 20px;} 43 | .nav_nr ul li a:hover{text-decoration:none;} 44 | .nav_nr i{color:#fff; display:block; float:left;} 45 | 46 | /*分页 start*/ 47 | .fy{width:100%; height:50px; margin-left:15px; margin-top: 10px; float:left;} 48 | /*分页 end*/ 49 | /*百分比进度 start*/ 50 | .easyPieChart {position: relative;text-align: center;} 51 | .easyPieChart canvas { position: absolute;top: 0;left: 0;} 52 | /*百分比进度 end*/ 53 | /*nav end*/ 54 | .foot{width:100%; height:50px; clear:both;} 55 | -------------------------------------------------------------------------------- /onlineExam/student/models.py: -------------------------------------------------------------------------------- 1 | from django.db import models 2 | 3 | # Create your models here. 4 | 5 | # 为性别,学院 指定备选字段 6 | SEX=( 7 | ('男','男'), 8 | ('女','女'), 9 | ) 10 | DEPT=( 11 | ('计算机与通信学院','计算机与通信学院'), 12 | ('电气与自动化学院','电气与自动化学院'), 13 | ('外国语学院','外国语学院'), 14 | ('理学院','理学院'), 15 | ) 16 | 17 | class Student(models.Model): 18 | id=models.CharField('学号',max_length=20,primary_key=True) 19 | name=models.CharField('姓名',max_length=20) 20 | sex=models.CharField('性别',max_length=4,choices=SEX,default='男') 21 | dept=models.CharField('学院',max_length=20,choices=DEPT,default=None) 22 | major=models.CharField('专业',max_length=20,default=None) 23 | password=models.CharField('密码',max_length=20,default='111') 24 | email=models.EmailField('邮箱',default=None) 25 | birth=models.DateField('出生日期') 26 | 27 | class Meta: 28 | db_table='student' 29 | verbose_name='学生' 30 | verbose_name_plural=verbose_name 31 | def __str__(self): 32 | return self.id; 33 | 34 | class Teacher(models.Model): 35 | id=models.CharField("教工号",max_length=20,primary_key=True) 36 | name=models.CharField('姓名',max_length=20) 37 | sex=models.CharField('性别',max_length=4,choices=SEX,default='男') 38 | dept=models.CharField('学院',max_length=20,choices=DEPT,default=None) 39 | email=models.EmailField('邮箱',default=None) 40 | password=models.CharField('密码',max_length=20,default='000000') 41 | birth=models.DateField('出生日期') 42 | 43 | class Meta: 44 | db_table='teacher' 45 | verbose_name='教师' 46 | verbose_name_plural=verbose_name 47 | def __str__(self): 48 | return self.name; 49 | 50 | class Question(models.Model): 51 | 52 | ANSWER=( 53 | ('A','A'), 54 | ('B','B'), 55 | ('C','C'), 56 | ('D','D'), 57 | ) 58 | LEVEL={ 59 | ('1','easy'), 60 | ('2','general'), 61 | ('3','difficult'), 62 | } 63 | id = models.AutoField(primary_key=True) 64 | subject = models.CharField('科目', max_length=20) 65 | title = models.TextField('题目') 66 | optionA=models.CharField('A选项',max_length=30) 67 | optionB=models.CharField('B选项',max_length=30) 68 | optionC=models.CharField('C选项',max_length=30) 69 | optionD=models.CharField('D选项',max_length=30) 70 | answer=models.CharField('答案',max_length=10,choices=ANSWER) 71 | level=models.CharField('等级',max_length=10,choices=LEVEL) 72 | score=models.IntegerField('分数',default=1) 73 | 74 | class Meta: 75 | db_table='question' 76 | verbose_name='单项选择题库' 77 | verbose_name_plural=verbose_name 78 | def __str__(self): 79 | return '<%s:%s>'%(self.subject,self.title); 80 | 81 | class Paper(models.Model): 82 | #题号pid 和题库为多对多的关系 83 | pid=models.ManyToManyField(Question)#多对多 84 | tid=models.ForeignKey(Teacher,on_delete=models.CASCADE)#添加外键 85 | subject=models.CharField('科目',max_length=20,default='') 86 | major=models.CharField('考卷适用专业',max_length=20) 87 | examtime=models.DateTimeField() 88 | 89 | 90 | class Meta: 91 | db_table='paper' 92 | verbose_name='试卷' 93 | verbose_name_plural=verbose_name 94 | def __str__(self): 95 | return self.major; 96 | 97 | class Grade(models.Model): 98 | sid=models.ForeignKey(Student,on_delete=models.CASCADE,default='')#添加外键 99 | subject=models.CharField('科目',max_length=20,default='') 100 | grade=models.IntegerField() 101 | 102 | def __str__(self): 103 | return '<%s:%s>'%(self.sid,self.grade); 104 | 105 | class Meta: 106 | db_table='grade' 107 | verbose_name='成绩' 108 | verbose_name_plural=verbose_name 109 | -------------------------------------------------------------------------------- /onlineExam/static/bootstrap-4.3.1-dist/css/bootstrap-reboot.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */*,::after,::before{box-sizing:border-box}html{font-family:sans-serif;line-height:1.15;-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent}article,aside,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}body{margin:0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,"Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";font-size:1rem;font-weight:400;line-height:1.5;color:#212529;text-align:left;background-color:#fff}[tabindex="-1"]:focus{outline:0!important}hr{box-sizing:content-box;height:0;overflow:visible}h1,h2,h3,h4,h5,h6{margin-top:0;margin-bottom:.5rem}p{margin-top:0;margin-bottom:1rem}abbr[data-original-title],abbr[title]{text-decoration:underline;-webkit-text-decoration:underline dotted;text-decoration:underline dotted;cursor:help;border-bottom:0;-webkit-text-decoration-skip-ink:none;text-decoration-skip-ink:none}address{margin-bottom:1rem;font-style:normal;line-height:inherit}dl,ol,ul{margin-top:0;margin-bottom:1rem}ol ol,ol ul,ul ol,ul ul{margin-bottom:0}dt{font-weight:700}dd{margin-bottom:.5rem;margin-left:0}blockquote{margin:0 0 1rem}b,strong{font-weight:bolder}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}a{color:#007bff;text-decoration:none;background-color:transparent}a:hover{color:#0056b3;text-decoration:underline}a:not([href]):not([tabindex]){color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus,a:not([href]):not([tabindex]):hover{color:inherit;text-decoration:none}a:not([href]):not([tabindex]):focus{outline:0}code,kbd,pre,samp{font-family:SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:1em}pre{margin-top:0;margin-bottom:1rem;overflow:auto}figure{margin:0 0 1rem}img{vertical-align:middle;border-style:none}svg{overflow:hidden;vertical-align:middle}table{border-collapse:collapse}caption{padding-top:.75rem;padding-bottom:.75rem;color:#6c757d;text-align:left;caption-side:bottom}th{text-align:inherit}label{display:inline-block;margin-bottom:.5rem}button{border-radius:0}button:focus{outline:1px dotted;outline:5px auto -webkit-focus-ring-color}button,input,optgroup,select,textarea{margin:0;font-family:inherit;font-size:inherit;line-height:inherit}button,input{overflow:visible}button,select{text-transform:none}select{word-wrap:normal}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button}[type=button]:not(:disabled),[type=reset]:not(:disabled),[type=submit]:not(:disabled),button:not(:disabled){cursor:pointer}[type=button]::-moz-focus-inner,[type=reset]::-moz-focus-inner,[type=submit]::-moz-focus-inner,button::-moz-focus-inner{padding:0;border-style:none}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0}input[type=date],input[type=datetime-local],input[type=month],input[type=time]{-webkit-appearance:listbox}textarea{overflow:auto;resize:vertical}fieldset{min-width:0;padding:0;margin:0;border:0}legend{display:block;width:100%;max-width:100%;padding:0;margin-bottom:.5rem;font-size:1.5rem;line-height:inherit;color:inherit;white-space:normal}progress{vertical-align:baseline}[type=number]::-webkit-inner-spin-button,[type=number]::-webkit-outer-spin-button{height:auto}[type=search]{outline-offset:-2px;-webkit-appearance:none}[type=search]::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{font:inherit;-webkit-appearance:button}output{display:inline-block}summary{display:list-item;cursor:pointer}template{display:none}[hidden]{display:none!important} 8 | /*# sourceMappingURL=bootstrap-reboot.min.css.map */ -------------------------------------------------------------------------------- /onlineExam/onlineExam/settings.py: -------------------------------------------------------------------------------- 1 | """ 2 | Django settings for onlineExam project. 3 | 4 | Generated by 'django-admin startproject' using Django 2.1. 5 | 6 | For more information on this file, see 7 | https://docs.djangoproject.com/en/2.1/topics/settings/ 8 | 9 | For the full list of settings and their values, see 10 | https://docs.djangoproject.com/en/2.1/ref/settings/ 11 | """ 12 | 13 | import os 14 | 15 | # Build paths inside the project like this: os.path.join(BASE_DIR, ...) 16 | BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) 17 | 18 | 19 | # Quick-start development settings - unsuitable for production 20 | # See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/ 21 | 22 | # SECURITY WARNING: keep the secret key used in production secret! 23 | SECRET_KEY = 'q5qv4a+i=&=#l=!3qzgd6$6xw88a48@3@3&n#%8h$r!w!=kva8' 24 | 25 | # SECURITY WARNING: don't run with debug turned on in production! 26 | DEBUG = True 27 | 28 | ALLOWED_HOSTS = [] 29 | 30 | 31 | # Application definition 32 | 33 | INSTALLED_APPS = [ 34 | 'django.contrib.admin', 35 | 'django.contrib.auth', 36 | 'django.contrib.contenttypes', 37 | 'django.contrib.sessions', 38 | 'django.contrib.messages', 39 | 'django.contrib.staticfiles', 40 | 'student',#将建立的app名称加入Installed_APPs中 41 | ] 42 | 43 | MIDDLEWARE = [ 44 | 'django.middleware.security.SecurityMiddleware', 45 | 'django.contrib.sessions.middleware.SessionMiddleware', 46 | 'django.middleware.common.CommonMiddleware', 47 | # 'django.middleware.csrf.CsrfViewMiddleware', 48 | 'django.contrib.auth.middleware.AuthenticationMiddleware', 49 | 'django.contrib.messages.middleware.MessageMiddleware', 50 | 'django.middleware.clickjacking.XFrameOptionsMiddleware', 51 | ] 52 | 53 | ROOT_URLCONF = 'onlineExam.urls' 54 | 55 | TEMPLATES = [ 56 | { 57 | 'BACKEND': 'django.template.backends.django.DjangoTemplates', 58 | 'DIRS': [os.path.join(BASE_DIR, 'templates')] 59 | , 60 | 'APP_DIRS': True, 61 | 'OPTIONS': { 62 | 'context_processors': [ 63 | 'django.template.context_processors.debug', 64 | 'django.template.context_processors.request', 65 | 'django.contrib.auth.context_processors.auth', 66 | 'django.contrib.messages.context_processors.messages', 67 | ], 68 | }, 69 | }, 70 | ] 71 | 72 | WSGI_APPLICATION = 'onlineExam.wsgi.application' 73 | 74 | 75 | # Database 76 | # https://docs.djangoproject.com/en/2.1/ref/settings/#databases 77 | 78 | #配置mysql数据库 79 | DATABASES = { 80 | 'default': { 81 | 'ENGINE': 'django.db.backends.mysql', 82 | 'NAME': 'exam',#使用数据库的名称 83 | 'USER':'root',#用户名 84 | 'PASSWORD':'123456',#密码 85 | 'HOST':'127.0.0.1',#地址 86 | 'PORT':'3306'#端口号 87 | } 88 | } 89 | 90 | 91 | # Password validation 92 | # https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators 93 | 94 | AUTH_PASSWORD_VALIDATORS = [ 95 | { 96 | 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', 97 | }, 98 | { 99 | 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', 100 | }, 101 | { 102 | 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', 103 | }, 104 | { 105 | 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', 106 | }, 107 | ] 108 | 109 | 110 | # Internationalization 111 | # https://docs.djangoproject.com/en/2.1/topics/i18n/ 112 | 113 | #修改语言为中文 114 | LANGUAGE_CODE = 'zh-hans' 115 | 116 | #修改时区为shanghai 117 | TIME_ZONE = 'Asia/Shanghai' 118 | 119 | USE_I18N = True 120 | 121 | USE_L10N = True 122 | 123 | USE_TZ = True 124 | 125 | 126 | # Static files (CSS, JavaScript, Images) 127 | # https://docs.djangoproject.com/en/2.1/howto/static-files/ 128 | 129 | #添加static文件夹 130 | STATIC_URL = '/static/' 131 | STATICFILES_DIRS=[ 132 | os.path.join(BASE_DIR,'static'), 133 | ] 134 | -------------------------------------------------------------------------------- /onlineExam/static/css/test.css: -------------------------------------------------------------------------------- 1 | /*nr start*/ 2 | .test_main{width:1200px; margin:15px auto 0;} 3 | .nr_left{width:900px; height:100%; float:left;} 4 | 5 | .test{ width:100%; border:1px solid #e4e4e4; text-align:left; float:left;} 6 | .test_title{width:900px; height:45px; line-height:45px; background-color:#f7f7f7;position:fixed; bottom:0; z-index:1000;} 7 | .test_title p{padding:0 20px; display:block; float:left;} 8 | .test_time{color:#f00; line-height:45px;} 9 | .test_time i{font-size:20px; height:45px; line-height:40px; display:block; float:left} 10 | .test_time b{font-size:16px; height:45px; display:block; float:left; margin-left:10px;} 11 | .test_dtk {line-height:45px;} 12 | .test_dtk i{font-size:22px; height:45px; line-height:45px; display:block; float:left; color:#389fc3;} 13 | .test_dtk span{font-size:14px; height:45px; display:block; float:left; margin-left:10px;} 14 | .test_title font{width:80px; height:45px; display:block; float:right; text-align:center; } 15 | .test_title font input{background:#389fc3; border:none; display:block; width:80px; height:45px; cursor:pointer; color:#fff; font-size:16px; font-weight:bold;} 16 | .test_title font input:active{background:#79aef0;} 17 | 18 | .test_content{width:100%; height:auto; margin-top:15px;} 19 | .test_content_title{width:100%; height:50px; line-height:50px; background:#f7f7f7; text-align:center;} 20 | .test_content_title h2{padding:0 30px; font-size:16px; font-weight:normal; display:block; float:left} 21 | .test_content_title p{padding:0 10px; height:40px; line-height:40px; background:#389fc3; color:#fff; border-radius:30px; display:block; float:left; margin-top:5px;} 22 | 23 | .test_content_nr{width:100%; border-top:3px solid #efefef;} 24 | .test_content_nr>ul>li{width:100%; border-bottom:5px solid #efefef; padding-top:10px;} 25 | .test_content_nr_tt{width:85%; height:auto; line-height:32px; margin:0 auto; border-bottom:1px solid #e4e4e4;} 26 | .test_content_nr_tt i{width:25px; height:25px; line-height:25px; text-align:center; display:block; float:left; background:#5d9cec; border-radius:50%; margin-left:-50px; color:#fff; margin-top:8px; font-size:16px;} 27 | .test_content_nr_tt span{padding:0 8px;} 28 | .test_content_nr_tt font{font-size:14px} 29 | .test_content_nr_tt b{display:block; float:right; margin-right:-50px; color:#f48c27; font-size:20px;} 30 | 31 | .test_content_nr_main{width:85%; margin:0 auto; padding:10px 0;height:auto;} 32 | 33 | .option{line-height:32px; display:block; background:#fff;color:#666;} 34 | .option:hover{background:#e4e4e4;} 35 | .option input{width:20px; height:20px; display:block; float:left; margin:10px 10px 0 0;} 36 | .option label{height:auto;display:block;} 37 | 38 | .test_more_nr_main{width:85%; margin:0 auto; padding:10px 0;} 39 | .multiple{width:100%; height:40px; line-height:40px; display:block; background:#fff; margin-bottom:3px;} 40 | .multiple:hover{background:#e4e4e4;} 41 | .multiple dd input{width:20px; height:20px; display:block; float:left; margin:10px 10px 0 0;} 42 | .multiple dd label{width:725px; height:40px; display:block; float:left;} 43 | .test_click{background:#7aaff3; } 44 | .test_click a{color:#fff;} 45 | /*nr_right start*/ 46 | .nr_right{width:280px; height:100%; float:right;} 47 | .nr_rt_main{width:100%; height:auto;} 48 | 49 | .rt_nr1{width:280px; position:fixed; top:15px; z-index:1000;} 50 | .rt_nr1_title{width:280px; height:45px; line-height:45px; background:#f3f3f3;} 51 | .rt_nr1_title h1{width:130px; height:45px; background:#389fc3; text-align:center; font-size:14px; display:block; float:left; color:#fff;} 52 | .rt_nr1_title h1 i{padding:0 5px; font-size:14px; font-weight:normal;} 53 | .rt_nr1_title p{width:141px; height:43px; padding-right:8px; border:1px solid #e4e4e4; border-left:0; display:block; float:right;} 54 | .rt_nr1_title p i{margin-left:10px;} 55 | 56 | .rt_content{width:278px; height:100%; border:1px solid #e4e4e4; border-top:0;} 57 | .rt_content_tt{width:95%; height:40px; line-height:40px; margin:0 auto; border-bottom:1px solid #e4e4e4;} 58 | .rt_content_tt h2{width:150px; font-size:14px; display:inline-block;} 59 | .rt_content_tt p{width:100px; display:inline-block;} 60 | .answerSheet ul{padding:10px; text-align:left;} 61 | .answerSheet li{ display:inline-block;margin-bottom:5px; height:30px; width:30px; line-height:30px; text-align:center; border:1px solid #e4e4e4;} 62 | .answerSheet li a{display:block;} 63 | .answerSheet li:hover{color:#389fc3;border-color: #389fc3;} 64 | 65 | .rt_more{width:278px; height:100%; border:1px solid #e4e4e4; border-top:0;} 66 | .rt_more_tt{width:95%; height:40px; line-height:40px; margin:0 auto; border-bottom:1px solid #e4e4e4;} 67 | .rt_more_tt h2{width:150px; font-size:14px; display:inline-block;} 68 | .rt_more_tt p{width:100px; display:inline-block;} 69 | .rt_more_nr ul{padding:10px; text-align:left;} 70 | .rt_more_nr ul li{ display:inline-block; margin:5px; height:30px; width:30px; line-height:30px; text-align:center; border:1px solid #e4e4e4;} 71 | 72 | 73 | /*nr_right end*/ 74 | /*nr end*/ 75 | -------------------------------------------------------------------------------- /onlineExam/student/migrations/0001_initial.py: -------------------------------------------------------------------------------- 1 | # Generated by Django 2.1 on 2019-06-09 03:25 2 | 3 | from django.db import migrations, models 4 | import django.db.models.deletion 5 | 6 | 7 | class Migration(migrations.Migration): 8 | 9 | initial = True 10 | 11 | dependencies = [ 12 | ] 13 | 14 | operations = [ 15 | migrations.CreateModel( 16 | name='Grade', 17 | fields=[ 18 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 19 | ('grade', models.IntegerField()), 20 | ], 21 | options={ 22 | 'verbose_name': '成绩', 23 | 'verbose_name_plural': '成绩', 24 | 'db_table': 'grade', 25 | }, 26 | ), 27 | migrations.CreateModel( 28 | name='Paper', 29 | fields=[ 30 | ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), 31 | ('subject', models.CharField(default='', max_length=20, verbose_name='科目')), 32 | ('major', models.CharField(max_length=20, verbose_name='考卷适用专业')), 33 | ('examtime', models.DateTimeField()), 34 | ], 35 | options={ 36 | 'verbose_name': '试卷', 37 | 'verbose_name_plural': '试卷', 38 | 'db_table': 'paper', 39 | }, 40 | ), 41 | migrations.CreateModel( 42 | name='Question', 43 | fields=[ 44 | ('id', models.AutoField(primary_key=True, serialize=False)), 45 | ('subject', models.CharField(max_length=20, verbose_name='科目')), 46 | ('title', models.TextField(verbose_name='题目')), 47 | ('optionA', models.CharField(max_length=30, verbose_name='A选项')), 48 | ('optionB', models.CharField(max_length=30, verbose_name='B选项')), 49 | ('optionC', models.CharField(max_length=30, verbose_name='C选项')), 50 | ('optionD', models.CharField(max_length=30, verbose_name='D选项')), 51 | ('answer', models.CharField(choices=[('A', 'A'), ('B', 'B'), ('C', 'C'), ('D', 'D')], max_length=10, verbose_name='答案')), 52 | ('level', models.CharField(choices=[('2', 'general'), ('3', 'difficult'), ('1', 'easy')], max_length=10, verbose_name='等级')), 53 | ('score', models.IntegerField(default=1, verbose_name='分数')), 54 | ], 55 | options={ 56 | 'verbose_name': '单项选择题库', 57 | 'verbose_name_plural': '单项选择题库', 58 | 'db_table': 'question', 59 | }, 60 | ), 61 | migrations.CreateModel( 62 | name='Student', 63 | fields=[ 64 | ('id', models.CharField(max_length=20, primary_key=True, serialize=False, verbose_name='学号')), 65 | ('name', models.CharField(max_length=20, verbose_name='姓名')), 66 | ('sex', models.CharField(choices=[('男', '男'), ('女', '女')], default='男', max_length=4, verbose_name='性别')), 67 | ('dept', models.CharField(choices=[('计算机与通信学院', '计算机与通信学院'), ('电气与自动化学院', '电气与自动化学院'), ('外国语学院', '外国语学院'), ('理学院', '理学院')], default=None, max_length=20, verbose_name='学院')), 68 | ('major', models.CharField(default=None, max_length=20, verbose_name='专业')), 69 | ('password', models.CharField(default='111', max_length=20, verbose_name='密码')), 70 | ('email', models.EmailField(default=None, max_length=254, verbose_name='邮箱')), 71 | ('birth', models.DateField(verbose_name='出生日期')), 72 | ], 73 | options={ 74 | 'verbose_name': '学生', 75 | 'verbose_name_plural': '学生', 76 | 'db_table': 'student', 77 | }, 78 | ), 79 | migrations.CreateModel( 80 | name='Teacher', 81 | fields=[ 82 | ('id', models.CharField(max_length=20, primary_key=True, serialize=False, verbose_name='教工号')), 83 | ('name', models.CharField(max_length=20, verbose_name='姓名')), 84 | ('sex', models.CharField(choices=[('男', '男'), ('女', '女')], default='男', max_length=4, verbose_name='性别')), 85 | ('dept', models.CharField(choices=[('计算机与通信学院', '计算机与通信学院'), ('电气与自动化学院', '电气与自动化学院'), ('外国语学院', '外国语学院'), ('理学院', '理学院')], default=None, max_length=20, verbose_name='学院')), 86 | ('email', models.EmailField(default=None, max_length=254, verbose_name='邮箱')), 87 | ('password', models.CharField(default='000000', max_length=20, verbose_name='密码')), 88 | ('birth', models.DateField(verbose_name='出生日期')), 89 | ], 90 | options={ 91 | 'verbose_name': '教师', 92 | 'verbose_name_plural': '教师', 93 | 'db_table': 'teacher', 94 | }, 95 | ), 96 | migrations.AddField( 97 | model_name='paper', 98 | name='pid', 99 | field=models.ManyToManyField(to='student.Question'), 100 | ), 101 | migrations.AddField( 102 | model_name='paper', 103 | name='tid', 104 | field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='student.Teacher'), 105 | ), 106 | migrations.AddField( 107 | model_name='grade', 108 | name='sid', 109 | field=models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='student.Student'), 110 | ), 111 | ] 112 | -------------------------------------------------------------------------------- /onlineExam/student/views.py: -------------------------------------------------------------------------------- 1 | from django.shortcuts import render,redirect 2 | from student import models 3 | from django.http import HttpResponse 4 | from django.contrib.auth import logout 5 | # Create your views here. 6 | def index(request): 7 | return render(request,'index.html') 8 | 9 | def toIndex(request): 10 | return render(request,'index.html') 11 | 12 | 13 | # 学生登陆 视图函数 14 | def studentLogin(request): 15 | if request.method=='POST': 16 | # 获取表单信息 17 | stuId=request.POST.get('id') 18 | password=request.POST.get('password') 19 | print("id",stuId,"password",password) 20 | # 通过学号获取该学生实体 21 | student=models.Student.objects.get(id=stuId) 22 | print(student) 23 | if password==student.password: #登录成功 24 | #查询考试信息 25 | paper=models.Paper.objects.filter(major=student.major) 26 | #查询成绩信息 27 | grade=models.Grade.objects.filter(sid=student.id) 28 | # 渲染index模板 29 | return render(request,'index.html',{'student':student,'paper':paper,'grade':grade}) 30 | 31 | else:return render(request,'index.html',{'message':'密码不正确'}) 32 | 33 | # 教师登陆 视图函数 34 | def teacherLogin(request): 35 | 36 | if request.method == 'POST': 37 | teaId = request.POST.get('id') 38 | password = request.POST.get('password') 39 | # print("id", teaId, "password", password) 40 | 41 | teacher=models.Teacher.objects.get(id=teaId) 42 | print(teacher) 43 | if password == teacher.password: # 登录成功 44 | # 实现成绩统计功能 45 | #在试卷表 paper 找到该老师发布的试题 46 | paper=models.Paper.objects.filter(tid=teacher.id) 47 | 48 | data1=models.Grade.objects.filter(subject='计算机基础',grade__lt=60).count() 49 | data2=models.Grade.objects.filter(subject='计算机基础',grade__gte=60,grade__lt=70).count() 50 | data3 = models.Grade.objects.filter(subject='计算机基础', grade__gte=70, grade__lt=80).count() 51 | data4 = models.Grade.objects.filter(subject='计算机基础', grade__gte=80, grade__lt=90).count() 52 | data5 = models.Grade.objects.filter(subject='计算机基础', grade__gte=90).count() 53 | 54 | data6 = models.Grade.objects.filter(subject='高等数学', grade__lt=60).count() 55 | data7= models.Grade.objects.filter(subject='高等数学', grade__gte=60, grade__lt=70).count() 56 | data8= models.Grade.objects.filter(subject='高等数学', grade__gte=70, grade__lt=80).count() 57 | data9 = models.Grade.objects.filter(subject='高等数学', grade__gte=80, grade__lt=90).count() 58 | data10= models.Grade.objects.filter(subject='高等数学', grade__gte=90).count() 59 | 60 | 61 | data_1={'data1':data1,'data2':data2,'data3':data3,'data4':data4,'data5':data5} 62 | data_2 = {'data6': data6, 'data7': data7, 'data8': data8, 'data9': data9, 'data10': data10} 63 | 64 | 65 | print("数量:",data2) 66 | return render(request, 'teacher.html', {'teacher': teacher, 'paper':paper,'data_1':data_1,'data_2':data_2}) 67 | 68 | else: 69 | return render(request, 'index.html', {'message': '密码不正确'}) 70 | 71 | #教师查看成绩 72 | def showGrade(request): 73 | subject1=request.GET.get('subject') 74 | grade=models.Grade.objects.filter(subject=subject1) 75 | 76 | data1 = models.Grade.objects.filter(subject=subject1, grade__lt=60).count() 77 | data2 = models.Grade.objects.filter(subject=subject1, grade__gte=60, grade__lt=70).count() 78 | data3 = models.Grade.objects.filter(subject=subject1, grade__gte=70, grade__lt=80).count() 79 | data4 = models.Grade.objects.filter(subject=subject1, grade__gte=80, grade__lt=90).count() 80 | data5 = models.Grade.objects.filter(subject=subject1, grade__gte=90).count() 81 | 82 | data = {'data1': data1, 'data2': data2, 'data3': data3, 'data4': data4, 'data5': data5} 83 | 84 | return render(request,'showGrade.html',{'grade':grade,'data':data,'subject':subject1}) 85 | 86 | #教师按条件查询学生 87 | def queryStudent(request): 88 | #获取教师查询的条件值 89 | sid=request.GET.get('id') 90 | sex=request.GET.get('sex') 91 | subject=request.GET.get('subject') 92 | 93 | #获取老师的id 94 | tid=request.GET.get('tid') 95 | teacher = models.Teacher.objects.get(id=tid) 96 | paper = models.Paper.objects.filter(tid=teacher.id) 97 | 98 | # print(sid,sex,subject) 99 | from django.db import connection,transaction 100 | cursor=connection.cursor() 101 | sql="select * from grade,student where student.id=grade.sid_id " \ 102 | "and student.id like %s and grade.subject like %s and student.sex like %s and '1'='1'" 103 | val=('%'+sid+'%','%'+subject+'%','%'+sex+'%') 104 | cursor.execute(sql,val) 105 | result=dictfetchall(cursor) 106 | 107 | 108 | # print(result) 109 | return render(request,'teacher.html',{'teacher':teacher,'result':result,'paper':paper}) 110 | 111 | #将使用原生sql语句查到的结果由tuple类型转换为dictionary(字典)类型 112 | def dictfetchall(cursor): 113 | "将游标返回的结果保存到一个字典对象中" 114 | desc = cursor.description 115 | return [ 116 | dict(zip([col[0] for col in desc], row)) 117 | for row in cursor.fetchall() 118 | ] 119 | 120 | 121 | #学生考试 的视图函数 122 | def startExam(request): 123 | sid = request.GET.get('sid') 124 | subject1=request.GET.get('subject') 125 | 126 | student=models.Student.objects.get(id=sid) 127 | paper=models.Paper.objects.filter(subject=subject1) 128 | # print('学号',sid,'考试科目',subject1) 129 | return render(request,'exam.html',{'student':student,'paper':paper,'subject':subject1}) 130 | 131 | 132 | #计算由exam.html模版传过来的数据计算成绩 133 | def calGrade(request): 134 | 135 | if request.method=='POST': 136 | pass 137 | 138 | # 教师退出 139 | def logOut(request): 140 | return redirect('/toIndex/') 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | -------------------------------------------------------------------------------- /onlineExam/static/js/jquery.easy-pie-chart.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.3.3 2 | 3 | /* 4 | Easy pie chart is a jquery plugin to display simple animated pie charts for only one value 5 | 6 | Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 7 | and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses. 8 | 9 | Built on top of the jQuery library (http://jquery.com) 10 | 11 | @source: http://github.com/rendro/easy-pie-chart/ 12 | @autor: Robert Fleischmann 13 | @version: 1.0.1 14 | 15 | Inspired by: http://dribbble.com/shots/631074-Simple-Pie-Charts-II?list=popular&offset=210 16 | Thanks to Philip Thrasher for the jquery plugin boilerplate for coffee script 17 | */ 18 | 19 | 20 | (function() { 21 | 22 | (function($) { 23 | $.easyPieChart = function(el, options) { 24 | var addScaleLine, animateLine, drawLine, easeInOutQuad, renderBackground, renderScale, renderTrack, 25 | _this = this; 26 | this.el = el; 27 | this.$el = $(el); 28 | this.$el.data("easyPieChart", this); 29 | this.init = function() { 30 | var percent; 31 | _this.options = $.extend({}, $.easyPieChart.defaultOptions, options); 32 | percent = parseInt(_this.$el.data('percent'), 10); 33 | _this.percentage = 0; 34 | _this.canvas = $("").get(0); 35 | _this.$el.append(_this.canvas); 36 | if (typeof G_vmlCanvasManager !== "undefined" && G_vmlCanvasManager !== null) { 37 | G_vmlCanvasManager.initElement(_this.canvas); 38 | } 39 | _this.ctx = _this.canvas.getContext('2d'); 40 | _this.ctx.translate(_this.options.size / 2, _this.options.size / 2); 41 | _this.$el.addClass('easyPieChart'); 42 | _this.$el.css({ 43 | width: _this.options.size, 44 | height: _this.options.size, 45 | lineHeight: "" + _this.options.size + "px" 46 | }); 47 | _this.update(percent); 48 | return _this; 49 | }; 50 | this.update = function(percent) { 51 | if (_this.options.animate === false) { 52 | return drawLine(percent); 53 | } else { 54 | return animateLine(_this.percentage, percent); 55 | } 56 | }; 57 | renderScale = function() { 58 | var i, _i, _results; 59 | _this.ctx.fillStyle = _this.options.scaleColor; 60 | _this.ctx.lineWidth = 1; 61 | _results = []; 62 | for (i = _i = 0; _i <= 24; i = ++_i) { 63 | _results.push(addScaleLine(i)); 64 | } 65 | return _results; 66 | }; 67 | addScaleLine = function(i) { 68 | var offset; 69 | offset = i % 6 === 0 ? 0 : _this.options.size * 0.017; 70 | _this.ctx.save(); 71 | _this.ctx.rotate(i * Math.PI / 12); 72 | _this.ctx.fillRect(_this.options.size / 2 - offset, 0, -_this.options.size * 0.05 + offset, 1); 73 | return _this.ctx.restore(); 74 | }; 75 | renderTrack = function() { 76 | var offset; 77 | offset = _this.options.size / 2 - _this.options.lineWidth / 2; 78 | if (_this.options.scaleColor !== false) { 79 | offset -= _this.options.size * 0.08; 80 | } 81 | _this.ctx.beginPath(); 82 | _this.ctx.arc(0, 0, offset, 0, Math.PI * 2, true); 83 | _this.ctx.closePath(); 84 | _this.ctx.strokeStyle = _this.options.trackColor; 85 | _this.ctx.lineWidth = _this.options.lineWidth; 86 | return _this.ctx.stroke(); 87 | }; 88 | renderBackground = function() { 89 | if (_this.options.scaleColor !== false) { 90 | renderScale(); 91 | } 92 | if (_this.options.trackColor !== false) { 93 | return renderTrack(); 94 | } 95 | }; 96 | drawLine = function(percent) { 97 | var offset; 98 | renderBackground(); 99 | _this.ctx.strokeStyle = $.isFunction(_this.options.barColor) ? _this.options.barColor(percent) : _this.options.barColor; 100 | _this.ctx.lineCap = _this.options.lineCap; 101 | offset = _this.options.size / 2 - _this.options.lineWidth / 2; 102 | if (_this.options.scaleColor !== false) { 103 | offset -= _this.options.size * 0.08; 104 | } 105 | _this.ctx.save(); 106 | _this.ctx.rotate(-Math.PI / 2); 107 | _this.ctx.beginPath(); 108 | _this.ctx.arc(0, 0, offset, 0, Math.PI * 2 * percent / 100, false); 109 | _this.ctx.stroke(); 110 | return _this.ctx.restore(); 111 | }; 112 | animateLine = function(from, to) { 113 | var currentStep, fps, steps; 114 | fps = 30; 115 | steps = fps * _this.options.animate / 1000; 116 | currentStep = 0; 117 | _this.options.onStart.call(_this); 118 | _this.percentage = to; 119 | if (_this.animation) { 120 | clearInterval(_this.animation); 121 | _this.animation = false; 122 | } 123 | return _this.animation = setInterval(function() { 124 | _this.ctx.clearRect(-_this.options.size / 2, -_this.options.size / 2, _this.options.size, _this.options.size); 125 | renderBackground.call(_this); 126 | drawLine.call(_this, [easeInOutQuad(currentStep, from, to - from, steps)]); 127 | currentStep++; 128 | if ((currentStep / steps) > 1) { 129 | clearInterval(_this.animation); 130 | _this.animation = false; 131 | return _this.options.onStop.call(_this); 132 | } 133 | }, 1000 / fps); 134 | }; 135 | easeInOutQuad = function(t, b, c, d) { 136 | t /= d / 2; 137 | if (t < 1) { 138 | return c / 2 * t * t + b; 139 | } else { 140 | return -c / 2 * ((--t) * (t - 2) - 1) + b; 141 | } 142 | }; 143 | return this.init(); 144 | }; 145 | //修改饼图大小 146 | $.easyPieChart.defaultOptions = { 147 | barColor: '#00ff00', 148 | trackColor: '#f2f2f2', 149 | scaleColor: '#ffffff', 150 | lineCap: 'round', 151 | size: 80, 152 | lineWidth: 2, 153 | animate: false, 154 | onStart: $.noop, 155 | onStop: $.noop 156 | }; 157 | $.fn.easyPieChart = function(options) { 158 | return $.each(this, function(i, el) { 159 | var $el; 160 | $el = $(el); 161 | if (!$el.data('easyPieChart')) { 162 | return $el.data('easyPieChart', new $.easyPieChart(el, options)); 163 | } 164 | }); 165 | }; 166 | return void 0; 167 | })(jQuery); 168 | 169 | }).call(this); 170 | -------------------------------------------------------------------------------- /onlineExam/static/bootstrap-4.3.1-dist/css/bootstrap-reboot.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Reboot v4.3.1 (https://getbootstrap.com/) 3 | * Copyright 2011-2019 The Bootstrap Authors 4 | * Copyright 2011-2019 Twitter, Inc. 5 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 6 | * Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md) 7 | */ 8 | *, 9 | *::before, 10 | *::after { 11 | box-sizing: border-box; 12 | } 13 | 14 | html { 15 | font-family: sans-serif; 16 | line-height: 1.15; 17 | -webkit-text-size-adjust: 100%; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | article, aside, figcaption, figure, footer, header, hgroup, main, nav, section { 22 | display: block; 23 | } 24 | 25 | body { 26 | margin: 0; 27 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"; 28 | font-size: 1rem; 29 | font-weight: 400; 30 | line-height: 1.5; 31 | color: #212529; 32 | text-align: left; 33 | background-color: #fff; 34 | } 35 | 36 | [tabindex="-1"]:focus { 37 | outline: 0 !important; 38 | } 39 | 40 | hr { 41 | box-sizing: content-box; 42 | height: 0; 43 | overflow: visible; 44 | } 45 | 46 | h1, h2, h3, h4, h5, h6 { 47 | margin-top: 0; 48 | margin-bottom: 0.5rem; 49 | } 50 | 51 | p { 52 | margin-top: 0; 53 | margin-bottom: 1rem; 54 | } 55 | 56 | abbr[title], 57 | abbr[data-original-title] { 58 | text-decoration: underline; 59 | -webkit-text-decoration: underline dotted; 60 | text-decoration: underline dotted; 61 | cursor: help; 62 | border-bottom: 0; 63 | -webkit-text-decoration-skip-ink: none; 64 | text-decoration-skip-ink: none; 65 | } 66 | 67 | address { 68 | margin-bottom: 1rem; 69 | font-style: normal; 70 | line-height: inherit; 71 | } 72 | 73 | ol, 74 | ul, 75 | dl { 76 | margin-top: 0; 77 | margin-bottom: 1rem; 78 | } 79 | 80 | ol ol, 81 | ul ul, 82 | ol ul, 83 | ul ol { 84 | margin-bottom: 0; 85 | } 86 | 87 | dt { 88 | font-weight: 700; 89 | } 90 | 91 | dd { 92 | margin-bottom: .5rem; 93 | margin-left: 0; 94 | } 95 | 96 | blockquote { 97 | margin: 0 0 1rem; 98 | } 99 | 100 | b, 101 | strong { 102 | font-weight: bolder; 103 | } 104 | 105 | small { 106 | font-size: 80%; 107 | } 108 | 109 | sub, 110 | sup { 111 | position: relative; 112 | font-size: 75%; 113 | line-height: 0; 114 | vertical-align: baseline; 115 | } 116 | 117 | sub { 118 | bottom: -.25em; 119 | } 120 | 121 | sup { 122 | top: -.5em; 123 | } 124 | 125 | a { 126 | color: #007bff; 127 | text-decoration: none; 128 | background-color: transparent; 129 | } 130 | 131 | a:hover { 132 | color: #0056b3; 133 | text-decoration: underline; 134 | } 135 | 136 | a:not([href]):not([tabindex]) { 137 | color: inherit; 138 | text-decoration: none; 139 | } 140 | 141 | a:not([href]):not([tabindex]):hover, a:not([href]):not([tabindex]):focus { 142 | color: inherit; 143 | text-decoration: none; 144 | } 145 | 146 | a:not([href]):not([tabindex]):focus { 147 | outline: 0; 148 | } 149 | 150 | pre, 151 | code, 152 | kbd, 153 | samp { 154 | font-family: SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; 155 | font-size: 1em; 156 | } 157 | 158 | pre { 159 | margin-top: 0; 160 | margin-bottom: 1rem; 161 | overflow: auto; 162 | } 163 | 164 | figure { 165 | margin: 0 0 1rem; 166 | } 167 | 168 | img { 169 | vertical-align: middle; 170 | border-style: none; 171 | } 172 | 173 | svg { 174 | overflow: hidden; 175 | vertical-align: middle; 176 | } 177 | 178 | table { 179 | border-collapse: collapse; 180 | } 181 | 182 | caption { 183 | padding-top: 0.75rem; 184 | padding-bottom: 0.75rem; 185 | color: #6c757d; 186 | text-align: left; 187 | caption-side: bottom; 188 | } 189 | 190 | th { 191 | text-align: inherit; 192 | } 193 | 194 | label { 195 | display: inline-block; 196 | margin-bottom: 0.5rem; 197 | } 198 | 199 | button { 200 | border-radius: 0; 201 | } 202 | 203 | button:focus { 204 | outline: 1px dotted; 205 | outline: 5px auto -webkit-focus-ring-color; 206 | } 207 | 208 | input, 209 | button, 210 | select, 211 | optgroup, 212 | textarea { 213 | margin: 0; 214 | font-family: inherit; 215 | font-size: inherit; 216 | line-height: inherit; 217 | } 218 | 219 | button, 220 | input { 221 | overflow: visible; 222 | } 223 | 224 | button, 225 | select { 226 | text-transform: none; 227 | } 228 | 229 | select { 230 | word-wrap: normal; 231 | } 232 | 233 | button, 234 | [type="button"], 235 | [type="reset"], 236 | [type="submit"] { 237 | -webkit-appearance: button; 238 | } 239 | 240 | button:not(:disabled), 241 | [type="button"]:not(:disabled), 242 | [type="reset"]:not(:disabled), 243 | [type="submit"]:not(:disabled) { 244 | cursor: pointer; 245 | } 246 | 247 | button::-moz-focus-inner, 248 | [type="button"]::-moz-focus-inner, 249 | [type="reset"]::-moz-focus-inner, 250 | [type="submit"]::-moz-focus-inner { 251 | padding: 0; 252 | border-style: none; 253 | } 254 | 255 | input[type="radio"], 256 | input[type="checkbox"] { 257 | box-sizing: border-box; 258 | padding: 0; 259 | } 260 | 261 | input[type="date"], 262 | input[type="time"], 263 | input[type="datetime-local"], 264 | input[type="month"] { 265 | -webkit-appearance: listbox; 266 | } 267 | 268 | textarea { 269 | overflow: auto; 270 | resize: vertical; 271 | } 272 | 273 | fieldset { 274 | min-width: 0; 275 | padding: 0; 276 | margin: 0; 277 | border: 0; 278 | } 279 | 280 | legend { 281 | display: block; 282 | width: 100%; 283 | max-width: 100%; 284 | padding: 0; 285 | margin-bottom: .5rem; 286 | font-size: 1.5rem; 287 | line-height: inherit; 288 | color: inherit; 289 | white-space: normal; 290 | } 291 | 292 | progress { 293 | vertical-align: baseline; 294 | } 295 | 296 | [type="number"]::-webkit-inner-spin-button, 297 | [type="number"]::-webkit-outer-spin-button { 298 | height: auto; 299 | } 300 | 301 | [type="search"] { 302 | outline-offset: -2px; 303 | -webkit-appearance: none; 304 | } 305 | 306 | [type="search"]::-webkit-search-decoration { 307 | -webkit-appearance: none; 308 | } 309 | 310 | ::-webkit-file-upload-button { 311 | font: inherit; 312 | -webkit-appearance: button; 313 | } 314 | 315 | output { 316 | display: inline-block; 317 | } 318 | 319 | summary { 320 | display: list-item; 321 | cursor: pointer; 322 | } 323 | 324 | template { 325 | display: none; 326 | } 327 | 328 | [hidden] { 329 | display: none !important; 330 | } 331 | /*# sourceMappingURL=bootstrap-reboot.css.map */ -------------------------------------------------------------------------------- /onlineExam/templates/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {# #} 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 在线考试系统 16 | 17 | 18 | 19 | 20 | 52 | 53 |
54 | 55 |
56 | 57 | 68 | 69 | 70 |
71 |

72 |

个人信息

73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 |
属性信息
学号{{ student.id }}
姓名{{ student.name }}
性别{{ student.sex }}
学院{{ student.dept }}
专业{{ student.major }}
邮箱地址{{ student.email }}
出生日期{{ student.birth }}
123 |
124 | 125 | 160 | 161 | 190 |
191 |
192 | 193 | 194 | {#学生登录的模态对话框#} 195 | 232 | 233 | {#老师登录的模态对话框#} 234 | 271 | 272 | 273 | 274 | 279 | -------------------------------------------------------------------------------- /onlineExam/.idea/workspace.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 22 | 23 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 127 | 128 | 129 | 130 | 131 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 1559978516002 161 | 197 | 198 | 199 | 200 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 242 | 243 | 244 | 245 | 246 | file://$PROJECT_DIR$/templates/index.html 247 | 84 248 | 250 | 251 | file://$PROJECT_DIR$/templates/exam.html 252 | 70 253 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 436 | 437 | 438 | 439 | 440 | 441 | 442 | 443 | 444 | 445 | 446 | 447 | 448 | 449 | 450 | 451 | 452 | 453 | 454 | 455 | 456 | 457 | 458 | 463 | 464 | 465 | 466 | 467 | 468 | -------------------------------------------------------------------------------- /mysql数据库/exam.sql: -------------------------------------------------------------------------------- 1 | /* 2 | Navicat MySQL Data Transfer 3 | 4 | Source Server : mysql5.6 5 | Source Server Version : 50620 6 | Source Host : localhost:3306 7 | Source Database : exam 8 | 9 | Target Server Type : MYSQL 10 | Target Server Version : 50620 11 | File Encoding : 65001 12 | 13 | Date: 2020-07-03 00:12:31 14 | */ 15 | 16 | SET FOREIGN_KEY_CHECKS=0; 17 | 18 | -- ---------------------------- 19 | -- Table structure for `auth_group` 20 | -- ---------------------------- 21 | DROP TABLE IF EXISTS `auth_group`; 22 | CREATE TABLE `auth_group` ( 23 | `id` int(11) NOT NULL AUTO_INCREMENT, 24 | `name` varchar(150) NOT NULL, 25 | PRIMARY KEY (`id`), 26 | UNIQUE KEY `name` (`name`) 27 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 28 | 29 | -- ---------------------------- 30 | -- Records of auth_group 31 | -- ---------------------------- 32 | 33 | -- ---------------------------- 34 | -- Table structure for `auth_group_permissions` 35 | -- ---------------------------- 36 | DROP TABLE IF EXISTS `auth_group_permissions`; 37 | CREATE TABLE `auth_group_permissions` ( 38 | `id` int(11) NOT NULL AUTO_INCREMENT, 39 | `group_id` int(11) NOT NULL, 40 | `permission_id` int(11) NOT NULL, 41 | PRIMARY KEY (`id`), 42 | UNIQUE KEY `auth_group_permissions_group_id_permission_id_0cd325b0_uniq` (`group_id`,`permission_id`), 43 | KEY `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` (`permission_id`), 44 | CONSTRAINT `auth_group_permissio_permission_id_84c5c92e_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), 45 | CONSTRAINT `auth_group_permissions_group_id_b120cbf9_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`) 46 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 47 | 48 | -- ---------------------------- 49 | -- Records of auth_group_permissions 50 | -- ---------------------------- 51 | 52 | -- ---------------------------- 53 | -- Table structure for `auth_permission` 54 | -- ---------------------------- 55 | DROP TABLE IF EXISTS `auth_permission`; 56 | CREATE TABLE `auth_permission` ( 57 | `id` int(11) NOT NULL AUTO_INCREMENT, 58 | `name` varchar(255) NOT NULL, 59 | `content_type_id` int(11) NOT NULL, 60 | `codename` varchar(100) NOT NULL, 61 | PRIMARY KEY (`id`), 62 | UNIQUE KEY `auth_permission_content_type_id_codename_01ab375a_uniq` (`content_type_id`,`codename`), 63 | CONSTRAINT `auth_permission_content_type_id_2f476e4b_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`) 64 | ) ENGINE=InnoDB AUTO_INCREMENT=45 DEFAULT CHARSET=utf8; 65 | 66 | -- ---------------------------- 67 | -- Records of auth_permission 68 | -- ---------------------------- 69 | INSERT INTO `auth_permission` VALUES ('1', 'Can add log entry', '1', 'add_logentry'); 70 | INSERT INTO `auth_permission` VALUES ('2', 'Can change log entry', '1', 'change_logentry'); 71 | INSERT INTO `auth_permission` VALUES ('3', 'Can delete log entry', '1', 'delete_logentry'); 72 | INSERT INTO `auth_permission` VALUES ('4', 'Can view log entry', '1', 'view_logentry'); 73 | INSERT INTO `auth_permission` VALUES ('5', 'Can add permission', '2', 'add_permission'); 74 | INSERT INTO `auth_permission` VALUES ('6', 'Can change permission', '2', 'change_permission'); 75 | INSERT INTO `auth_permission` VALUES ('7', 'Can delete permission', '2', 'delete_permission'); 76 | INSERT INTO `auth_permission` VALUES ('8', 'Can view permission', '2', 'view_permission'); 77 | INSERT INTO `auth_permission` VALUES ('9', 'Can add group', '3', 'add_group'); 78 | INSERT INTO `auth_permission` VALUES ('10', 'Can change group', '3', 'change_group'); 79 | INSERT INTO `auth_permission` VALUES ('11', 'Can delete group', '3', 'delete_group'); 80 | INSERT INTO `auth_permission` VALUES ('12', 'Can view group', '3', 'view_group'); 81 | INSERT INTO `auth_permission` VALUES ('13', 'Can add user', '4', 'add_user'); 82 | INSERT INTO `auth_permission` VALUES ('14', 'Can change user', '4', 'change_user'); 83 | INSERT INTO `auth_permission` VALUES ('15', 'Can delete user', '4', 'delete_user'); 84 | INSERT INTO `auth_permission` VALUES ('16', 'Can view user', '4', 'view_user'); 85 | INSERT INTO `auth_permission` VALUES ('17', 'Can add content type', '5', 'add_contenttype'); 86 | INSERT INTO `auth_permission` VALUES ('18', 'Can change content type', '5', 'change_contenttype'); 87 | INSERT INTO `auth_permission` VALUES ('19', 'Can delete content type', '5', 'delete_contenttype'); 88 | INSERT INTO `auth_permission` VALUES ('20', 'Can view content type', '5', 'view_contenttype'); 89 | INSERT INTO `auth_permission` VALUES ('21', 'Can add session', '6', 'add_session'); 90 | INSERT INTO `auth_permission` VALUES ('22', 'Can change session', '6', 'change_session'); 91 | INSERT INTO `auth_permission` VALUES ('23', 'Can delete session', '6', 'delete_session'); 92 | INSERT INTO `auth_permission` VALUES ('24', 'Can view session', '6', 'view_session'); 93 | INSERT INTO `auth_permission` VALUES ('25', 'Can add 成绩', '7', 'add_grade'); 94 | INSERT INTO `auth_permission` VALUES ('26', 'Can change 成绩', '7', 'change_grade'); 95 | INSERT INTO `auth_permission` VALUES ('27', 'Can delete 成绩', '7', 'delete_grade'); 96 | INSERT INTO `auth_permission` VALUES ('28', 'Can view 成绩', '7', 'view_grade'); 97 | INSERT INTO `auth_permission` VALUES ('29', 'Can add 试卷', '8', 'add_paper'); 98 | INSERT INTO `auth_permission` VALUES ('30', 'Can change 试卷', '8', 'change_paper'); 99 | INSERT INTO `auth_permission` VALUES ('31', 'Can delete 试卷', '8', 'delete_paper'); 100 | INSERT INTO `auth_permission` VALUES ('32', 'Can view 试卷', '8', 'view_paper'); 101 | INSERT INTO `auth_permission` VALUES ('33', 'Can add 单项选择题库', '9', 'add_question'); 102 | INSERT INTO `auth_permission` VALUES ('34', 'Can change 单项选择题库', '9', 'change_question'); 103 | INSERT INTO `auth_permission` VALUES ('35', 'Can delete 单项选择题库', '9', 'delete_question'); 104 | INSERT INTO `auth_permission` VALUES ('36', 'Can view 单项选择题库', '9', 'view_question'); 105 | INSERT INTO `auth_permission` VALUES ('37', 'Can add 学生', '10', 'add_student'); 106 | INSERT INTO `auth_permission` VALUES ('38', 'Can change 学生', '10', 'change_student'); 107 | INSERT INTO `auth_permission` VALUES ('39', 'Can delete 学生', '10', 'delete_student'); 108 | INSERT INTO `auth_permission` VALUES ('40', 'Can view 学生', '10', 'view_student'); 109 | INSERT INTO `auth_permission` VALUES ('41', 'Can add 教师', '11', 'add_teacher'); 110 | INSERT INTO `auth_permission` VALUES ('42', 'Can change 教师', '11', 'change_teacher'); 111 | INSERT INTO `auth_permission` VALUES ('43', 'Can delete 教师', '11', 'delete_teacher'); 112 | INSERT INTO `auth_permission` VALUES ('44', 'Can view 教师', '11', 'view_teacher'); 113 | 114 | -- ---------------------------- 115 | -- Table structure for `auth_user` 116 | -- ---------------------------- 117 | DROP TABLE IF EXISTS `auth_user`; 118 | CREATE TABLE `auth_user` ( 119 | `id` int(11) NOT NULL AUTO_INCREMENT, 120 | `password` varchar(128) NOT NULL, 121 | `last_login` datetime(6) DEFAULT NULL, 122 | `is_superuser` tinyint(1) NOT NULL, 123 | `username` varchar(150) NOT NULL, 124 | `first_name` varchar(30) NOT NULL, 125 | `last_name` varchar(150) NOT NULL, 126 | `email` varchar(254) NOT NULL, 127 | `is_staff` tinyint(1) NOT NULL, 128 | `is_active` tinyint(1) NOT NULL, 129 | `date_joined` datetime(6) NOT NULL, 130 | PRIMARY KEY (`id`), 131 | UNIQUE KEY `username` (`username`) 132 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; 133 | 134 | -- ---------------------------- 135 | -- Records of auth_user 136 | -- ---------------------------- 137 | INSERT INTO `auth_user` VALUES ('1', 'pbkdf2_sha256$180000$8JxS3ayvkexK$/+3CGKlUioZEAfE9Y+s/mybe2KKG9droXADHzde3FKU=', '2020-07-02 15:50:11.822453', '1', 'admin', '', '', 'test@163.com', '1', '1', '2020-07-02 14:19:44.049895'); 138 | 139 | -- ---------------------------- 140 | -- Table structure for `auth_user_groups` 141 | -- ---------------------------- 142 | DROP TABLE IF EXISTS `auth_user_groups`; 143 | CREATE TABLE `auth_user_groups` ( 144 | `id` int(11) NOT NULL AUTO_INCREMENT, 145 | `user_id` int(11) NOT NULL, 146 | `group_id` int(11) NOT NULL, 147 | PRIMARY KEY (`id`), 148 | UNIQUE KEY `auth_user_groups_user_id_group_id_94350c0c_uniq` (`user_id`,`group_id`), 149 | KEY `auth_user_groups_group_id_97559544_fk_auth_group_id` (`group_id`), 150 | CONSTRAINT `auth_user_groups_group_id_97559544_fk_auth_group_id` FOREIGN KEY (`group_id`) REFERENCES `auth_group` (`id`), 151 | CONSTRAINT `auth_user_groups_user_id_6a12ed8b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 152 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 153 | 154 | -- ---------------------------- 155 | -- Records of auth_user_groups 156 | -- ---------------------------- 157 | 158 | -- ---------------------------- 159 | -- Table structure for `auth_user_user_permissions` 160 | -- ---------------------------- 161 | DROP TABLE IF EXISTS `auth_user_user_permissions`; 162 | CREATE TABLE `auth_user_user_permissions` ( 163 | `id` int(11) NOT NULL AUTO_INCREMENT, 164 | `user_id` int(11) NOT NULL, 165 | `permission_id` int(11) NOT NULL, 166 | PRIMARY KEY (`id`), 167 | UNIQUE KEY `auth_user_user_permissions_user_id_permission_id_14a6b632_uniq` (`user_id`,`permission_id`), 168 | KEY `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` (`permission_id`), 169 | CONSTRAINT `auth_user_user_permi_permission_id_1fbb5f2c_fk_auth_perm` FOREIGN KEY (`permission_id`) REFERENCES `auth_permission` (`id`), 170 | CONSTRAINT `auth_user_user_permissions_user_id_a95ead1b_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 171 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 172 | 173 | -- ---------------------------- 174 | -- Records of auth_user_user_permissions 175 | -- ---------------------------- 176 | 177 | -- ---------------------------- 178 | -- Table structure for `django_admin_log` 179 | -- ---------------------------- 180 | DROP TABLE IF EXISTS `django_admin_log`; 181 | CREATE TABLE `django_admin_log` ( 182 | `id` int(11) NOT NULL AUTO_INCREMENT, 183 | `action_time` datetime(6) NOT NULL, 184 | `object_id` longtext, 185 | `object_repr` varchar(200) NOT NULL, 186 | `action_flag` smallint(5) unsigned NOT NULL, 187 | `change_message` longtext NOT NULL, 188 | `content_type_id` int(11) DEFAULT NULL, 189 | `user_id` int(11) NOT NULL, 190 | PRIMARY KEY (`id`), 191 | KEY `django_admin_log_content_type_id_c4bce8eb_fk_django_co` (`content_type_id`), 192 | KEY `django_admin_log_user_id_c564eba6_fk_auth_user_id` (`user_id`), 193 | CONSTRAINT `django_admin_log_content_type_id_c4bce8eb_fk_django_co` FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`), 194 | CONSTRAINT `django_admin_log_user_id_c564eba6_fk_auth_user_id` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) 195 | ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8; 196 | 197 | -- ---------------------------- 198 | -- Records of django_admin_log 199 | -- ---------------------------- 200 | INSERT INTO `django_admin_log` VALUES ('1', '2020-07-02 14:24:01.942909', 'STU001', 'STU001', '1', '[{\"added\": {}}]', '10', '1'); 201 | INSERT INTO `django_admin_log` VALUES ('2', '2020-07-02 14:24:45.581695', 'TH001', '王大山', '1', '[{\"added\": {}}]', '11', '1'); 202 | INSERT INTO `django_admin_log` VALUES ('3', '2020-07-02 14:27:12.451384', '1', '<计算机基础:请问计算机是用的多少进制?>', '1', '[{\"added\": {}}]', '9', '1'); 203 | INSERT INTO `django_admin_log` VALUES ('4', '2020-07-02 14:28:30.907082', '2', '<计算机基础:c语言退出当前循环关键字是什么?>', '1', '[{\"added\": {}}]', '9', '1'); 204 | INSERT INTO `django_admin_log` VALUES ('5', '2020-07-02 14:34:00.717316', '3', '<高等数学:2的3次方等于多少?>', '1', '[{\"added\": {}}]', '9', '1'); 205 | INSERT INTO `django_admin_log` VALUES ('6', '2020-07-02 14:35:08.037972', '1', '计算机科学与技术', '1', '[{\"added\": {}}]', '8', '1'); 206 | INSERT INTO `django_admin_log` VALUES ('7', '2020-07-02 14:48:34.517825', '4', '<计算机基础:下面哪个是后端开发技术?>', '1', '[{\"added\": {}}]', '9', '1'); 207 | INSERT INTO `django_admin_log` VALUES ('8', '2020-07-02 14:50:54.006353', '5', '<计算机基础:下面那个配件是计算机的心脏?>', '1', '[{\"added\": {}}]', '9', '1'); 208 | INSERT INTO `django_admin_log` VALUES ('9', '2020-07-02 14:52:32.263352', '6', '<计算机基础:人工智能开发一般用什么开发语言?>', '1', '[{\"added\": {}}]', '9', '1'); 209 | INSERT INTO `django_admin_log` VALUES ('10', '2020-07-02 14:52:59.395985', '1', '计算机科学与技术', '2', '[{\"changed\": {\"fields\": [\"Pid\"]}}]', '8', '1'); 210 | INSERT INTO `django_admin_log` VALUES ('11', '2020-07-02 14:53:57.040567', '2', '计算机科学与技术', '1', '[{\"added\": {}}]', '8', '1'); 211 | INSERT INTO `django_admin_log` VALUES ('12', '2020-07-02 14:55:15.112295', '7', '<高等数学:2的3次方比3的2次方大小>', '1', '[{\"added\": {}}]', '9', '1'); 212 | INSERT INTO `django_admin_log` VALUES ('13', '2020-07-02 14:57:52.480876', '8', '<高等数学:1+1/2+1/4+1/8+......=多少?>', '1', '[{\"added\": {}}]', '9', '1'); 213 | INSERT INTO `django_admin_log` VALUES ('14', '2020-07-02 15:44:48.237046', 'STU002', 'STU002', '1', '[{\"added\": {}}]', '10', '1'); 214 | INSERT INTO `django_admin_log` VALUES ('15', '2020-07-02 15:45:59.842762', 'TH002', '王大海', '1', '[{\"added\": {}}]', '11', '1'); 215 | INSERT INTO `django_admin_log` VALUES ('16', '2020-07-02 15:50:21.877808', '2', '计算机科学与技术', '2', '[{\"changed\": {\"fields\": [\"Pid\"]}}]', '8', '1'); 216 | 217 | -- ---------------------------- 218 | -- Table structure for `django_content_type` 219 | -- ---------------------------- 220 | DROP TABLE IF EXISTS `django_content_type`; 221 | CREATE TABLE `django_content_type` ( 222 | `id` int(11) NOT NULL AUTO_INCREMENT, 223 | `app_label` varchar(100) NOT NULL, 224 | `model` varchar(100) NOT NULL, 225 | PRIMARY KEY (`id`), 226 | UNIQUE KEY `django_content_type_app_label_model_76bd3d3b_uniq` (`app_label`,`model`) 227 | ) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8; 228 | 229 | -- ---------------------------- 230 | -- Records of django_content_type 231 | -- ---------------------------- 232 | INSERT INTO `django_content_type` VALUES ('1', 'admin', 'logentry'); 233 | INSERT INTO `django_content_type` VALUES ('3', 'auth', 'group'); 234 | INSERT INTO `django_content_type` VALUES ('2', 'auth', 'permission'); 235 | INSERT INTO `django_content_type` VALUES ('4', 'auth', 'user'); 236 | INSERT INTO `django_content_type` VALUES ('5', 'contenttypes', 'contenttype'); 237 | INSERT INTO `django_content_type` VALUES ('6', 'sessions', 'session'); 238 | INSERT INTO `django_content_type` VALUES ('7', 'student', 'grade'); 239 | INSERT INTO `django_content_type` VALUES ('8', 'student', 'paper'); 240 | INSERT INTO `django_content_type` VALUES ('9', 'student', 'question'); 241 | INSERT INTO `django_content_type` VALUES ('10', 'student', 'student'); 242 | INSERT INTO `django_content_type` VALUES ('11', 'student', 'teacher'); 243 | 244 | -- ---------------------------- 245 | -- Table structure for `django_migrations` 246 | -- ---------------------------- 247 | DROP TABLE IF EXISTS `django_migrations`; 248 | CREATE TABLE `django_migrations` ( 249 | `id` int(11) NOT NULL AUTO_INCREMENT, 250 | `app` varchar(255) NOT NULL, 251 | `name` varchar(255) NOT NULL, 252 | `applied` datetime(6) NOT NULL, 253 | PRIMARY KEY (`id`) 254 | ) ENGINE=InnoDB AUTO_INCREMENT=24 DEFAULT CHARSET=utf8; 255 | 256 | -- ---------------------------- 257 | -- Records of django_migrations 258 | -- ---------------------------- 259 | INSERT INTO `django_migrations` VALUES ('1', 'contenttypes', '0001_initial', '2020-07-02 14:17:56.623582'); 260 | INSERT INTO `django_migrations` VALUES ('2', 'auth', '0001_initial', '2020-07-02 14:17:56.964487'); 261 | INSERT INTO `django_migrations` VALUES ('3', 'admin', '0001_initial', '2020-07-02 14:17:57.609705'); 262 | INSERT INTO `django_migrations` VALUES ('4', 'admin', '0002_logentry_remove_auto_add', '2020-07-02 14:17:57.761107'); 263 | INSERT INTO `django_migrations` VALUES ('5', 'admin', '0003_logentry_add_action_flag_choices', '2020-07-02 14:17:57.778152'); 264 | INSERT INTO `django_migrations` VALUES ('6', 'contenttypes', '0002_remove_content_type_name', '2020-07-02 14:17:57.936573'); 265 | INSERT INTO `django_migrations` VALUES ('7', 'auth', '0002_alter_permission_name_max_length', '2020-07-02 14:17:57.998739'); 266 | INSERT INTO `django_migrations` VALUES ('8', 'auth', '0003_alter_user_email_max_length', '2020-07-02 14:17:58.079454'); 267 | INSERT INTO `django_migrations` VALUES ('9', 'auth', '0004_alter_user_username_opts', '2020-07-02 14:17:58.095997'); 268 | INSERT INTO `django_migrations` VALUES ('10', 'auth', '0005_alter_user_last_login_null', '2020-07-02 14:17:58.171699'); 269 | INSERT INTO `django_migrations` VALUES ('11', 'auth', '0006_require_contenttypes_0002', '2020-07-02 14:17:58.179219'); 270 | INSERT INTO `django_migrations` VALUES ('12', 'auth', '0007_alter_validators_add_error_messages', '2020-07-02 14:17:58.200275'); 271 | INSERT INTO `django_migrations` VALUES ('13', 'auth', '0008_alter_user_username_max_length', '2020-07-02 14:17:58.281778'); 272 | INSERT INTO `django_migrations` VALUES ('14', 'auth', '0009_alter_user_last_name_max_length', '2020-07-02 14:17:58.368007'); 273 | INSERT INTO `django_migrations` VALUES ('15', 'auth', '0010_alter_group_name_max_length', '2020-07-02 14:17:58.458749'); 274 | INSERT INTO `django_migrations` VALUES ('16', 'auth', '0011_update_proxy_permissions', '2020-07-02 14:17:58.478300'); 275 | INSERT INTO `django_migrations` VALUES ('17', 'sessions', '0001_initial', '2020-07-02 14:17:58.526930'); 276 | INSERT INTO `django_migrations` VALUES ('18', 'student', '0001_initial', '2020-07-02 14:17:59.014193'); 277 | INSERT INTO `django_migrations` VALUES ('19', 'student', '0002_auto_20190609_1126', '2020-07-02 14:17:59.185647'); 278 | INSERT INTO `django_migrations` VALUES ('20', 'student', '0003_auto_20190609_1128', '2020-07-02 14:17:59.200686'); 279 | INSERT INTO `django_migrations` VALUES ('21', 'student', '0004_auto_20190609_1134', '2020-07-02 14:17:59.291428'); 280 | INSERT INTO `django_migrations` VALUES ('22', 'student', '0005_auto_20190609_1914', '2020-07-02 14:17:59.304963'); 281 | INSERT INTO `django_migrations` VALUES ('23', 'student', '0006_auto_20200702_2217', '2020-07-02 14:17:59.321006'); 282 | 283 | -- ---------------------------- 284 | -- Table structure for `django_session` 285 | -- ---------------------------- 286 | DROP TABLE IF EXISTS `django_session`; 287 | CREATE TABLE `django_session` ( 288 | `session_key` varchar(40) NOT NULL, 289 | `session_data` longtext NOT NULL, 290 | `expire_date` datetime(6) NOT NULL, 291 | PRIMARY KEY (`session_key`), 292 | KEY `django_session_expire_date_a5c62663` (`expire_date`) 293 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 294 | 295 | -- ---------------------------- 296 | -- Records of django_session 297 | -- ---------------------------- 298 | 299 | -- ---------------------------- 300 | -- Table structure for `grade` 301 | -- ---------------------------- 302 | DROP TABLE IF EXISTS `grade`; 303 | CREATE TABLE `grade` ( 304 | `id` int(11) NOT NULL AUTO_INCREMENT, 305 | `grade` int(11) NOT NULL, 306 | `sid_id` varchar(20) NOT NULL, 307 | `subject` varchar(20) NOT NULL, 308 | PRIMARY KEY (`id`), 309 | KEY `grade_sid_id_7de9086e_fk_student_id` (`sid_id`), 310 | CONSTRAINT `grade_sid_id_7de9086e_fk_student_id` FOREIGN KEY (`sid_id`) REFERENCES `student` (`id`) 311 | ) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8; 312 | 313 | -- ---------------------------- 314 | -- Records of grade 315 | -- ---------------------------- 316 | INSERT INTO `grade` VALUES ('1', '80', 'STU001', '计算机基础'); 317 | INSERT INTO `grade` VALUES ('2', '60', 'STU001', '高等数学'); 318 | INSERT INTO `grade` VALUES ('3', '100', 'STU002', '计算机基础'); 319 | INSERT INTO `grade` VALUES ('4', '60', 'STU002', '高等数学'); 320 | 321 | -- ---------------------------- 322 | -- Table structure for `paper` 323 | -- ---------------------------- 324 | DROP TABLE IF EXISTS `paper`; 325 | CREATE TABLE `paper` ( 326 | `id` int(11) NOT NULL AUTO_INCREMENT, 327 | `subject` varchar(20) NOT NULL, 328 | `major` varchar(20) NOT NULL, 329 | `examtime` datetime(6) NOT NULL, 330 | `tid_id` varchar(20) NOT NULL, 331 | PRIMARY KEY (`id`), 332 | KEY `paper_tid_id_ddacd8df_fk_teacher_id` (`tid_id`), 333 | CONSTRAINT `paper_tid_id_ddacd8df_fk_teacher_id` FOREIGN KEY (`tid_id`) REFERENCES `teacher` (`id`) 334 | ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8; 335 | 336 | -- ---------------------------- 337 | -- Records of paper 338 | -- ---------------------------- 339 | INSERT INTO `paper` VALUES ('1', '计算机基础', '计算机科学与技术', '2020-07-02 14:40:00.000000', 'TH001'); 340 | INSERT INTO `paper` VALUES ('2', '高等数学', '计算机科学与技术', '2020-07-05 06:00:00.000000', 'TH001'); 341 | 342 | -- ---------------------------- 343 | -- Table structure for `paper_pid` 344 | -- ---------------------------- 345 | DROP TABLE IF EXISTS `paper_pid`; 346 | CREATE TABLE `paper_pid` ( 347 | `id` int(11) NOT NULL AUTO_INCREMENT, 348 | `paper_id` int(11) NOT NULL, 349 | `question_id` int(11) NOT NULL, 350 | PRIMARY KEY (`id`), 351 | UNIQUE KEY `paper_pid_paper_id_question_id_566d3fd0_uniq` (`paper_id`,`question_id`), 352 | KEY `paper_pid_question_id_066d7dbd_fk_question_id` (`question_id`), 353 | CONSTRAINT `paper_pid_paper_id_56658225_fk_paper_id` FOREIGN KEY (`paper_id`) REFERENCES `paper` (`id`), 354 | CONSTRAINT `paper_pid_question_id_066d7dbd_fk_question_id` FOREIGN KEY (`question_id`) REFERENCES `question` (`id`) 355 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; 356 | 357 | -- ---------------------------- 358 | -- Records of paper_pid 359 | -- ---------------------------- 360 | INSERT INTO `paper_pid` VALUES ('1', '1', '1'); 361 | INSERT INTO `paper_pid` VALUES ('2', '1', '2'); 362 | INSERT INTO `paper_pid` VALUES ('3', '1', '4'); 363 | INSERT INTO `paper_pid` VALUES ('4', '1', '5'); 364 | INSERT INTO `paper_pid` VALUES ('5', '1', '6'); 365 | INSERT INTO `paper_pid` VALUES ('6', '2', '3'); 366 | INSERT INTO `paper_pid` VALUES ('8', '2', '7'); 367 | INSERT INTO `paper_pid` VALUES ('7', '2', '8'); 368 | 369 | -- ---------------------------- 370 | -- Table structure for `question` 371 | -- ---------------------------- 372 | DROP TABLE IF EXISTS `question`; 373 | CREATE TABLE `question` ( 374 | `id` int(11) NOT NULL AUTO_INCREMENT, 375 | `subject` varchar(20) NOT NULL, 376 | `title` longtext NOT NULL, 377 | `optionA` varchar(30) NOT NULL, 378 | `optionB` varchar(30) NOT NULL, 379 | `optionC` varchar(30) NOT NULL, 380 | `optionD` varchar(30) NOT NULL, 381 | `answer` varchar(10) NOT NULL, 382 | `level` varchar(10) NOT NULL, 383 | `score` int(11) NOT NULL, 384 | PRIMARY KEY (`id`) 385 | ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8; 386 | 387 | -- ---------------------------- 388 | -- Records of question 389 | -- ---------------------------- 390 | INSERT INTO `question` VALUES ('1', '计算机基础', '请问计算机是用的多少进制?', '二进制', '8进制', '16进制', '十进制', 'A', '1', '20'); 391 | INSERT INTO `question` VALUES ('2', '计算机基础', 'c语言退出当前循环关键字是什么?', 'else', 'if', 'while', 'continue', 'D', '1', '20'); 392 | INSERT INTO `question` VALUES ('3', '高等数学', '2的3次方等于多少?', '6', '8', '10', '12', 'B', '2', '20'); 393 | INSERT INTO `question` VALUES ('4', '计算机基础', '下面哪个是后端开发技术?', 'css', 'html', 'javascript', 'java', 'D', '2', '20'); 394 | INSERT INTO `question` VALUES ('5', '计算机基础', '下面那个配件是计算机的心脏?', '键盘', '显示器', 'cpu', 'DDR内存', 'C', '2', '20'); 395 | INSERT INTO `question` VALUES ('6', '计算机基础', '人工智能开发一般用什么开发语言?', 'Java语言', 'C语言', 'Python语言', 'GO语言', 'C', '2', '20'); 396 | INSERT INTO `question` VALUES ('7', '高等数学', '2的3次方比3的2次方大小', '前者大', '一样大', '后者大', '不确定', 'C', '1', '20'); 397 | INSERT INTO `question` VALUES ('8', '高等数学', '1+1/2+1/4+1/8+......=多少?', '3', '2', '4', '5', 'B', '3', '20'); 398 | 399 | -- ---------------------------- 400 | -- Table structure for `student` 401 | -- ---------------------------- 402 | DROP TABLE IF EXISTS `student`; 403 | CREATE TABLE `student` ( 404 | `id` varchar(20) NOT NULL, 405 | `name` varchar(20) NOT NULL, 406 | `sex` varchar(4) NOT NULL, 407 | `dept` varchar(20) NOT NULL, 408 | `major` varchar(20) NOT NULL, 409 | `password` varchar(20) NOT NULL, 410 | `email` varchar(254) NOT NULL, 411 | `birth` date NOT NULL, 412 | PRIMARY KEY (`id`) 413 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 414 | 415 | -- ---------------------------- 416 | -- Records of student 417 | -- ---------------------------- 418 | INSERT INTO `student` VALUES ('STU001', '张小琴', '女', '计算机与通信学院', '计算机科学与技术', '111', 'xiaoqin@163.com', '2020-04-16'); 419 | INSERT INTO `student` VALUES ('STU002', '李明涛', '男', '计算机与通信学院', '计算机科学与技术', '111', 'mingtao@126.com', '2003-11-21'); 420 | 421 | -- ---------------------------- 422 | -- Table structure for `teacher` 423 | -- ---------------------------- 424 | DROP TABLE IF EXISTS `teacher`; 425 | CREATE TABLE `teacher` ( 426 | `id` varchar(20) NOT NULL, 427 | `name` varchar(20) NOT NULL, 428 | `sex` varchar(4) NOT NULL, 429 | `dept` varchar(20) NOT NULL, 430 | `email` varchar(254) NOT NULL, 431 | `password` varchar(20) NOT NULL, 432 | `birth` date NOT NULL, 433 | PRIMARY KEY (`id`) 434 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 435 | 436 | -- ---------------------------- 437 | -- Records of teacher 438 | -- ---------------------------- 439 | INSERT INTO `teacher` VALUES ('TH001', '王大山', '男', '计算机与通信学院', 'dashan@163.com', '000000', '1990-04-16'); 440 | INSERT INTO `teacher` VALUES ('TH002', '王大海', '男', '计算机与通信学院', 'dahai@163.com', '000000', '1992-11-05'); 441 | -------------------------------------------------------------------------------- /onlineExam/static/js/jquery.countdown.js: -------------------------------------------------------------------------------- 1 | /* 2 | * jQuery Countdown - v1.2.8 3 | * http://github.com/kemar/jquery.countdown 4 | * Licensed MIT 5 | */ 6 | (function ($, window, document, undefined) { 7 | 8 | "use strict"; 9 | 10 | /* 11 | * .countDown() 12 | * 13 | * Description: 14 | * Unobtrusive and easily skinable countdown jQuery plugin. 15 | * 16 | * Usage: 17 | * $(element).countDown() 18 | * 19 | * $(element) is a valid