1 Star 10 Fork 5

云中有鹿来 / 随堂考核题库系统

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
AFL-3.0

信息工程学院随堂考核题库小系统

老师提出的要求:前提条件,便于机房有还原的电脑使用,最好开箱即用,无需配置运行环境,不能接入外网,成绩数据老师安全可控,不可远程连接mysql等数据库。提供web服务供学生访问提交数据。题库试题excel导入,老师发布考试,学生答题,成绩自动写入教务处发放的课程平时成绩excel表格。每个学生的题目顺序不同,答案选项不同,考试有时间限制,一旦过了考试时间0分处理,学生自行找老师后台修改该生成绩。学生人员来自教务处发放的班级名单excel。确保程序的可共享性。(A老师分享这个程序给B老师使用,B老师拿到后一数据从0开始)

窗体程序老师端

老师开启程序后即可开始服务一方面提供web服务供学生访问,一方面供老师进行数据操作,比如题库导入,学生名单导入,组卷,查看学生考试记录详情,查看修改学生分数,导入导出成绩excel


Web学生端

学生靠学号姓名登录系统,学生列表来源于老师导入的班级学生名单。选择考试。进行考试。查看考试得分。学生的试题顺序随机,答案选项顺序随机。有单选题,多选题,判断题,不定项选择题。


所采用的技术及架构:

界面显示及打包:electron-vue,element-ui,vue-cli,electron-builder 网络交互:axios 后台服务:koa,ejs,koa-router,koa-bodyparser,koa2-cors,nodejs 数据操作:sqlite3.js,knex.js,bookselft.js , node-xlsx.js, ejsexcel.js

框架逻辑:

后段部分基于nodejs采用koa框架提供web服务及api接口,koa-router提供api接口路由管理,koa2-cors进行开发阶段vue的跨域请求处理,使用Bookshelf.js 封装数据库操作orm方式访问数据库,knex.js为bookshelf.js提供二级接口,sqlite3.js为knex.js提供一级数据操作接口,进行数据存取查询,使用koa-bodyparser 进行post参数的接收处理,node-xlsx.js进行导入excel表格的数据解析处理,ejsexcel.js 进行excel导出的数据模版渲染,最后使用ejs模版进行学生vue端最终编译文件的模版整合操作,使得web界面按路由渲染。 前端部分采用vue-cli进行基础搭建,使用element-ui进行界面组织,axios请求于后段api接口进行通信操作。最后使用electron-vue进行代码封装,electron-builder进行前后端打包整合输出exe可执行文件


源码使用方法

git clone https://gitee.com/likecy/tiku_mnu.git
进入后台目录:cd tiku_mnu/tiku_mnu后端
安装依赖:cnpm install
安装electron sqlite3 本地编译 :cnpm install sqlite3 --build-from-source --runtime=electron --target=2.0.18 --dist-url=https://atom.io/download/electron

此处win系统安装编译版本的sqlite3可能会报错,超级大坑。解决方式见链接:https://blog.csdn.net/superassassin/article/details/82804160

安装依赖完成后运行: cnpm run dev 
打包:cnpm run build 
mac电脑:cnpm run mac
win电脑:cnpm run win32

这里使用cnpm打包会报错,报错如下:

使用yarn 运行打包命令即可避免node 内存泄露,网上vue-cli方式添加缓存区方式不成功。

重新打包如下:

yarn install 
yarn run dev 或者 yarn run build 

学生前端web界面

cd student_vue

cnpm install

cnpm run dev

开发模式请将 src/untils/request.js 中的axios基地址改为"http://127.0.0.1:8080",开发完成最后打包之前才将基地址改为"/"

// 创建axios实例
const service = axios.create({
  baseURL: '/', // api的base_url  开发模式请填http://127.0.0.1:8080 生产模式请填:/
  timeout: 150000 // 请求超时时间
})
export default service

请求接口文件一律在src/api 目录

import request from '../untils/request'
const api  = {
		//获取考试列表
	getExamList(student_num){
		return request({
		  url: 'getExamList',
		  method: 'post',
		  data: {
		      student_num:student_num
		  }
		})
    
		//................
	
  //在这里添加其他接口请求 全局使用 this.$api.接口函数名 即可访问
}


export default api

自定义编辑前端界面后需要重新打包

cnpm run build 

将最后编译完成的dist目录内的文件复制到我们的后台框架 static/student_view 进行替换。

再次打包运行后端即可

代码讲解

koa服务入口文件

var Koa = require('koa'),
	router = require('koa-router')(),
	views = require('koa-views'),
	bodyParser = require('koa-bodyparser'),
	cors = require('koa2-cors');
const app_sever = new Koa();

app_sever.use(bodyParser());	
app_sever.use(require('koa-static')(__static+'/student_view'));
app_sever.use(views(__static+'/student_view', { map: {html: 'ejs' }}));
app_sever.use(cors());


var teacher = require('./router/teacher.js');
var student = require('./router/student.js');

router.use('/teacher',teacher);
router.use('/',student);


app_sever.use(router.routes());
app_sever.use(router.allowedMethods());
app_sever.listen(8080, () => console.log('Example app listening on port 8080!'))

这里推荐B站大地老师的koa入门视频,传送门:https://www.bilibili.com/video/av38925557?p=26

koa整合数据库sqlite3 使用的是booksheft.js.百度文档参差不齐,建议直接到官网食用英文原版api接口说明,传送门:https://bookshelfjs.org/api.html

koa后台web服务整合好后就可以在electron-vue 的主进程中引用koa启动文件app.js啦

//src/main/index.js


//加载后台api接口
 require('./sever/app.js') //引入koa编写的api接口服务
require('./openwindow.js') //electron使用系统原生窗体选择文件等

let mainWindow
const winURL = process.env.NODE_ENV === 'development'
  ? `http://localhost:9080`
  : `file://${__dirname}/index.html`

function createWindow () {
  /**
   * Initial window options
   */
  Menu.setApplicationMenu(null)
  mainWindow = new BrowserWindow({
    height: 563,
    useContentSize: true,
    width: 1000,
	autoHideMenuBar:true,
	webPreferences: {webSecurity: false}
  })

最后附上几张项目完整截图:


整个小项目个人历时将近10天,从0基础koa学习到electron-vue的顺利打包发布,幸运的抓住了2019年最后的尾巴~~~

云中有鹿 2019/12/31

Academic Free License (“AFL”) v. 3.0 This Academic Free License (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work: Licensed under the Academic Free License version 3.0 1) Grant of Copyright License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, for the duration of the copyright, to do the following: a) to reproduce the Original Work in copies, either alone or as part of a collective work; b) to translate, adapt, alter, transform, modify, or arrange the Original Work, thereby creating derivative works ("Derivative Works") based upon the Original Work; c) to distribute or communicate copies of the Original Work and Derivative Works to the public, under any license of your choice that does not contradict the terms and conditions, including Licensor’s reserved rights and remedies, in this Academic Free License; d) to perform the Original Work publicly; and e) to display the Original Work publicly. 2) Grant of Patent License. Licensor grants You a worldwide, royalty-free, non-exclusive, sublicensable license, under patent claims owned or controlled by the Licensor that are embodied in the Original Work as furnished by the Licensor, for the duration of the patents, to make, use, sell, offer for sale, have made, and import the Original Work and Derivative Works. 3) Grant of Source Code License. The term "Source Code" means the preferred form of the Original Work for making modifications to it and all available documentation describing how to modify the Original Work. Licensor agrees to provide a machine-readable copy of the Source Code of the Original Work along with each copy of the Original Work that Licensor distributes. Licensor reserves the right to satisfy this obligation by placing a machine-readable copy of the Source Code in an information repository reasonably calculated to permit inexpensive and convenient access by You for as long as Licensor continues to distribute the Original Work. 4) Exclusions From License Grant. Neither the names of Licensor, nor the names of any contributors to the Original Work, nor any of their trademarks or service marks, may be used to endorse or promote products derived from this Original Work without express prior permission of the Licensor. Except as expressly stated herein, nothing in this License grants any license to Licensor’s trademarks, copyrights, patents, trade secrets or any other intellectual property. No patent license is granted to make, use, sell, offer for sale, have made, or import embodiments of any patent claims other than the licensed claims defined in Section 2. No license is granted to the trademarks of Licensor even if such marks are included in the Original Work. Nothing in this License shall be interpreted to prohibit Licensor from licensing under terms different from this License any Original Work that Licensor otherwise would have a right to license. 5) External Deployment. The term "External Deployment" means the use, distribution, or communication of the Original Work or Derivative Works in any way such that the Original Work or Derivative Works may be used by anyone other than You, whether those works are distributed or communicated to those persons or made available as an application intended for use over a network. As an express condition for the grants of license hereunder, You must treat any External Deployment by You of the Original Work or a Derivative Work as a distribution under section 1(c). 6) Attribution Rights. You must retain, in the Source Code of any Derivative Works that You create, all copyright, patent, or trademark notices from the Source Code of the Original Work, as well as any notices of licensing and any descriptive text identified therein as an "Attribution Notice." You must cause the Source Code for any Derivative Works that You create to carry a prominent Attribution Notice reasonably calculated to inform recipients that You have modified the Original Work. 7) Warranty of Provenance and Disclaimer of Warranty. Licensor warrants that the copyright in and to the Original Work and the patent rights granted herein by Licensor are owned by the Licensor or are sublicensed to You under the terms of this License with the permission of the contributor(s) of those copyrights and patent rights. Except as expressly stated in the immediately preceding sentence, the Original Work is provided under this License on an "AS IS" BASIS and WITHOUT WARRANTY, either express or implied, including, without limitation, the warranties of non-infringement, merchantability or fitness for a particular purpose. THE ENTIRE RISK AS TO THE QUALITY OF THE ORIGINAL WORK IS WITH YOU. This DISCLAIMER OF WARRANTY constitutes an essential part of this License. No license to the Original Work is granted by this License except under this disclaimer. 8) Limitation of Liability. Under no circumstances and under no legal theory, whether in tort (including negligence), contract, or otherwise, shall the Licensor be liable to anyone for any indirect, special, incidental, or consequential damages of any character arising as a result of this License or the use of the Original Work including, without limitation, damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses. This limitation of liability shall not apply to the extent applicable law prohibits such limitation. 9) Acceptance and Termination. If, at any time, You expressly assented to this License, that assent indicates your clear and irrevocable acceptance of this License and all of its terms and conditions. If You distribute or communicate copies of the Original Work or a Derivative Work, You must make a reasonable effort under the circumstances to obtain the express assent of recipients to the terms of this License. This License conditions your rights to undertake the activities listed in Section 1, including your right to create Derivative Works based upon the Original Work, and doing so without honoring these terms and conditions is prohibited by copyright law and international treaty. Nothing in this License is intended to affect copyright exceptions and limitations (including “fair use” or “fair dealing”). This License shall terminate immediately and You may no longer exercise any of the rights granted to You by this License upon your failure to honor the conditions in Section 1(c). 10) Termination for Patent Action. This License shall terminate automatically and You may no longer exercise any of the rights granted to You by this License as of the date You commence an action, including a cross-claim or counterclaim, against Licensor or any licensee alleging that the Original Work infringes a patent. This termination provision shall not apply for an action alleging patent infringement by combinations of the Original Work with other software or hardware. 11) Jurisdiction, Venue and Governing Law. Any action or suit relating to this License may be brought only in the courts of a jurisdiction wherein the Licensor resides or in which Licensor conducts its primary business, and under the laws of that jurisdiction excluding its conflict-of-law provisions. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any use of the Original Work outside the scope of this License or after its termination shall be subject to the requirements and penalties of copyright or patent law in the appropriate jurisdiction. This section shall survive the termination of this License. 12) Attorneys’ Fees. In any action to enforce the terms of this License or seeking damages relating thereto, the prevailing party shall be entitled to recover its costs and expenses, including, without limitation, reasonable attorneys' fees and costs incurred in connection with such action, including any appeal of such action. This section shall survive the termination of this License. 13) Miscellaneous. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. 14) Definition of "You" in This License. "You" throughout this License, whether in upper or lower case, means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with you. For purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. 15) Right to Use. You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You. 16) Modification of This License. This License is Copyright © 2005 Lawrence Rosen. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Academic Free License" or "AFL" and you may not use those names in the name of your Modified License; (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License; and (iii) You may not claim that your original works are open source software unless your Modified License has been approved by Open Source Initiative (OSI) and You comply with its license review and certification process.

简介

vue+express+electron 主要方便老师们进行平时成绩的考核以及教务处发放的excel成绩单填写而制作的随机题库系统。老师导入题库,开启考试后,学生登录相应IP进行答题得分记录到每次的平时成绩中,老师可随时导出成绩。系统本身开封即用,程序运行在U盘也可以,无需安装任何依赖。数据库保存到老师的个人U盘,确保数据安全性。 展开 收起
JavaScript 等 6 种语言
AFL-3.0
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/likecy/tiku_mnu.git
git@gitee.com:likecy/tiku_mnu.git
likecy
tiku_mnu
随堂考核题库系统
master

搜索帮助

14c37bed 8189591 565d56ea 8189591