├── .gitignore ├── .idea ├── .name ├── StudentInfo.iml ├── codeStyleSettings.xml ├── encodings.xml ├── jsLibraryMappings.xml ├── libraries │ ├── Generated_files.xml │ └── StudentInfo_node_modules.xml ├── misc.xml ├── modules.xml ├── scopes │ └── scope_settings.xml ├── vcs.xml └── watcherTasks.xml ├── LICENSE ├── README.md ├── app.coffee ├── app.js ├── app.map ├── bin └── www ├── config ├── database.coffee ├── database.js └── database.map ├── doc ├── 10用例图.eap ├── 11代码编写规范 │ ├── FindiX Studio CoffeeScript 编码规范.html │ ├── FindiX Studio CoffeeScript 编码规范.md │ ├── FindiX Studio Node 编码规范.html │ ├── FindiX Studio Node 编码规范.md │ └── Findix Studio Bootstrap 网页静态编码规范 by @mdo.html ├── 12参考资料.md ├── 1可行性研究报告.docx ├── 2项目开发计划.docx ├── 3项目需求规格分析说明书.docx ├── 4项目概要设计规格说明书.docx ├── 5项目详细设计规格说明书.docx ├── 6项目测试计划.docx ├── 7项目测试分析报告.docx ├── 8技术选型清单.txt ├── 9课程设计完成情况说明.md ├── 测试文档 │ ├── Tomcat对比测试.txt │ ├── 二轮测试.txt │ ├── 压力测试报告.html │ ├── 压力测试报告.md │ └── 首轮测试.txt ├── 项目总结 凤翔.docx └── 项目总结 陈龙龙.docx ├── model ├── Course.coffee ├── Course.js ├── Course.map ├── Grade.coffee ├── Grade.js ├── Grade.map ├── Student.js ├── Student.map ├── User.coffee ├── User.js ├── User.map └── student.coffee ├── package.json ├── public ├── favicon.ico ├── fonts │ ├── glyphicons-halflings-regular.eot │ ├── glyphicons-halflings-regular.svg │ ├── glyphicons-halflings-regular.ttf │ └── glyphicons-halflings-regular.woff ├── images │ ├── 404.png │ └── background.jpg ├── javascripts │ ├── bootstrap.js │ ├── bootstrap.min.js │ ├── coffee-script.js │ ├── course.js │ ├── grade.js │ ├── jquery-1.11.1.js │ ├── jquery-1.11.1.min.js │ ├── jquery-1.11.1.min.map │ ├── login.js │ └── student.js └── stylesheets │ ├── bootstrap-theme.css │ ├── bootstrap-theme.css.map │ ├── bootstrap-theme.min.css │ ├── bootstrap.css │ ├── bootstrap.css.map │ ├── bootstrap.min.css │ ├── login.css │ ├── login.less │ ├── main.css │ └── main.less ├── routes ├── course.coffee ├── course.js ├── course.map ├── grade.coffee ├── grade.js ├── grade.map ├── index.coffee ├── index.js ├── index.map ├── student.coffee ├── student.js ├── student.map ├── test.coffee ├── test.js ├── test.map ├── user.coffee ├── user.js └── user.map ├── test ├── courseTest.coffee ├── courseTest.js ├── courseTest.map ├── gradeTest.coffee ├── gradeTest.js ├── gradeTest.map ├── studentTest.coffee ├── studentTest.js ├── studentTest.map ├── userTest.coffee ├── userTest.js └── userTest.map └── views ├── changePasswd.ejs ├── course.ejs ├── error.ejs ├── grade.ejs ├── index.ejs ├── login.ejs ├── public ├── footer.ejs └── nav.ejs └── student.ejs /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | 5 | # Runtime data 6 | pids 7 | *.pid 8 | *.seed 9 | 10 | # Directory for instrumented libs generated by jscoverage/JSCover 11 | lib-cov 12 | 13 | # Coverage directory used by tools like istanbul 14 | coverage 15 | 16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 17 | .grunt 18 | 19 | # Compiled binary addons (http://nodejs.org/api/addons.html) 20 | build/Release 21 | 22 | # Dependency directory 23 | # Deployed apps should consider commenting this line out: 24 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 25 | node_modules 26 | 27 | #JetBrains Webstorm setting files 28 | .idea/workspace.xml 29 | .idea/tasks.xml 30 | .idea/runConfigurations/ 31 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | StudentInfo -------------------------------------------------------------------------------- /.idea/StudentInfo.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/codeStyleSettings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/Generated_files.xml: -------------------------------------------------------------------------------- 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 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /.idea/libraries/StudentInfo_node_modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/watcherTasks.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 30 | 31 | 42 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 学生信息管理系统 2 | 3 | 一个Node.js练习项目 4 | 5 | ## 简介 6 | 学生信息管理系统是对学生的基本信息和成绩信息进行管理,主要包括添加、修改和删除学生的基本信息及课程的基本信息;录入、修改和删除学生的成绩信息,对基本信息、成绩信息进行查询、排序及统计等操作,从而实现学生信息管理的自动化与计算机化。本课题将实现一个简化的学生信息管理系统。 7 | 8 | ## 系统功能模块 9 | 1. 学生基本信息管理模块:对学生的基本信息进行综合管理,可以添加、修改及删除学生的基本信息。(可在同一界面完成该模块的功能,也可以分多个界面来完成。) 10 | 2. 成绩管理模块:对学生所选课程的成绩信息进行综合管理,可以添加、修改及删除基本信息。(可在同一界面完成该模块的功能,也可以分多个界面来完成。) 11 | 3. 课程信息管理模块:对课程信息进行综合管理,可以添加、修改及删除课程的基本信息。(可在同一界面完成该模块的功能,也可以分多个界面来完成。) 12 | 4. 查询模块: 13 | 41. 学生基本信息的查询:根据学生的已知条件来查询学生的详细信息,对姓名、学号、班级、系名等支持模糊查询。 14 | 42. 课程基本信息的查询:根据课程的信息来查询课程的详细信息。 15 | 43. 查询学生的选课情况、查询学生所选课程的成绩。 16 | 44. 统计模块:根据不同课程对学生成绩进行统计,求平均分、总分等;根据不同的分数区间进行人数统计等。 17 | 18 | ## 技术选型 19 | 项目全部使用开源技术,可以在Windows、OS X、Linux全平台通用。 20 | > + 服务器环境:nodejs 0.10.29 21 | > + 服务器语言:CoffeeScript 22 | > + MVC框架:Express 4 23 | > + 数据库:MongoDB 24 | > + ORM框架:mongoose 25 | > + 模板引擎:ejs 26 | > + 单元测试框架:Mocha 27 | > + 前端页面语言:HTML5 28 | > + 层叠样式表:CSS3、LESS 29 | > + 页面脚本语言:Javascript、CoffeeScript 30 | > + 页面框架:JQuery、Bootstrap 31 | > + 版本控制软件:Git 32 | > + 版本控制服务:Github 33 | > + 数据库托管平台:Mongohq 34 | > + IDE:JetBrain Webstorm 35 | 36 | ## 启动 37 | ```bash 38 | $ npm start 39 | ``` 40 | 或 41 | ```bash 42 | $ node bin/www 43 | ``` 44 | 45 | ##Contributors 46 | + Author: [Sean](http://www.find1x.com) 47 | + Author: wsll 48 | 49 | ### License 50 | [Apache License](LICENSE) 51 | 52 | -------------------------------------------------------------------------------- /app.coffee: -------------------------------------------------------------------------------- 1 | express = require("express") 2 | path = require("path") 3 | favicon = require("serve-favicon") 4 | logger = require("morgan") 5 | cookieParser = require("cookie-parser") 6 | bodyParser = require("body-parser") 7 | session = require("express-session") 8 | db = require("./config/database") 9 | indexRoute = require("./routes/index") 10 | userRoute = require("./routes/user") 11 | testRoute = require "./routes/test" 12 | studentRoute = require "./routes/student" 13 | gradeRoute=require "./routes/grade" 14 | courseRoute=require "./routes/course" 15 | app = express() 16 | 17 | # view engine setup 18 | app.set "views", path.join(__dirname, "views") 19 | app.set "view engine", "ejs" 20 | app.use favicon(__dirname + "/public/favicon.ico") 21 | app.use logger("dev") 22 | app.use bodyParser() 23 | app.use bodyParser.json() 24 | app.use bodyParser.urlencoded(extended: true) 25 | app.use cookieParser() 26 | app.use(session( 27 | secret: '1234567890QWERTY' 28 | resave: 'true' 29 | saveUninitialized: "true" 30 | )) 31 | app.use require("less-middleware")(path.join(__dirname, "public")) 32 | app.use express.static(path.join(__dirname, "public")) 33 | app.use "/", indexRoute 34 | app.use "/user", userRoute 35 | app.use "/test", testRoute 36 | app.use "/student", studentRoute 37 | app.use "/grade", gradeRoute 38 | app.use "/course", courseRoute 39 | 40 | #/ catch 404 and forward to error handler 41 | app.use (req, res, next) -> 42 | err = new Error("Not Found") 43 | err.status = 404 44 | next err 45 | return 46 | 47 | 48 | #/ error handlers 49 | 50 | # development error handler 51 | # will print stacktrace 52 | if app.get("env") is "development" 53 | app.use (err, req, res, next) -> 54 | res.status err.status or 500 55 | res.render "error", 56 | message: err.message 57 | error: err 58 | return 59 | 60 | 61 | # production error handler 62 | # no stacktraces leaked to user 63 | app.use (err, req, res, next) -> 64 | res.status err.status or 500 65 | res.render "error", 66 | message: err.message 67 | error: {} 68 | return 69 | 70 | module.exports = app -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var app, bodyParser, cookieParser, courseRoute, db, express, favicon, gradeRoute, indexRoute, logger, path, session, studentRoute, testRoute, userRoute; 4 | 5 | express = require("express"); 6 | 7 | path = require("path"); 8 | 9 | favicon = require("serve-favicon"); 10 | 11 | logger = require("morgan"); 12 | 13 | cookieParser = require("cookie-parser"); 14 | 15 | bodyParser = require("body-parser"); 16 | 17 | session = require("express-session"); 18 | 19 | db = require("./config/database"); 20 | 21 | indexRoute = require("./routes/index"); 22 | 23 | userRoute = require("./routes/user"); 24 | 25 | testRoute = require("./routes/test"); 26 | 27 | studentRoute = require("./routes/student"); 28 | 29 | gradeRoute = require("./routes/grade"); 30 | 31 | courseRoute = require("./routes/course"); 32 | 33 | app = express(); 34 | 35 | app.set("views", path.join(__dirname, "views")); 36 | 37 | app.set("view engine", "ejs"); 38 | 39 | app.use(favicon(__dirname + "/public/favicon.ico")); 40 | 41 | app.use(logger("dev")); 42 | 43 | app.use(bodyParser()); 44 | 45 | app.use(bodyParser.json()); 46 | 47 | app.use(bodyParser.urlencoded({ 48 | extended: true 49 | })); 50 | 51 | app.use(cookieParser()); 52 | 53 | app.use(session({ 54 | secret: '1234567890QWERTY', 55 | resave: 'true', 56 | saveUninitialized: "true" 57 | })); 58 | 59 | app.use(require("less-middleware")(path.join(__dirname, "public"))); 60 | 61 | app.use(express["static"](path.join(__dirname, "public"))); 62 | 63 | app.use("/", indexRoute); 64 | 65 | app.use("/user", userRoute); 66 | 67 | app.use("/test", testRoute); 68 | 69 | app.use("/student", studentRoute); 70 | 71 | app.use("/grade", gradeRoute); 72 | 73 | app.use("/course", courseRoute); 74 | 75 | app.use(function(req, res, next) { 76 | var err; 77 | err = new Error("Not Found"); 78 | err.status = 404; 79 | next(err); 80 | }); 81 | 82 | if (app.get("env") === "development") { 83 | app.use(function(err, req, res, next) { 84 | res.status(err.status || 500); 85 | res.render("error", { 86 | message: err.message, 87 | error: err 88 | }); 89 | }); 90 | } 91 | 92 | app.use(function(err, req, res, next) { 93 | res.status(err.status || 500); 94 | res.render("error", { 95 | message: err.message, 96 | error: {} 97 | }); 98 | }); 99 | 100 | module.exports = app; 101 | 102 | }).call(this); 103 | 104 | //# sourceMappingURL=app.map 105 | -------------------------------------------------------------------------------- /app.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "app.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "app.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,mJAAA;;AAAA,EAAA,OAAA,GAAU,OAAA,CAAQ,SAAR,CAAV,CAAA;;AAAA,EACA,IAAA,GAAO,OAAA,CAAQ,MAAR,CADP,CAAA;;AAAA,EAEA,OAAA,GAAU,OAAA,CAAQ,eAAR,CAFV,CAAA;;AAAA,EAGA,MAAA,GAAS,OAAA,CAAQ,QAAR,CAHT,CAAA;;AAAA,EAIA,YAAA,GAAe,OAAA,CAAQ,eAAR,CAJf,CAAA;;AAAA,EAKA,UAAA,GAAa,OAAA,CAAQ,aAAR,CALb,CAAA;;AAAA,EAMA,OAAA,GAAU,OAAA,CAAQ,iBAAR,CANV,CAAA;;AAAA,EAOA,EAAA,GAAK,OAAA,CAAQ,mBAAR,CAPL,CAAA;;AAAA,EAQA,UAAA,GAAa,OAAA,CAAQ,gBAAR,CARb,CAAA;;AAAA,EASA,SAAA,GAAY,OAAA,CAAQ,eAAR,CATZ,CAAA;;AAAA,EAUA,SAAA,GAAY,OAAA,CAAQ,eAAR,CAVZ,CAAA;;AAAA,EAWA,YAAA,GAAe,OAAA,CAAQ,kBAAR,CAXf,CAAA;;AAAA,EAYA,UAAA,GAAW,OAAA,CAAQ,gBAAR,CAZX,CAAA;;AAAA,EAaA,WAAA,GAAY,OAAA,CAAQ,iBAAR,CAbZ,CAAA;;AAAA,EAcA,GAAA,GAAM,OAAA,CAAA,CAdN,CAAA;;AAAA,EAiBA,GAAG,CAAC,GAAJ,CAAQ,OAAR,EAAiB,IAAI,CAAC,IAAL,CAAU,SAAV,EAAqB,OAArB,CAAjB,CAjBA,CAAA;;AAAA,EAkBA,GAAG,CAAC,GAAJ,CAAQ,aAAR,EAAuB,KAAvB,CAlBA,CAAA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AC,OAAP,GAAiB,GArEjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /bin/www: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var debug = require('debug')('generated-express-app'); 3 | var app = require('../app'); 4 | 5 | app.set('port', process.env.PORT || 3000); 6 | 7 | var server = app.listen(app.get('port'), function() { 8 | debug('Express server listening on port ' + server.address().port); 9 | console.log('Express server listening on port ' + server.address().port); 10 | }); 11 | -------------------------------------------------------------------------------- /config/database.coffee: -------------------------------------------------------------------------------- 1 | mongoose = require 'mongoose' 2 | 3 | #mongoDatabaseURI = 'mongodb://admin:admin@kahana.mongohq.com:10003/studentinfo' 4 | mongoDatabaseURI = 'mongodb://localhost:27017/studentinfo' 5 | 6 | mongoose.connect mongoDatabaseURI 7 | 8 | mongoose.connection.on('connected', () -> 9 | console.log('Mongoose default connection open to ' + mongoDatabaseURI) 10 | ) 11 | 12 | mongoose.connection.on('error', (err)-> 13 | console.log('Mongoose default connection error: ' + err) 14 | ) 15 | 16 | mongoose.connection.on('disconnected', ()-> 17 | console.log('Mongoose default connection disconnected') 18 | ) 19 | 20 | require "../model/Grade" 21 | require "../model/course" 22 | require "../model/Student" 23 | require "../model/User" 24 | 25 | -------------------------------------------------------------------------------- /config/database.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var mongoDatabaseURI, mongoose; 4 | 5 | mongoose = require('mongoose'); 6 | 7 | mongoDatabaseURI = 'mongodb://localhost:27017/studentinfo'; 8 | 9 | mongoose.connect(mongoDatabaseURI); 10 | 11 | mongoose.connection.on('connected', function() { 12 | return console.log('Mongoose default connection open to ' + mongoDatabaseURI); 13 | }); 14 | 15 | mongoose.connection.on('error', function(err) { 16 | return console.log('Mongoose default connection error: ' + err); 17 | }); 18 | 19 | mongoose.connection.on('disconnected', function() { 20 | return console.log('Mongoose default connection disconnected'); 21 | }); 22 | 23 | require("../model/Grade"); 24 | 25 | require("../model/course"); 26 | 27 | require("../model/Student"); 28 | 29 | require("../model/User"); 30 | 31 | }).call(this); 32 | 33 | //# sourceMappingURL=database.map 34 | -------------------------------------------------------------------------------- /config/database.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "database.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "database.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,0BAAA;;AAAA,EAAA,QAAA,GAAW,OAAA,CAAQ,UAAR,CAAX,CAAA;;AAAA,EAGA,gBAAA,GAAmB,uCAHnB,CAAA;;AAAA,EAKA,QAAQ,CAAC,OAAT,CAAiB,gBAAjB,CALA,CAAA;;AAAA,EAOA,QAAQ,CAAC,UAAU,CAAC,EAApB,CAAuB,WAAvB,EAAoC,SAAA,GAAA;WAChC,OAAO,CAAC,GAAR,CAAY,sCAAA,GAAyC,gBAArD,EADgC;EAAA,CAApC,CAPA,CAAA;;AAAA,EAWA,QAAQ,CAAC,UAAU,CAAC,EAApB,CAAuB,OAAvB,EAAgC,SAAC,GAAD,GAAA;WAC5B,OAAO,CAAC,GAAR,CAAY,qCAAA,GAAwC,GAApD,EAD4B;EAAA,CAAhC,CAXA,CAAA;;AAAA,EAeA,QAAQ,CAAC,UAAU,CAAC,EAApB,CAAuB,cAAvB,EAAuC,SAAA,GAAA;WACnC,OAAO,CAAC,GAAR,CAAY,0CAAZ,EADmC;EAAA,CAAvC,CAfA,CAAA;;AAAA,EAmBA,OAAA,CAAQ,gBAAR,CAnBA,CAAA;;AAAA,EAoBA,OAAA,CAAQ,iBAAR,CApBA,CAAA;;AAAA,EAqBA,OAAA,CAAQ,kBAAR,CArBA,CAAA;;AAAA,EAsBA,OAAA,CAAQ,eAAR,CAtBA,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /doc/10用例图.eap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/10用例图.eap -------------------------------------------------------------------------------- /doc/11代码编写规范/FindiX Studio CoffeeScript 编码规范.md: -------------------------------------------------------------------------------- 1 | # CoffeeScript 编码风格指南 2 | 3 | 这份指南阐述了一些 [CoffeeScript][coffeescript] 的最佳实践和编码惯例。 4 | 5 | 这份指南是社群驱动的,非常鼓励大家来贡献内容。 6 | 7 | 请注意这还是一份正在完善的指南:仍有很多地方可以改进,有些已制定的准则也不一定是社区惯用的(基于此,在适当的情况下,这些有待斟酌的准则将有可能被修改或删除。) 8 | 9 | ## 灵感 10 | 11 | 本指南中的很多细节受到了几份现有的风格指南和其他资源的启发。特别是: 12 | 13 | - [PEP-8][pep8]: Style Guide for Python Code 14 | - Bozhidar Batsov's [Ruby Style Guide][ruby-style-guide] 15 | - [Google's JavaScript Style Guide][google-js-styleguide] 16 | - [Common CoffeeScript Idioms][common-coffeescript-idioms] 17 | - Thomas Reynolds' [CoffeeScript-specific Style Guide][coffeescript-specific-style-guide] 18 | - Jeremy Ashkenas' [code review][spine-js-code-review] of [Spine][spine-js] 19 | - The [CoffeeScript FAQ][coffeescript-faq] 20 | 21 | ## 目录 22 | 23 | * [CoffeeScript 风格指南](#guide) 24 | * [代码布局(Code Layout)](#code_layout) 25 | * [Tab 还是 空格?(Tabs or Spaces?)](#tabs_or_spaces) 26 | * [最大行宽(Maximum Line Length)](#maximum_line_length) 27 | * [空行(Blank Lines)](#blank_lines) 28 | * [结尾空白(Trailing Whitespace)](#trailing_whitespace) 29 | * [可选的逗号(Optional Commas)](#optional_commas) 30 | * [编码(Encoding)](#encoding) 31 | * [模块导入(Module Imports)](#module_imports) 32 | * [表达式和语句中的空白(Whitespace in Expressions and Statements)](#whitespace) 33 | * [注释(Comments)](#comments) 34 | * [块注释(Block Comments)](#block_comments) 35 | * [行内注释(Inline Comments)](#inline_comments) 36 | * [命名规范(Naming Conventions)](#naming_conventions) 37 | * [函数(Functions)](#functions) 38 | * [字符串(Strings)](#strings) 39 | * [条件判断(Conditionals)](#conditionals) 40 | * [循环和列表解析(Looping and Comprehensions)](#looping_and_comprehensions) 41 | * [扩展本地对象(Extending Native Objects)](#extending_native_objects) 42 | * [异常(Exceptions)](#exceptions) 43 | * [注解(Annotations)](#annotations) 44 | * [其他(Miscellaneous)](#miscellaneous) 45 | 46 | 47 | ## 代码布局(Code Layout) 48 | 49 | 50 | ### Tab 还是 空格?(Tabs or Spaces?) 51 | 52 | 只用 **空格**,每级缩进均为 **4 个空格**。切勿混用 Tab 和空格。 53 | 54 | 55 | ### 最大行宽(Maximum Line Length) 56 | 57 | 限制每行最多 80 个字符。 58 | 59 | 60 | ### 空行(Blank Lines) 61 | 62 | 顶级函数和类的定义用一个空行分开。 63 | 64 | 类内部的函数定义也用一个空行分开。 65 | 66 | 对于每个函数体内,只在为了提高可读性的情况下才使用一个空行(例如:为了达到划分逻辑的目的)。 67 | 68 | 69 | ### 结尾空白(Trailing Whitespace) 70 | 71 | 不要在任何一行保留行尾空白。 72 | 73 | 74 | ### 可选的逗号(Optional Commas) 75 | 76 | 当对象(或数组)的属性(或元素)作为单独一行列出时,避免在换行符前使用逗号。如下: 77 | 78 | ```coffeescript 79 | # 好 80 | foo = [ 81 | 'some' 82 | 'string' 83 | 'values' 84 | ] 85 | bar: 86 | label: 'test' 87 | value: 87 88 | 89 | # 差 90 | foo = [ 91 | 'some', 92 | 'string', 93 | 'values' 94 | ] 95 | bar: 96 | label: 'test', 97 | value: 87 98 | ``` 99 | 100 | 101 | ### 编码(Encoding) 102 | 103 | UTF-8 是首选的源文件编码。 104 | 105 | 106 | ## 模块导入(Module Imports) 107 | 108 | 如果需要导入模块 (CommonJS 模块,AMD,等等.), `require` 语句应该单独作为一行。如下: 109 | 110 | ```coffeescript 111 | require 'lib/setup' 112 | Backbone = require 'backbone' 113 | ``` 114 | 115 | 这些语句应该按以下顺序去分组: 116 | 117 | 1. 标准库的导入 _(如果标准库存在)_ 118 | 2. 第三方库的导入 119 | 3. 本地导入 _(导入这个应用程序的或库的具体依赖)_ 120 | 121 | 122 | ## 表达式和语句中的空白(Whitespace in Expressions and Statements) 123 | 124 | 下列情况应该避免多余的空格: 125 | 126 | - 紧贴着圆括号、方括号和大括号内部 127 | 128 | ```coffeescript 129 | ($ 'body') # 好 130 | ( $ 'body' ) # 差 131 | ``` 132 | 133 | - 紧贴在逗号前 134 | 135 | ```coffeescript 136 | console.log x, y # 好 137 | console.log x , y # 差 138 | ``` 139 | 140 | 额外建议: 141 | 142 | - 在下列二元操作符的左右两边都保留 **一个空格** 143 | 144 | - 赋值运算符: `=` 145 | 146 | - _注意这同样适用于函数定义中的默认参数_ 147 | 148 | ```coffeescript 149 | test: (param = null) -> # 好 150 | test: (param=null) -> # 差 151 | ``` 152 | 153 | - 自增运算符: `+=`, `-=`, 等等。 154 | - 比较运算符: `==`, `<`, `>`, `<=`, `>=`, `unless`, 等等。 155 | - 算术运算符: `+`, `-`, `*`, `/`, 等等。 156 | 157 | - _(这些操作符两边的空格不要多于一个)_ 158 | 159 | ```coffeescript 160 | # 好 161 | x = 1 162 | y = 1 163 | fooBar = 3 164 | 165 | # 差 166 | x = 1 167 | y = 1 168 | fooBar = 3 169 | ``` 170 | 171 | 172 | ## 注释(Comments) 173 | 174 | 如果你修改了一段已有注释说明的代码,则也要更新它对应的注释。(理想状态是,重构这段代码直到它不需要注释说明,然后再把之前的注释全删掉。) 175 | 176 | 注释的首字母要大写,除非第一个单词是以小写字母开头的标识符。 177 | 178 | 如果注释很短,可以省略末尾的句号。 179 | 180 | 181 | ### 块注释(Block Comments) 182 | 183 | 注释块通常应用于尾随其后的一段代码。 184 | 185 | 每一行注释都以 `#` 加一个空格开头,而且和被注释的代码有相同的缩进层次。 186 | 187 | 注释块内的段落以仅含单个 `#` 的行分割。 188 | 189 | ```coffeescript 190 | # 这是一个块注释。请注意假如这是一段块注释, 191 | # 则它描述的就应该是接下来的这段代码。 192 | # 193 | # 这是块注释的第二段。 194 | # 请注意这段是由上一行带有 # 号的空行分开的。(P.S. 最好用英文写注释) 195 | 196 | init() 197 | start() 198 | stop() 199 | ``` 200 | 201 | 202 | ### 行内注释(Inline Comments) 203 | 204 | 行内注释紧贴在被描述的代码的上一行,如果行内注释足够短,则可以处在同一行行尾(由一个空格隔开)。 205 | 206 | 所有行内注释都以 `#` 加一个空格开头。 207 | 208 | 应该限制行内注释的使用,因为它们的存在通常是一个代码异味的标志。 209 | 210 | 不要给显而易见的情况作行内注释: 211 | 212 | ```coffeescript 213 | # 差 214 | x = x + 1 # x 自增 215 | ``` 216 | 217 | 然而,行内注释在某些情况下是有用的: 218 | 219 | ```coffeescript 220 | # 好 221 | x = x + 1 # 边界补足 222 | ``` 223 | 224 | 225 | ## 命名规范(Naming Conventions) 226 | 227 | 使用 `小驼峰命名法` (第一个词的首字母小写,后面每个词的首字母大写)来命名所有的变量、方法和对象属性。 228 | 229 | 使用 `大驼峰命名法` (第一个词的首字母,以及后面每个词的首字母都大写)来命名所有的类 _(在[其他类似的命名法][camel-case-variations]中,这种风格通常也被称为 `帕斯卡命名法(PascalCase)`、 `大写驼峰命名法(CamelCaps)` 或 `首字母大写命名法(CapWords)`。)_ 230 | 231 | _(CoffeeScript **官方** 约定是用驼峰命名法,因为这可以简化与 JavaScript 的相互转化,想了解更多,请看[这里][coffeescript-issue-425].)_ 232 | 233 | 对于常量,单词全部大写,用下划线隔开即可: 234 | 235 | ```coffeescript 236 | CONSTANT_LIKE_THIS 237 | ``` 238 | 239 | 私有函数和私有变量都应该在前面加一个下划线: 240 | 241 | ```coffeescript 242 | _privateMethod: -> 243 | ``` 244 | 245 | 246 | ## 函数(Functions) 247 | 248 | _(以下这些准则同样适用于类中的方法。)_ 249 | 250 | 当声明一个带参函数时,应在参数列表的右圆括号后空出一个空格: 251 | 252 | ```coffeescript 253 | foo = (arg1, arg2) -> # 好 254 | foo = (arg1, arg2)-> # 差 255 | ``` 256 | 257 | 无参函数不要用圆括号: 258 | 259 | ```coffeescript 260 | bar = -> # 好 261 | bar = () -> # 差 262 | ``` 263 | 264 | 当函数链式调用,却在一行放不下时,则把每个函数调用都另起一行,且都缩进一级(即在 `.` 前加两个空格)。 265 | 266 | ```coffeescript 267 | [1..3] 268 | .map((x) -> x * x) 269 | .concat([10..12]) 270 | .filter((x) -> x < 11) 271 | .reduce((x, y) -> x + y) 272 | ``` 273 | 274 | 当调用函数时,我们应该为了提高可读性而去掉圆括号。请记住,「可读性」是我们主观臆断的。只有类似下面几个例子的情况才被社区认为是最佳的: 275 | 276 | ```coffeescript 277 | baz 12 278 | 279 | brush.ellipse x: 10, y: 20 # 大括号在适当的时候也可以去掉 280 | 281 | foo(4).bar(8) 282 | 283 | obj.value(10, 20) / obj.value(20, 10) 284 | 285 | print inspect value 286 | 287 | new Tag(new Value(a, b), new Arg(c)) 288 | ``` 289 | 290 | 有时候你会发现圆括号用来包裹的是函数体(而不是函数的参数)。请看下面的例子(以下简称为「函数体风格」): 291 | 292 | ```coffeescript 293 | ($ '#selektor').addClass 'klass' 294 | 295 | (foo 4).bar 8 296 | ``` 297 | 298 | 这段代码会编译为: 299 | 300 | ```coffeescript 301 | $('#selektor').addClass 'klass' 302 | 303 | foo(4).bar 8 304 | ``` 305 | 306 | 一些习惯链式调用的人会巧用「函数体风格」进行单独初始化: 307 | 308 | ```coffeescript 309 | ($ '#selektor').addClass('klass').hide() # 单独初始化调用 310 | (($ '#selektor').addClass 'klass').hide() # 全部调用 311 | ``` 312 | 313 | 「函数体风格」并不得到推荐。但是, **当它适应一些特殊的项目需求时,还是得用它。** 314 | 315 | 316 | ## 字符串(Strings) 317 | 318 | 用字符串插值代替字符串连接符: 319 | 320 | ```coffeescript 321 | "this is an #{adjective} string" # 好 322 | "this is an " + adjective + " string" # 差 323 | ``` 324 | 325 | 最好用单引号 (`''`) 而不是双引号 (`""`) 。除非是插入到另一段现有的字符串中(类似字符串插值)。 326 | 327 | 328 | ## 条件判断(Conditionals) 329 | 330 | 用 `unless` 来代替 `if` 的否定情况。 331 | 332 | 不要用 `unless...else`, 而用 `if...else`: 333 | 334 | ```coffeescript 335 | # 好 336 | if true 337 | ... 338 | else 339 | ... 340 | 341 | # 差 342 | unless false 343 | ... 344 | else 345 | ... 346 | ``` 347 | 348 | 多行的 if/else 语句应该缩进: 349 | 350 | ```coffeescript 351 | # 好 352 | if true 353 | ... 354 | else 355 | ... 356 | 357 | # 差 358 | if true then ... 359 | else ... 360 | ``` 361 | 362 | 363 | ## 循环和列表解析(Looping and Comprehensions) 364 | 365 | 尽可能的使用列表解析: 366 | 367 | ```coffeescript 368 | # 好 369 | result = (item.name for item in array) 370 | 371 | # 差 372 | results = [] 373 | for item in array 374 | results.push item.name 375 | ``` 376 | 377 | 还可以过滤结果: 378 | 379 | ```coffeescript 380 | result = (item for item in array when item.name is "test") 381 | ``` 382 | 383 | 遍历对象的键值: 384 | 385 | ```coffeescript 386 | object = one: 1, two: 2 387 | alert("#{key} = #{value}") for key, value of object 388 | ``` 389 | 390 | 391 | ## 扩展本地对象(Extending Native Objects) 392 | 393 | 不要修改本地对象。 394 | 395 | 比如,不要给 `Array.prototype` 引入 `Array#forEach` 。 396 | 397 | 398 | ## 异常(Exceptions) 399 | 400 | 不要抑制异常抛出。 401 | 402 | 403 | ## 注解(Annotations) 404 | 405 | 必要的时候应该写注解,来指明接下来的代码块具体将干什么。 406 | 407 | 注解应紧贴在被描述代码的上一行。 408 | 409 | 注解关键字后面应该跟一个冒号加一个空格,加一个描述性的注释。 410 | 411 | ```coffeescript 412 | # FIXME: The client's current state should *not* affect payload processing. 413 | resetClientState() 414 | processPayload() 415 | ``` 416 | 417 | 如果注解不止一行,则下一行缩进两个空格。 418 | 419 | ```coffeescript 420 | # TODO: Ensure that the value returned by this call falls within a certain 421 | # range, or throw an exception. 422 | analyze() 423 | ``` 424 | 425 | 注解有以下几类: 426 | 427 | - `TODO`: 描述缺失的功能,以便日后加入 428 | - `FIXME`: 描述需要修复的代码 429 | - `OPTIMIZE`: 描述性能低下,或难以优化的代码 430 | - `HACK`: 描述一段值得质疑(或很巧妙)的代码 431 | - `REVIEW`: 描述需要确认其编码意图是否正确的代码 432 | 433 | 如果你必须自定义一个新的注解类型,则应该把这个注解类型记录在项目的 README 里面。 434 | 435 | 436 | ## 其他(Miscellaneous) 437 | 438 | `and` 更优于 `&&`. 439 | 440 | `or` 更优于 `||`. 441 | 442 | `is` 更优于 `==`. 443 | 444 | `not` 更优于 `!`. 445 | 446 | `or=` 应在可能的情况下使用: 447 | 448 | ```coffeescript 449 | temp or= {} # 好 450 | temp = temp || {} # 差 451 | ``` 452 | 453 | 最好用 (`::`) 访问对象的原型: 454 | 455 | ```coffeescript 456 | Array::slice # 好 457 | Array.prototype.slice # 差 458 | ``` 459 | 460 | 最好用 `@property` 而不是 `this.property`. 461 | 462 | ```coffeescript 463 | return @property # 好 464 | return this.property # 差 465 | ``` 466 | 467 | 但是,避免使用 **单独的** `@`: 468 | 469 | ```coffeescript 470 | return this # 好 471 | return @ # 差 472 | ``` 473 | 474 | 没有返回值的时候避免使用 `return` ,其他情况则需要显示 return 。 475 | 476 | 当函数需要接收可变数量的参数时,使用 splats (`...`)。 477 | 478 | ```coffeescript 479 | console.log args... # 好 480 | 481 | (a, b, c, rest...) -> # 好 482 | ``` 483 | 484 | [coffeescript]: http://jashkenas.github.com/coffee-script/ 485 | [coffeescript-issue-425]: https://github.com/jashkenas/coffee-script/issues/425 486 | [spine-js]: http://spinejs.com/ 487 | [spine-js-code-review]: https://gist.github.com/1005723 488 | [pep8]: http://www.python.org/dev/peps/pep-0008/ 489 | [ruby-style-guide]: https://github.com/bbatsov/ruby-style-guide 490 | [google-js-styleguide]: http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml 491 | [common-coffeescript-idioms]: http://arcturo.github.com/library/coffeescript/04_idioms.html 492 | [coffeescript-specific-style-guide]: http://awardwinningfjords.com/2011/05/13/coffeescript-specific-style-guide.html 493 | [coffeescript-faq]: https://github.com/jashkenas/coffee-script/wiki/FAQ 494 | [camel-case-variations]: http://en.wikipedia.org/wiki/CamelCase#Variations_and_synonyms -------------------------------------------------------------------------------- /doc/11代码编写规范/FindiX Studio Node 编码规范.md: -------------------------------------------------------------------------------- 1 | # FindiX Studio Node 编码规范 2 | 3 | * 缩进,4 个 space,tab要转换成 `4 space`. 4 | 5 | * 永远用 `var` 声明变量,不加 `var` 时,会污染顶层上下文 6 | 7 | * 操作符与操作算子之间要有空格 8 | 9 | Right: 10 | 11 | ```js 12 | var string = 'Foo' + bar; 13 | ``` 14 | Wrong: 15 | 16 | ```js 17 | var string = 'Foo'+bar; 18 | ``` 19 | 20 | * 使用`string` 时,用单引号替代双引号(写JSON 时除外) 21 | 22 | Right: 23 | 24 | ```js 25 | var foo = 'bar'; 26 | 27 | var http = require('http'); 28 | ``` 29 | 30 | Wrong: 31 | 32 | ```js 33 | var foo = "bar"; 34 | 35 | var http = require("http"); 36 | ``` 37 | 38 | * 大括号位置 39 | 40 | Right: 41 | 42 | ```js 43 | if (true) { 44 | console.log('winning'); 45 | } 46 | ``` 47 | 48 | Wrong: 49 | 50 | ```js 51 | if (true) 52 | { 53 | console.log('losing'); 54 | } 55 | ``` 56 | 57 | * Camel 命名法 58 | 59 | 采用以下规则: 60 | * 函数和变量:functionNamesLikeThis, variableNamesLikeThis, 61 | * 类名和枚举类型:ClassNamesLikeThis, EnumNamesLikeThis, 62 | * 类方法:methodNamesLikeThis 63 | * 常量:SYMBOLIC_CONSTANTS_LIKE_THIS 64 | 65 | Right : 66 | 67 | ```js 68 | // var definition 69 | var adminUser = db.query('SELECT * FROM users ...'); 70 | 71 | // function definition 72 | function run() { 73 | } 74 | 75 | // Class definition 76 | function BankAccount() { 77 | } 78 | ``` 79 | 80 | Wrong: 81 | 82 | ```js 83 | var admin_user = db.query('SELECT * FROM users ...'); 84 | 85 | function bankAccount() { 86 | } 87 | ``` 88 | 89 | * 文件命名 90 | 91 | 单词之间使用 `_` (underscore) 来 分割,如果你不想暴露某个文件给用户 , 92 | 你也可以用`_` 来开头 93 | 94 | Right : 95 | 96 | ```js 97 | child_process.js 98 | string_decoder.js 99 | _linklist.js 100 | ``` 101 | 102 | 103 | * 不使用 ```const``` 关键字 104 | 虽然V8 和 Mozilla 都支持它,但它不是ECMA 标准,我们用以下方式定义常量: 105 | 106 | Right: 107 | 108 | ```js 109 | var SECOND = 1 * 1000; 110 | function File() { 111 | } 112 | File.FULL_PERMISSIONS = 0777; 113 | ``` 114 | 115 | * 比较操作 有的场景下应该用 "===" 替代 "==" 116 | 当你遇到这些符号比较时 :``` 0 undefined null false true ``` 117 | 118 | 你应该小心谨慎 119 | 比如 `' \t\r\n' == 0` 比较结果是 `true` 120 | 121 | Right: 122 | 123 | ```js 124 | var a = 0; 125 | if (a === '') { 126 | console.log('winning'); 127 | } 128 | ``` 129 | 130 | Wrong: 131 | 132 | ```js 133 | var a = 0; 134 | if (a == '') { 135 | console.log('losing'); 136 | } 137 | ``` 138 | 139 | * 使用字面表达式,用 '{}' ,'[]' 代替 `new Array` ,`new Object` 140 | 141 | 不要使用 `string`,`bool`,`number` 的对象类型,即不要调用 `new String` ,`new Boolean` ,`new Number` 142 | 143 | * Object ,Array 创建,当有多个元素时,注意分行排列时逗号的位置 144 | 145 | Right: 146 | 147 | ```js 148 | var a = ['hello', 'world']; 149 | var b = { 150 | good: 'code', 151 | 'is generally': 'pretty', 152 | }; 153 | ``` 154 | 155 | Wrong: 156 | 157 | ```js 158 | var a = [ 159 | 'hello', 'world' 160 | ]; 161 | var b = {"good": 'code' 162 | , is generally: 'pretty' 163 | }; 164 | ``` 165 | 166 | * 避免使用 “with” 与 “eval” 167 | 168 | * for-in 循环,仅在 object/hash/map 时使用,绝不要对Array 使用 169 | 170 | * 不要把Array 当做关联数组或Object 使用,即你不应该用非数字作为Array 的索引 171 | (Phper 尤其注意这点) 172 | 173 | Wrong : 174 | 175 | ```js 176 | var a = []; // use '{}' instead 177 | a['hello'] = 'shit'; 178 | a['foo'] = 'bar'; 179 | ``` 180 | 181 | Right: 182 | 183 | ```js 184 | var a = {}; 185 | a.hello = 'shit'; 186 | a.foo = 'bar'; 187 | ``` 188 | 189 | * Node 的异步回调函数的第一个参数应该是错误指示 190 | 191 | ```js 192 | function cb(err, data , ...) {...} 193 | ``` 194 | 195 | * 类继承写法,尽管有各种方式来实现继承,但最为推荐的是Node 的标准写法 196 | 197 | ```js 198 | function Socket(options) { 199 | // ... 200 | stream.Stream.call(this); 201 | // ... 202 | } 203 | 204 | util.inherits(Socket, stream.Stream); 205 | ``` 206 | 207 | * 如果你在模块中 `exports` 一个类,对于此类的私有成员变量,建议加上 "_" 前缀以示区分 208 | 209 | * 变量声明时,应该每行声明一个,不应该都写在一行(尽管这被JSLint 所推荐)。 210 | 211 | Right: 212 | 213 | ```js 214 | var assert = require('assert'); 215 | var fork = require('child_process').fork; 216 | var net = require('net'); 217 | var EventEmitter = require('events').EventEmitter; 218 | ``` 219 | 220 | Wrong:( Node 源代码已经将此方式全部修正) 221 | 222 | ```js 223 | var assert = require('assert') 224 | , fork = require('child_process').fork 225 | , net = require('net') 226 | , EventEmitter = require('events').EventEmitter; 227 | ``` 228 | 229 | * 注释规范,采用 [Google 的js 规范](http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml#Comments) 230 | 231 | Right : 232 | 233 | ```js 234 | /** 235 | * Queries a Baz for items. 236 | * @param {number} groupNum Subgroup id to query. 237 | * @param {string|number|null} term An itemName, 238 | * or itemId, or null to search everything. 239 | */ 240 | goog.Baz.prototype.query = function (groupNum, term) { 241 | // ... 242 | }; 243 | ``` 244 | 245 | 更多案例请参看以上链接 246 | 247 | * 多参考、模仿 Node 源码的编程风格 ^_^ 248 | * [Javascript编程风格](http://www.ruanyifeng.com/blog/2012/04/javascript_programming_style.html) 249 | * [Google JavaScript代码风格指南](http://chajn.org/jsguide/javascriptguide.html) -------------------------------------------------------------------------------- /doc/12参考资料.md: -------------------------------------------------------------------------------- 1 | [Node.js v0.10.29 Manual & Documentation](http://nodejs.org/api/) 2 | [The MongoDB 2.6 Manual](http://docs.mongodb.org/manual/) 3 | [Mongoose Schemas v3.8.12](http://mongoosejs.com/docs/guide.html) 4 | [NODE.JS UNIT TESTING BY @朴灵](http://html5ify.com/unittesting/slides/index.html#/) 5 | [Express 4.x API Reference](http://expressjs.com/4x/api.html) 6 | [How to use templates with EJS(https://code.google.com/p/embeddedjavascript/wiki/Templates) 7 | [Bootstrap 中文文档](http://v3.bootcss.com/) 8 | [LESS 语法](http://www.bootcss.com/p/lesscss/) 9 | [Pro Git](http://git-scm.com/book/zh/) 10 | [初识 mocha in NodeJS](http://cnodejs.org/topic/516526766d38277306c7d277) 11 | [Mocha - the fun, simple, flexible JavaScript test framework](http://visionmedia.github.io/mocha/) 12 | [Wikipedia](http://zh.wikipedia.org/) 13 | [Stackoverflow](http://stackoverflow.com/) -------------------------------------------------------------------------------- /doc/1可行性研究报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/1可行性研究报告.docx -------------------------------------------------------------------------------- /doc/2项目开发计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/2项目开发计划.docx -------------------------------------------------------------------------------- /doc/3项目需求规格分析说明书.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/3项目需求规格分析说明书.docx -------------------------------------------------------------------------------- /doc/4项目概要设计规格说明书.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/4项目概要设计规格说明书.docx -------------------------------------------------------------------------------- /doc/5项目详细设计规格说明书.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/5项目详细设计规格说明书.docx -------------------------------------------------------------------------------- /doc/6项目测试计划.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/6项目测试计划.docx -------------------------------------------------------------------------------- /doc/7项目测试分析报告.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/7项目测试分析报告.docx -------------------------------------------------------------------------------- /doc/8技术选型清单.txt: -------------------------------------------------------------------------------- 1 | 本系统全部使用开源技术,可以在Windows、OS X、Linux全平台通用。 2 | 服务器环境:nodejs 0.10.29 3 | 服务器语言:CoffeeScript 4 | MVC框架:Express 4 5 | 数据库:MongoDB 6 | ORM框架:mongoose 7 | 模板引擎:ejs 8 | 单元测试框架:Mocha 9 | 前端页面语言:HTML5 10 | 层叠样式表:CSS3、LESS 11 | 页面脚本语言:Javascript、CoffeeScript 12 | 页面框架:JQuery、Bootstrap 13 | 版本控制软件:Git 14 | 版本控制服务:Github 15 | 数据库托管平台:Mongohq 16 | IDE:JetBrain Webstorm 17 | 编辑器:Sublime Text 3 18 | Google查资料用代理工具:Goagent -------------------------------------------------------------------------------- /doc/9课程设计完成情况说明.md: -------------------------------------------------------------------------------- 1 | #课程设计完全情况说明 2 | ## 凤翔 陈龙龙 3 | 4 | # 预研 5 | 对项目成员进行基本Node.js、Express、MongoDB、JSON培训 6 | 以及成员自行看书学习 7 | 8 | # 文档 9 | 1.项目可行性研究报告 10 | 2.项目开发计划书 11 | 3.项目需求分析规格说明书 12 | 4.项目概要设计规格说明书 13 | 5.项目详细设计规格说明书 14 | 6.代码编写规范 15 | 7.技术选型清单 16 | 8.课程设计完成情况说明 17 | 9.用例图 18 | 10.参考资料 19 | 20 | # 项目 21 | 完成项目build配置,架构搭建 22 | 23 | # CVS 24 | [http://github.com/findix/StudentInfo](在Github上完成版本控制配置) 25 | -------------------------------------------------------------------------------- /doc/测试文档/Tomcat对比测试.txt: -------------------------------------------------------------------------------- 1 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 2 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 3 | Licensed to The Apache Software Foundation, http://www.apache.org/ 4 | 5 | Benchmarking localhost (be patient) 6 | 7 | 8 | Server Software: Apache-Coyote/1.1 9 | Server Hostname: localhost 10 | Server Port: 8080 11 | 12 | Document Path: /gpms/ 13 | Document Length: 5176 bytes 14 | 15 | Concurrency Level: 1000 16 | Time taken for tests: 89.889 seconds 17 | Complete requests: 10000 18 | Failed requests: 0 19 | Write errors: 0 20 | Total transferred: 54190000 bytes 21 | HTML transferred: 51760000 bytes 22 | Requests per second: 111.25 [#/sec] (mean) 23 | Time per request: 8988.852 [ms] (mean) 24 | Time per request: 8.989 [ms] (mean, across all concurrent requests) 25 | Transfer rate: 588.73 [Kbytes/sec] received 26 | 27 | Connection Times (ms) 28 | min mean[+/-sd] median max 29 | Connect: 0 0 1.9 0 69 30 | Processing: 1084 8551 1491.1 8755 12994 31 | Waiting: 978 8547 1493.1 8752 12978 32 | Total: 1084 8552 1490.9 8755 12994 33 | 34 | Percentage of the requests served within a certain time (ms) 35 | 50% 8755 36 | 66% 9119 37 | 75% 9338 38 | 80% 9483 39 | 90% 9918 40 | 95% 10275 41 | 98% 10667 42 | 99% 10961 43 | 100% 12994 (longest request) 44 | -------------------------------------------------------------------------------- /doc/测试文档/二轮测试.txt: -------------------------------------------------------------------------------- 1 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 2 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 3 | Licensed to The Apache Software Foundation, http://www.apache.org/ 4 | 5 | Benchmarking localhost (be patient) 6 | 7 | 8 | Server Software: Apache/2.2.25 9 | Server Hostname: localhost 10 | Server Port: 80 11 | 12 | Document Path: / 13 | Document Length: 44 bytes 14 | 15 | Concurrency Level: 100 16 | Time taken for tests: 4.124 seconds 17 | Complete requests: 10000 18 | Failed requests: 0 19 | Write errors: 0 20 | Total transferred: 3290000 bytes 21 | HTML transferred: 440000 bytes 22 | Requests per second: 2424.63 [#/sec] (mean) 23 | Time per request: 41.243 [ms] (mean) 24 | Time per request: 0.412 [ms] (mean, across all concurrent requests) 25 | Transfer rate: 779.01 [Kbytes/sec] received 26 | 27 | Connection Times (ms) 28 | min mean[+/-sd] median max 29 | Connect: 0 0 0.5 0 11 30 | Processing: 8 41 6.4 39 90 31 | Waiting: 8 33 8.1 32 83 32 | Total: 8 41 6.4 39 90 33 | 34 | Percentage of the requests served within a certain time (ms) 35 | 50% 39 36 | 66% 41 37 | 75% 42 38 | 80% 44 39 | 90% 48 40 | 95% 53 41 | 98% 62 42 | 99% 65 43 | 100% 90 (longest request) 44 | -------------------------------------------------------------------------------- /doc/测试文档/压力测试报告.md: -------------------------------------------------------------------------------- 1 | # 学生信息管理系统压力测试报告 2 | 3 | ## 测试环境 4 | 网络环境: 5 | 6 | 内网 7 | 8 | 压力测试服务器: 9 | 10 | 服务器系统:Linux Ubuntu 14.04(Vmware虚拟机) 11 | 12 | 服务器配置:Intel(R) Core(TM) CPU i5 2430M 2.40GHz 2 CORES 13 | 14 | 内存:4GB 15 | 16 | 17 | 18 | 发包服务器: 19 | 20 | 发包工具:apache 2.2.19自带的ab测试工具 21 | 22 | 服务器系统:Windows(R) 8.1 简体中文企业版 64bit 23 | 24 | 服务器配置:Intel(R) Core(TM) CPU i5 2430M 2.40GHz 4 CORES 25 | 26 | 内存:8GB 27 | 28 | ## 首轮测试 29 | ### 参数 30 | url: / 31 | 并发:1000 32 | 次数:10 33 | 34 | ### 结果 35 | (后续测试不再注释) 36 | ```java 37 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 38 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 39 | Licensed to The Apache Software Foundation, http://www.apache.org/ 40 | 41 | Benchmarking localhost (be patient) 42 | 43 | 44 | Server Software: 45 | Server Hostname:localhost 46 | Server Port:3000 47 | 48 | Document Path: / 49 | Document Length:4017 bytes 50 | 51 | Concurrency Level: 1000 52 | /* 整个测试持续的时间 */ 53 | Time taken for tests: 36.869 seconds 54 | /* 完成的请求数量 */ 55 | Complete requests: 10000 56 | /* 失败的请求数量 */ 57 | Failed requests:0 58 | Write errors: 0 59 | /* 整个场景中的网络传输量 */ 60 | Total transferred: 43235848 bytes 61 | HTML transferred: 40170000 bytes 62 | /* 每秒事务数 ,mean 表示这是一个平均值 */ 63 | Requests per second:271.23 [#/sec] (mean) 64 | /* 平均事务响应时间 ,mean 表示这是一个平均值 */ 65 | Time per request: 3686.857 [ms] (mean) 66 | Time per request: 3.687 [ms] (mean, across all concurrent requests) 67 | /* 平均每秒网络上的流量,可以帮助排除是否存在网络流量过大导致响应时间延长的问题 */ 68 | Transfer rate: 1145.22 [Kbytes/sec] received 69 | 70 | /* 网络上消耗的时间的分解 */ 71 | Connection Times (ms) 72 | min mean[+/-sd] median max 73 | Connect:00 10.0 0 508 74 | Processing: 188 3570 649.5 37324442 75 | Waiting: 12 155 447.6 182287 76 | Total:188 3570 649.6 37324442 77 | 78 | /* 整个场景中所有请求的响应情况。在场景中每个请求都有一个响应时间,其中 50 % 的用户响应时间小于 3732 毫秒, 66 % 的用户响应时间小于 3094 毫秒,最大的响应时间小于 4442 毫秒 */ 79 | Percentage of the requests served within a certain time (ms) 80 | 50% 3732 81 | 66% 3782 82 | 75% 3816 83 | 80% 3830 84 | 90% 3926 85 | 95% 4069 86 | 98% 4105 87 | 99% 4125 88 | 100% 4442 (longest request) 89 | ``` 90 | 91 | ## 二轮测试 92 | ### 参数 93 | url: /student 94 | 并发:1000 95 | 次数:10 96 | 97 | ### 结果 98 | ```bash 99 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 100 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 101 | Licensed to The Apache Software Foundation, http://www.apache.org/ 102 | 103 | Benchmarking localhost (be patient) 104 | 105 | 106 | Server Software: 107 | Server Hostname: localhost 108 | Server Port: 3000 109 | 110 | Document Path: /student 111 | Document Length: 33486 bytes 112 | 113 | Concurrency Level: 1000 114 | Time taken for tests: 116.006 seconds 115 | Complete requests: 10000 116 | Failed requests: 0 117 | Write errors: 0 118 | Total transferred: 337936246 bytes 119 | HTML transferred: 334860000 bytes 120 | Requests per second: 86.20 [#/sec] (mean) 121 | Time per request: 11600.634 [ms] (mean) 122 | Time per request: 11.601 [ms] (mean, across all concurrent requests) 123 | Transfer rate: 2844.81 [Kbytes/sec] received 124 | 125 | Connection Times (ms) 126 | min mean[+/-sd] median max 127 | Connect: 0 0 10.0 0 504 128 | Processing: 2277 11451 714.5 11651 12180 129 | Waiting: 2252 5846 1156.1 5860 8096 130 | Total: 2278 11451 714.3 11651 12180 131 | 132 | Percentage of the requests served within a certain time (ms) 133 | 50% 11651 134 | 66% 11727 135 | 75% 11783 136 | 80% 11821 137 | 90% 11925 138 | 95% 11955 139 | 98% 11984 140 | 99% 11993 141 | 100% 12180 (longest request) 142 | 143 | ``` 144 | 145 | ## 对比几乎相同情况下Tomcat 7 服务器 146 | ### 参数 147 | url: /gpms 148 | 并发:1000 149 | 次数:10 150 | 151 | ### 结果 152 | ```bash 153 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 154 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 155 | Licensed to The Apache Software Foundation, http://www.apache.org/ 156 | 157 | Benchmarking localhost (be patient) 158 | 159 | 160 | Server Software: Apache-Coyote/1.1 161 | Server Hostname: localhost 162 | Server Port: 8080 163 | 164 | Document Path: /gpms/ 165 | Document Length: 5176 bytes 166 | 167 | Concurrency Level: 1000 168 | Time taken for tests: 89.889 seconds 169 | Complete requests: 10000 170 | Failed requests: 0 171 | Write errors: 0 172 | Total transferred: 54190000 bytes 173 | HTML transferred: 51760000 bytes 174 | Requests per second: 111.25 [#/sec] (mean) 175 | Time per request: 8988.852 [ms] (mean) 176 | Time per request: 8.989 [ms] (mean, across all concurrent requests) 177 | Transfer rate: 588.73 [Kbytes/sec] received 178 | 179 | Connection Times (ms) 180 | min mean[+/-sd] median max 181 | Connect: 0 0 1.9 0 69 182 | Processing: 1084 8551 1491.1 8755 12994 183 | Waiting: 978 8547 1493.1 8752 12978 184 | Total: 1084 8552 1490.9 8755 12994 185 | 186 | Percentage of the requests served within a certain time (ms) 187 | 50% 8755 188 | 66% 9119 189 | 75% 9338 190 | 80% 9483 191 | 90% 9918 192 | 95% 10275 193 | 98% 10667 194 | 99% 10961 195 | 100% 12994 (longest request) 196 | ``` 197 | 198 | ## 总结 199 | 200 | 在1000并发的情况下,系统运行稳定。根据两次不精确测试,在没有数据库访问的纯静态情况下,以及有数据库访问的情况下都顺利通过1000并发的10次访问,没有出现宕机情况。在第二次有数据库访问情况下,页面byte流是首页的8倍,但是评价访问时间只多三倍,说明数据库并不是性能瓶颈。 201 | 对比Tomcat服务器,因为Tomcat也是异步的,所以很有针对性。在几乎同条件下,tomecat的平均访问时间大约是apache的3倍,在连接数据库的情况下,相比差距将更加明显 202 | 而Apache服务器,在页面几乎全空的情况下,也无法进行1000并发量测试,可能是内部保护机制生效。总之是无法完成测试。 -------------------------------------------------------------------------------- /doc/测试文档/首轮测试.txt: -------------------------------------------------------------------------------- 1 | This is ApacheBench, Version 2.3 <$Revision: 655654 $> 2 | Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ 3 | Licensed to The Apache Software Foundation, http://www.apache.org/ 4 | 5 | Benchmarking localhost (be patient) 6 | 7 | 8 | Server Software: 9 | Server Hostname: localhost 10 | Server Port: 3000 11 | 12 | Document Path: /student 13 | Document Length: 33486 bytes 14 | 15 | Concurrency Level: 1000 16 | Time taken for tests: 116.006 seconds 17 | Complete requests: 10000 18 | Failed requests: 0 19 | Write errors: 0 20 | Total transferred: 337936246 bytes 21 | HTML transferred: 334860000 bytes 22 | Requests per second: 86.20 [#/sec] (mean) 23 | Time per request: 11600.634 [ms] (mean) 24 | Time per request: 11.601 [ms] (mean, across all concurrent requests) 25 | Transfer rate: 2844.81 [Kbytes/sec] received 26 | 27 | Connection Times (ms) 28 | min mean[+/-sd] median max 29 | Connect: 0 0 10.0 0 504 30 | Processing: 2277 11451 714.5 11651 12180 31 | Waiting: 2252 5846 1156.1 5860 8096 32 | Total: 2278 11451 714.3 11651 12180 33 | 34 | Percentage of the requests served within a certain time (ms) 35 | 50% 11651 36 | 66% 11727 37 | 75% 11783 38 | 80% 11821 39 | 90% 11925 40 | 95% 11955 41 | 98% 11984 42 | 99% 11993 43 | 100% 12180 (longest request) 44 | -------------------------------------------------------------------------------- /doc/项目总结 凤翔.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/项目总结 凤翔.docx -------------------------------------------------------------------------------- /doc/项目总结 陈龙龙.docx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/doc/项目总结 陈龙龙.docx -------------------------------------------------------------------------------- /model/Course.coffee: -------------------------------------------------------------------------------- 1 | mongoose = require 'mongoose' 2 | 3 | _Course = new mongoose.Schema 4 | cno: 5 | type:'String' 6 | required:true 7 | cname: 8 | type:'String' 9 | required:true 10 | credit: 11 | type: Number 12 | default: 0 13 | teacher: String 14 | 15 | module.exports = mongoose.model 'Course', _Course -------------------------------------------------------------------------------- /model/Course.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var mongoose, _Course; 4 | 5 | mongoose = require('mongoose'); 6 | 7 | _Course = new mongoose.Schema({ 8 | cno: { 9 | type: 'String', 10 | required: true 11 | }, 12 | cname: { 13 | type: 'String', 14 | required: true 15 | }, 16 | credit: { 17 | type: Number, 18 | "default": 0 19 | }, 20 | teacher: String 21 | }); 22 | 23 | module.exports = mongoose.model('Course', _Course); 24 | 25 | }).call(this); 26 | 27 | //# sourceMappingURL=Course.map 28 | -------------------------------------------------------------------------------- /model/Course.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "Course.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "Course.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,iBAAA;;AAAA,EAAA,QAAA,GAAW,OAAA,CAAQ,UAAR,CAAX,CAAA;;AAAA,EAEA,OAAA,GAAc,IAAA,QAAQ,CAAC,MAAT,CACV;AAAA,IAAA,GAAA,EACI;AAAA,MAAA,IAAA,EAAK,QAAL;AAAA,MACA,QAAA,EAAS,IADT;KADJ;AAAA,IAGA,KAAA,EACI;AAAA,MAAA,IAAA,EAAK,QAAL;AAAA,MACA,QAAA,EAAS,IADT;KAJJ;AAAA,IAMA,MAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,SAAA,EAAS,CADT;KAPJ;AAAA,IASA,OAAA,EAAS,MATT;GADU,CAFd,CAAA;;AAAA,EAcA,MAAM,CAAC,OAAP,GAAiB,QAAQ,CAAC,KAAT,CAAe,QAAf,EAAyB,OAAzB,CAdjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /model/Grade.coffee: -------------------------------------------------------------------------------- 1 | mongoose = require 'mongoose' 2 | 3 | _Grade = new mongoose.Schema 4 | student: 5 | type: mongoose.Schema.Types.ObjectId 6 | ref: 'Student' 7 | required:true 8 | course: 9 | type: mongoose.Schema.Types.ObjectId 10 | ref: 'Course' 11 | required:true 12 | score: 13 | type: Number 14 | required: true 15 | default: 0 16 | 17 | module.exports = mongoose.model 'Grade', _Grade -------------------------------------------------------------------------------- /model/Grade.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var mongoose, _Grade; 4 | 5 | mongoose = require('mongoose'); 6 | 7 | _Grade = new mongoose.Schema({ 8 | student: { 9 | type: mongoose.Schema.Types.ObjectId, 10 | ref: 'Student', 11 | required: true 12 | }, 13 | course: { 14 | type: mongoose.Schema.Types.ObjectId, 15 | ref: 'Course', 16 | required: true 17 | }, 18 | score: { 19 | type: Number, 20 | required: true, 21 | "default": 0 22 | } 23 | }); 24 | 25 | module.exports = mongoose.model('Grade', _Grade); 26 | 27 | }).call(this); 28 | 29 | //# sourceMappingURL=Grade.map 30 | -------------------------------------------------------------------------------- /model/Grade.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "Grade.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "Grade.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,gBAAA;;AAAA,EAAA,QAAA,GAAW,OAAA,CAAQ,UAAR,CAAX,CAAA;;AAAA,EAEA,MAAA,GAAa,IAAA,QAAQ,CAAC,MAAT,CACT;AAAA,IAAA,OAAA,EACI;AAAA,MAAA,IAAA,EAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAA5B;AAAA,MACA,GAAA,EAAK,SADL;AAAA,MAEA,QAAA,EAAS,IAFT;KADJ;AAAA,IAIA,MAAA,EACI;AAAA,MAAA,IAAA,EAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,QAA5B;AAAA,MACA,GAAA,EAAK,QADL;AAAA,MAEA,QAAA,EAAS,IAFT;KALJ;AAAA,IAQA,KAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;AAAA,MAEA,SAAA,EAAS,CAFT;KATJ;GADS,CAFb,CAAA;;AAAA,EAgBA,MAAM,CAAC,OAAP,GAAiB,QAAQ,CAAC,KAAT,CAAe,OAAf,EAAwB,MAAxB,CAhBjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /model/Student.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var mongoose, _Student; 4 | 5 | mongoose = require('mongoose'); 6 | 7 | _Student = new mongoose.Schema({ 8 | sno: { 9 | type: String, 10 | required: true 11 | }, 12 | sname: { 13 | type: String, 14 | required: true 15 | }, 16 | birthday: { 17 | type: Date, 18 | "default": Date.now 19 | }, 20 | gender: { 21 | type: String, 22 | required: true, 23 | "enum": ['男', '女'] 24 | }, 25 | "class": String, 26 | department: String 27 | }); 28 | 29 | module.exports = mongoose.model('Student', _Student); 30 | 31 | }).call(this); 32 | 33 | //# sourceMappingURL=Student.map 34 | -------------------------------------------------------------------------------- /model/Student.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "Student.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "Student.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,kBAAA;;AAAA,EAAA,QAAA,GAAW,OAAA,CAAQ,UAAR,CAAX,CAAA;;AAAA,EAEA,QAAA,GAAe,IAAA,QAAQ,CAAC,MAAT,CACX;AAAA,IAAA,GAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;KADJ;AAAA,IAGA,KAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;KAJJ;AAAA,IAMA,QAAA,EACI;AAAA,MAAA,IAAA,EAAM,IAAN;AAAA,MACA,SAAA,EAAS,IAAI,CAAC,GADd;KAPJ;AAAA,IASA,MAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;AAAA,MAEA,MAAA,EAAK,CAAC,GAAD,EAAK,GAAL,CAFL;KAVJ;AAAA,IAaA,OAAA,EAAO,MAbP;AAAA,IAcA,UAAA,EAAY,MAdZ;GADW,CAFf,CAAA;;AAAA,EAmBA,MAAM,CAAC,OAAP,GAAiB,QAAQ,CAAC,KAAT,CAAe,SAAf,EAA0B,QAA1B,CAnBjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /model/User.coffee: -------------------------------------------------------------------------------- 1 | mongoose = require 'mongoose' 2 | 3 | _User = new mongoose.Schema 4 | username: 5 | type: String 6 | required: true 7 | password: 8 | type: String 9 | required: true 10 | 11 | module.exports = mongoose.model 'User', _User -------------------------------------------------------------------------------- /model/User.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var mongoose, _User; 4 | 5 | mongoose = require('mongoose'); 6 | 7 | _User = new mongoose.Schema({ 8 | username: { 9 | type: String, 10 | required: true 11 | }, 12 | password: { 13 | type: String, 14 | required: true 15 | } 16 | }); 17 | 18 | module.exports = mongoose.model('User', _User); 19 | 20 | }).call(this); 21 | 22 | //# sourceMappingURL=User.map 23 | -------------------------------------------------------------------------------- /model/User.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "User.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "User.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,eAAA;;AAAA,EAAA,QAAA,GAAW,OAAA,CAAQ,UAAR,CAAX,CAAA;;AAAA,EAEA,KAAA,GAAY,IAAA,QAAQ,CAAC,MAAT,CACR;AAAA,IAAA,QAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;KADJ;AAAA,IAGA,QAAA,EACI;AAAA,MAAA,IAAA,EAAM,MAAN;AAAA,MACA,QAAA,EAAU,IADV;KAJJ;GADQ,CAFZ,CAAA;;AAAA,EAUA,MAAM,CAAC,OAAP,GAAiB,QAAQ,CAAC,KAAT,CAAe,MAAf,EAAuB,KAAvB,CAVjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /model/student.coffee: -------------------------------------------------------------------------------- 1 | mongoose = require 'mongoose' 2 | 3 | _Student = new mongoose.Schema 4 | sno: 5 | type: String 6 | required: true 7 | sname: 8 | type: String 9 | required: true 10 | birthday: 11 | type: Date 12 | default: Date.now 13 | gender: 14 | type: String 15 | required: true 16 | enum:['男','女'] 17 | class: String 18 | department: String 19 | 20 | module.exports = mongoose.model 'Student', _Student -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StudentInfo", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node ./bin/www" 7 | }, 8 | "dependencies": { 9 | "express": "~4.2.0", 10 | "serve-favicon": "*", 11 | "morgan": "~1.0.0", 12 | "cookie-parser": "~1.0.1", 13 | "body-parser": "~1.0.0", 14 | "debug": "~0.7.4", 15 | "ejs": "~0.8.5", 16 | "less-middleware": "1.0.x", 17 | "mongodb": "*", 18 | "mongoose": "*", 19 | "coffee-script": "*", 20 | "less": "*", 21 | "express-session": "^1.6.1", 22 | "mocha": "^1.20.1" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/fonts/glyphicons-halflings-regular.eot -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/fonts/glyphicons-halflings-regular.ttf -------------------------------------------------------------------------------- /public/fonts/glyphicons-halflings-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/fonts/glyphicons-halflings-regular.woff -------------------------------------------------------------------------------- /public/images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/images/404.png -------------------------------------------------------------------------------- /public/images/background.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/findix/studentInfo/dad6030bffdb14f059fa6e227bb0e6612775ea82/public/images/background.jpg -------------------------------------------------------------------------------- /public/javascripts/course.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by LL on 2014/7/6. 3 | */ 4 | var update = function (_id) { 5 | $('#form').attr('action', '/course/update/' + _id); 6 | $('#modal-title').text('修改课程'); 7 | var id = '#' + _id; 8 | $('#cno').val($($(id + ' td')[0]).text()); 9 | $('#cname').val($($(id + ' td')[1]).text()); 10 | $('#credit').val($($(id + ' td')[2]).text()); 11 | $('#teacher').val($($(id + ' td')[3]).text()); 12 | }; 13 | var add = function () { 14 | $('#form').attr('action', '/course/add'); 15 | $('#modal-title').text('添加课程'); 16 | $('#cno').val(''); 17 | $('#cname').val(''); 18 | $('#credit').val(''); 19 | $('#teacher').val(''); 20 | }; 21 | $(function () { 22 | var arr = $('tr .average'); 23 | for (var i = 0; i < arr.length; i++) { 24 | (function(j){ 25 | $.ajax({ 26 | url: '/grade/average/' + $(arr[j]).attr('data-id'), 27 | success: function (data) { 28 | $(arr[j]).html(data); 29 | } 30 | } 31 | ); 32 | })(i); 33 | 34 | } 35 | }); -------------------------------------------------------------------------------- /public/javascripts/grade.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Sean on 2014/7/6. 3 | */ 4 | var update = function (_id) { 5 | $('#form').attr('action', '/grade/update/' + _id); 6 | $('#modal-title').text('修改成绩'); 7 | var id = '#' + _id; 8 | $('#cno').val($($(id + ' td')[0]).text()); 9 | $('#cname').val($($(id + ' td')[1]).text()); 10 | $('#score').val($($(id + ' td')[4]).text()); 11 | }; 12 | var add = function () { 13 | $('#form').attr('action', '/grade/add'); 14 | $('#modal-title').text('添加成绩'); 15 | cno.options[0].selected=true; 16 | cname.options[0].selected=true; 17 | $('#score').val($($(id + ' td')[4]).text()); 18 | }; -------------------------------------------------------------------------------- /public/javascripts/login.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 输入框被点击 3 | */ 4 | function onClick() { 5 | 6 | //对函数的第一个参数进行判断 7 | if (arguments[0]) { 8 | var obj = arguments[0]; 9 | } else { 10 | return false; 11 | } 12 | 13 | //获取.tooltip 14 | var tooltip = $(obj).siblings('.tooltip'); 15 | //.tooltip如果存在,就滑出 16 | if (tooltip.length != 0) { 17 | //对函数第二个参数进行判断 18 | if (arguments[1]) { 19 | var text = arguments[1]; 20 | } else { 21 | text = tooltip.data('text'); 22 | } 23 | //设置提示框文字 24 | tooltip.text(text); 25 | //滑出提示框 26 | tooltip.animate({left: '120%'}); 27 | } 28 | ; 29 | } 30 | 31 | /** 32 | * 输入框失去焦点 33 | */ 34 | function onBlur() { 35 | //对函数的第一个参数进行判断 36 | if (arguments[0]) { 37 | var obj = arguments[0]; 38 | } else { 39 | return false; 40 | } 41 | 42 | //获取.tooltip 43 | var tooltip = $(obj).siblings('.tooltip'); 44 | //.tooltip如果存在,就滑入 45 | if (tooltip.length != 0) { 46 | tooltip.animate({left: '20%'}); 47 | } 48 | ; 49 | } 50 | 51 | /** 52 | * 表单验证 53 | */ 54 | function checkForm() { 55 | //对函数的第一个参数进行判断 56 | if (arguments[0]) { 57 | //获取当前表单 58 | var form = arguments[0]; 59 | } else { 60 | return false; 61 | } 62 | 63 | //验证规则汇总 64 | var id = new RegExp(/[0-9]{10}/);//匹配数字10次,用于工号匹配 65 | var password = new RegExp(/\w{6,16}/);//字母6到16次,用于密码匹配 66 | var chinese = new RegExp(/[^\u4e00-\u9fa5]|^$/);//匹配中文以外的字符,用于真实姓名验证 67 | var email = new RegExp(/\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/);//用于邮箱格式验证 68 | 69 | //用户名username验证(同样适用身份证验证) 70 | if (form.username != undefined && !id.test(form.username.value)) { 71 | //不符合匹配规则 72 | onClick($(form.username)[0], '工号不规范,应为10位数字'); 73 | //阻止页面跳转 74 | return false; 75 | } 76 | ; 77 | 78 | //密码password验证 79 | if (form.password != undefined && !password.test(form.password.value)) { 80 | //不符合匹配规则 81 | onClick($(form.password)[0], '新的密码不规范,应为6~16位字母和数字'); 82 | //阻止页面跳转 83 | return false; 84 | } 85 | ; 86 | 87 | //用户类型type验证 88 | if ($(form).find('.option_result').text() == '用户类型') { 89 | //用户没有勾选 90 | onClick($('.option_result')[0], '请选择用户类型'); 91 | //阻止页面跳转 92 | return false; 93 | } 94 | ; 95 | 96 | //真实姓名realname验证 97 | if (form.realname != undefined && chinese.test(form.realname.value)) { 98 | //有非中文字符 99 | onClick($(form.realname)[0], '姓名不规范'); 100 | //阻止页面跳转 101 | return false; 102 | } 103 | ; 104 | 105 | //真实身份证号码id验证 106 | if (form.ID != undefined && !id.test(form.ID.value)) { 107 | //不符合匹配规则 108 | onClick($(form.ID)[0], '身份证号码不规范,应为10位数字'); 109 | //阻止页面跳转 110 | return false; 111 | } 112 | ; 113 | 114 | //邮箱email验证 115 | if (form.email != undefined && !email.test(form.email.value)) { 116 | //不符合匹配规则 117 | onClick($(form.email)[0], '不是有效地电子邮件地址'); 118 | //阻止页面跳转 119 | return false; 120 | } 121 | ; 122 | } 123 | 124 | 125 | $(document).ready(function () { 126 | /** 127 | * 展开/收起下拉列表 128 | */ 129 | $('.option').click(function () { 130 | $(this).children('.option_list').slideToggle(100); 131 | $(this).toggleClass('active'); 132 | }); 133 | 134 | /** 135 | * 设置option的值 136 | */ 137 | $('.option_list li').click(function () { 138 | //获取选择的值 139 | var text = $(this).text(); 140 | //设置option的值 141 | $(this).parent().siblings('.option_result').text(text); 142 | //如果存在就收起提示栏 143 | var tooltip = $(this).parent();//原生js的parentNode是属性而不是方法 144 | if (tooltip.length != 0) { 145 | onBlur(tooltip[0]);//需要传入原生js对象 146 | } 147 | ; 148 | }); 149 | 150 | /** 151 | * 切换到注册栏 152 | */ 153 | $('#register_link').click(function () { 154 | //滑出#login栏,滑入#register栏 155 | $('#login').animate({left: '-100%'}, 400, function () { 156 | $('#register').animate({left: '50%'}); 157 | }); 158 | }); 159 | 160 | /** 161 | * 切换到登陆栏 162 | */ 163 | $('#login_link').click(function () { 164 | //滑出#register栏,滑入#login栏 165 | $('#register').animate({left: '120%'}, 400, function () { 166 | $('#login').animate({left: '50%'}); 167 | }); 168 | }); 169 | 170 | /** 171 | * 登录 172 | */ 173 | $('#login_btn').click(function () { 174 | var $obj = $(this); 175 | $obj.text('登录中...'); 176 | setTimeout(function () { 177 | $obj.text('登录'); 178 | }, 5000); 179 | }); 180 | 181 | /** 182 | * 注册 183 | */ 184 | $('#register_btn').click(function () { 185 | var $obj = $(this); 186 | $obj.text('注册中...'); 187 | setTimeout(function () { 188 | $obj.text('注册'); 189 | }, 5000); 190 | }); 191 | 192 | 193 | }); -------------------------------------------------------------------------------- /public/javascripts/student.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by Sean on 2014/7/5. 3 | */ 4 | var update = function (_id) { 5 | $('#form').attr('action', '/student/update/' + _id); 6 | $('#modal-title').text('修改学生信息'); 7 | var id = '#' + _id; 8 | $('#sno').val($($(id + ' td')[0]).text()); 9 | $('#sname').val($($(id + ' td')[1]).text()); 10 | if ($($(id + ' td')[2]).text() == '男') { 11 | $('input[id=gender]')[0].checked = true; 12 | } else { 13 | $('input[id=gender]')[1].checked = true; 14 | } 15 | $('#class').val($($(id + ' td')[3]).text()); 16 | $('#department').val($($(id + ' td')[4]).text()); 17 | $('#birthday').val($($(id + ' td')[5]).text()); 18 | }; 19 | var add = function () { 20 | $('#form').attr('action', '/student/add'); 21 | $('#modal-title').text('添加学生信息'); 22 | $('#sno').val(''); 23 | $('#sname').val(''); 24 | $('input[id=gender]')[0].checked = true; 25 | $('#class').val(''); 26 | $('#department').val(''); 27 | $('#birthday').val(''); 28 | }; -------------------------------------------------------------------------------- /public/stylesheets/bootstrap-theme.css.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"bootstrap-theme.css","sources":["less/theme.less","less/mixins/vendor-prefixes.less","bootstrap-theme.css","less/mixins/gradients.less","less/mixins/reset-filter.less"],"names":[],"mappings":"AAeA;;;;;;EAME,0CAAA;EC+CA,6FAAA;EACQ,qFAAA;EC5DT;AFiBC;;;;;;;;;;;;EC0CA,0DAAA;EACQ,kDAAA;EC7CT;AFqCC;;EAEE,wBAAA;EEnCH;AFwCD;EG/CI,0EAAA;EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EAEA,wHAAA;ECnBF,qEAAA;EJ8BA,6BAAA;EAC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EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EACA,6BAAA;EACA,wHAAA;ED4VH;AFnID;EG7NI,0EAAA;EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EACA,6BAAA;EACA,wHAAA;EDmWH;AFzID;EG9NI,0EAAA;EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EACA,6BAAA;EACA,wHAAA;ED0WH;AF/ID;EG/NI,0EAAA;EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EACA,6BAAA;EACA,wHAAA;EDiXH;AF9ID;EGvOI,0EAAA;EACA,qEAAA;EACA,+FAAA;EAAA,wEAAA;EACA,6BAAA;EACA,wHAAA;EHqOF,uBAAA;EC1LA,2FAAA;EACQ,mFAAA;EC+UT","sourcesContent":["\n//\n// Load core variables and mixins\n// --------------------------------------------------\n\n@import \"variables.less\";\n@import \"mixins.less\";\n\n\n\n//\n// Buttons\n// --------------------------------------------------\n\n// Common styles\n.btn-default,\n.btn-primary,\n.btn-success,\n.btn-info,\n.btn-warning,\n.btn-danger {\n text-shadow: 0 -1px 0 rgba(0,0,0,.2);\n @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 1px rgba(0,0,0,.075);\n .box-shadow(@shadow);\n\n // Reset the shadow\n &:active,\n &.active {\n .box-shadow(inset 0 3px 5px rgba(0,0,0,.125));\n }\n}\n\n// Mixin for generating new styles\n.btn-styles(@btn-color: #555) {\n #gradient > .vertical(@start-color: @btn-color; @end-color: darken(@btn-color, 12%));\n .reset-filter(); // Disable gradients for IE9 because filter bleeds through rounded corners\n background-repeat: repeat-x;\n border-color: darken(@btn-color, 14%);\n\n &:hover,\n &:focus {\n background-color: darken(@btn-color, 12%);\n background-position: 0 -15px;\n }\n\n &:active,\n &.active {\n background-color: darken(@btn-color, 12%);\n border-color: darken(@btn-color, 14%);\n }\n\n &:disabled,\n &[disabled] {\n background-color: darken(@btn-color, 12%);\n background-image: none;\n }\n}\n\n// Common styles\n.btn {\n // Remove the gradient for the pressed/active state\n &:active,\n &.active {\n background-image: none;\n }\n}\n\n// Apply the mixin to the buttons\n.btn-default { .btn-styles(@btn-default-bg); text-shadow: 0 1px 0 #fff; border-color: #ccc; }\n.btn-primary { .btn-styles(@btn-primary-bg); }\n.btn-success { .btn-styles(@btn-success-bg); }\n.btn-info { .btn-styles(@btn-info-bg); }\n.btn-warning { .btn-styles(@btn-warning-bg); }\n.btn-danger { .btn-styles(@btn-danger-bg); }\n\n\n\n//\n// Images\n// --------------------------------------------------\n\n.thumbnail,\n.img-thumbnail {\n .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n\n\n\n//\n// Dropdowns\n// --------------------------------------------------\n\n.dropdown-menu > li > a:hover,\n.dropdown-menu > li > a:focus {\n #gradient > .vertical(@start-color: @dropdown-link-hover-bg; @end-color: darken(@dropdown-link-hover-bg, 5%));\n background-color: darken(@dropdown-link-hover-bg, 5%);\n}\n.dropdown-menu > .active > a,\n.dropdown-menu > .active > a:hover,\n.dropdown-menu > .active > a:focus {\n #gradient > .vertical(@start-color: @dropdown-link-active-bg; @end-color: darken(@dropdown-link-active-bg, 5%));\n background-color: darken(@dropdown-link-active-bg, 5%);\n}\n\n\n\n//\n// Navbar\n// --------------------------------------------------\n\n// Default navbar\n.navbar-default {\n #gradient > .vertical(@start-color: lighten(@navbar-default-bg, 10%); @end-color: @navbar-default-bg);\n .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered\n border-radius: @navbar-border-radius;\n @shadow: inset 0 1px 0 rgba(255,255,255,.15), 0 1px 5px rgba(0,0,0,.075);\n .box-shadow(@shadow);\n\n .navbar-nav > .active > a {\n #gradient > .vertical(@start-color: darken(@navbar-default-bg, 5%); @end-color: darken(@navbar-default-bg, 2%));\n .box-shadow(inset 0 3px 9px rgba(0,0,0,.075));\n }\n}\n.navbar-brand,\n.navbar-nav > li > a {\n text-shadow: 0 1px 0 rgba(255,255,255,.25);\n}\n\n// Inverted navbar\n.navbar-inverse {\n #gradient > .vertical(@start-color: lighten(@navbar-inverse-bg, 10%); @end-color: @navbar-inverse-bg);\n .reset-filter(); // Remove gradient in IE<10 to fix bug where dropdowns don't get triggered\n\n .navbar-nav > .active > a {\n #gradient > .vertical(@start-color: @navbar-inverse-bg; @end-color: lighten(@navbar-inverse-bg, 2.5%));\n .box-shadow(inset 0 3px 9px rgba(0,0,0,.25));\n }\n\n .navbar-brand,\n .navbar-nav > li > a {\n text-shadow: 0 -1px 0 rgba(0,0,0,.25);\n }\n}\n\n// Undo rounded corners in static and fixed navbars\n.navbar-static-top,\n.navbar-fixed-top,\n.navbar-fixed-bottom {\n border-radius: 0;\n}\n\n\n\n//\n// Alerts\n// --------------------------------------------------\n\n// Common styles\n.alert {\n text-shadow: 0 1px 0 rgba(255,255,255,.2);\n @shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 2px rgba(0,0,0,.05);\n .box-shadow(@shadow);\n}\n\n// Mixin for generating new styles\n.alert-styles(@color) {\n #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 7.5%));\n border-color: darken(@color, 15%);\n}\n\n// Apply the mixin to the alerts\n.alert-success { .alert-styles(@alert-success-bg); }\n.alert-info { .alert-styles(@alert-info-bg); }\n.alert-warning { .alert-styles(@alert-warning-bg); }\n.alert-danger { .alert-styles(@alert-danger-bg); }\n\n\n\n//\n// Progress bars\n// --------------------------------------------------\n\n// Give the progress background some depth\n.progress {\n #gradient > .vertical(@start-color: darken(@progress-bg, 4%); @end-color: @progress-bg)\n}\n\n// Mixin for generating new styles\n.progress-bar-styles(@color) {\n #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 10%));\n}\n\n// Apply the mixin to the progress bars\n.progress-bar { .progress-bar-styles(@progress-bar-bg); }\n.progress-bar-success { .progress-bar-styles(@progress-bar-success-bg); }\n.progress-bar-info { .progress-bar-styles(@progress-bar-info-bg); }\n.progress-bar-warning { .progress-bar-styles(@progress-bar-warning-bg); }\n.progress-bar-danger { .progress-bar-styles(@progress-bar-danger-bg); }\n\n// Reset the striped class because our mixins don't do multiple gradients and\n// the above custom styles override the new `.progress-bar-striped` in v3.2.0.\n.progress-bar-striped {\n #gradient > .striped();\n}\n\n\n//\n// List groups\n// --------------------------------------------------\n\n.list-group {\n border-radius: @border-radius-base;\n .box-shadow(0 1px 2px rgba(0,0,0,.075));\n}\n.list-group-item.active,\n.list-group-item.active:hover,\n.list-group-item.active:focus {\n text-shadow: 0 -1px 0 darken(@list-group-active-bg, 10%);\n #gradient > .vertical(@start-color: @list-group-active-bg; @end-color: darken(@list-group-active-bg, 7.5%));\n border-color: darken(@list-group-active-border, 7.5%);\n}\n\n\n\n//\n// Panels\n// --------------------------------------------------\n\n// Common styles\n.panel {\n .box-shadow(0 1px 2px rgba(0,0,0,.05));\n}\n\n// Mixin for generating new styles\n.panel-heading-styles(@color) {\n #gradient > .vertical(@start-color: @color; @end-color: darken(@color, 5%));\n}\n\n// Apply the mixin to the panel headings only\n.panel-default > .panel-heading { .panel-heading-styles(@panel-default-heading-bg); }\n.panel-primary > .panel-heading { .panel-heading-styles(@panel-primary-heading-bg); }\n.panel-success > .panel-heading { .panel-heading-styles(@panel-success-heading-bg); }\n.panel-info > .panel-heading { .panel-heading-styles(@panel-info-heading-bg); }\n.panel-warning > .panel-heading { .panel-heading-styles(@panel-warning-heading-bg); }\n.panel-danger > .panel-heading { .panel-heading-styles(@panel-danger-heading-bg); }\n\n\n\n//\n// Wells\n// --------------------------------------------------\n\n.well {\n #gradient > .vertical(@start-color: darken(@well-bg, 5%); @end-color: @well-bg);\n border-color: darken(@well-bg, 10%);\n @shadow: inset 0 1px 3px rgba(0,0,0,.05), 0 1px 0 rgba(255,255,255,.1);\n .box-shadow(@shadow);\n}\n","// Vendor Prefixes\n//\n// All vendor mixins are deprecated as of v3.2.0 due to the introduction of\n// Autoprefixer in our Gruntfile. They will be removed in v4.\n\n// - Animations\n// - Backface visibility\n// - Box shadow\n// - Box sizing\n// - Content columns\n// - Hyphens\n// - Placeholder text\n// - Transformations\n// - Transitions\n// - User Select\n\n\n// Animations\n.animation(@animation) {\n -webkit-animation: @animation;\n -o-animation: @animation;\n animation: @animation;\n}\n.animation-name(@name) {\n -webkit-animation-name: @name;\n animation-name: @name;\n}\n.animation-duration(@duration) {\n -webkit-animation-duration: @duration;\n animation-duration: @duration;\n}\n.animation-timing-function(@timing-function) {\n -webkit-animation-timing-function: @timing-function;\n animation-timing-function: @timing-function;\n}\n.animation-delay(@delay) {\n -webkit-animation-delay: @delay;\n animation-delay: @delay;\n}\n.animation-iteration-count(@iteration-count) {\n -webkit-animation-iteration-count: @iteration-count;\n animation-iteration-count: @iteration-count;\n}\n.animation-direction(@direction) {\n -webkit-animation-direction: @direction;\n animation-direction: @direction;\n}\n.animation-fill-mode(@fill-mode) {\n -webkit-animation-fill-mode: @fill-mode;\n animation-fill-mode: @fill-mode;\n}\n\n// Backface visibility\n// Prevent browsers from flickering when using CSS 3D transforms.\n// Default value is `visible`, but can be changed to `hidden`\n\n.backface-visibility(@visibility){\n -webkit-backface-visibility: @visibility;\n -moz-backface-visibility: @visibility;\n backface-visibility: @visibility;\n}\n\n// Drop shadows\n//\n// Note: Deprecated `.box-shadow()` as of v3.1.0 since all of Bootstrap's\n// supported browsers that have box shadow capabilities now support it.\n\n.box-shadow(@shadow) {\n -webkit-box-shadow: @shadow; // iOS <4.3 & Android <4.1\n box-shadow: @shadow;\n}\n\n// Box sizing\n.box-sizing(@boxmodel) {\n -webkit-box-sizing: @boxmodel;\n -moz-box-sizing: @boxmodel;\n box-sizing: @boxmodel;\n}\n\n// CSS3 Content Columns\n.content-columns(@column-count; @column-gap: @grid-gutter-width) {\n -webkit-column-count: @column-count;\n -moz-column-count: @column-count;\n column-count: @column-count;\n -webkit-column-gap: @column-gap;\n -moz-column-gap: @column-gap;\n column-gap: @column-gap;\n}\n\n// Optional hyphenation\n.hyphens(@mode: auto) {\n word-wrap: break-word;\n -webkit-hyphens: @mode;\n -moz-hyphens: @mode;\n -ms-hyphens: @mode; // IE10+\n -o-hyphens: @mode;\n hyphens: @mode;\n}\n\n// Placeholder text\n.placeholder(@color: @input-color-placeholder) {\n &::-moz-placeholder { color: @color; // Firefox\n opacity: 1; } // See https://github.com/twbs/bootstrap/pull/11526\n &:-ms-input-placeholder { color: @color; } // Internet Explorer 10+\n &::-webkit-input-placeholder { color: @color; } // Safari and Chrome\n}\n\n// Transformations\n.scale(@ratio) {\n -webkit-transform: scale(@ratio);\n -ms-transform: scale(@ratio); // IE9 only\n -o-transform: scale(@ratio);\n transform: scale(@ratio);\n}\n.scale(@ratioX; @ratioY) {\n -webkit-transform: scale(@ratioX, @ratioY);\n -ms-transform: scale(@ratioX, @ratioY); // IE9 only\n -o-transform: scale(@ratioX, @ratioY);\n transform: scale(@ratioX, @ratioY);\n}\n.scaleX(@ratio) {\n -webkit-transform: scaleX(@ratio);\n -ms-transform: scaleX(@ratio); // IE9 only\n -o-transform: scaleX(@ratio);\n transform: scaleX(@ratio);\n}\n.scaleY(@ratio) {\n -webkit-transform: scaleY(@ratio);\n -ms-transform: scaleY(@ratio); // IE9 only\n -o-transform: scaleY(@ratio);\n transform: scaleY(@ratio);\n}\n.skew(@x; @y) {\n -webkit-transform: skewX(@x) skewY(@y);\n -ms-transform: skewX(@x) skewY(@y); // See https://github.com/twbs/bootstrap/issues/4885; IE9+\n -o-transform: skewX(@x) skewY(@y);\n transform: skewX(@x) skewY(@y);\n}\n.translate(@x; @y) {\n -webkit-transform: translate(@x, @y);\n -ms-transform: translate(@x, @y); // IE9 only\n -o-transform: translate(@x, @y);\n transform: translate(@x, @y);\n}\n.translate3d(@x; @y; @z) {\n -webkit-transform: translate3d(@x, @y, @z);\n transform: translate3d(@x, @y, @z);\n}\n.rotate(@degrees) {\n -webkit-transform: rotate(@degrees);\n -ms-transform: rotate(@degrees); // IE9 only\n -o-transform: rotate(@degrees);\n transform: rotate(@degrees);\n}\n.rotateX(@degrees) {\n -webkit-transform: rotateX(@degrees);\n -ms-transform: rotateX(@degrees); // IE9 only\n -o-transform: rotateX(@degrees);\n transform: rotateX(@degrees);\n}\n.rotateY(@degrees) {\n -webkit-transform: rotateY(@degrees);\n -ms-transform: rotateY(@degrees); // IE9 only\n -o-transform: rotateY(@degrees);\n transform: rotateY(@degrees);\n}\n.perspective(@perspective) {\n -webkit-perspective: @perspective;\n -moz-perspective: @perspective;\n perspective: @perspective;\n}\n.perspective-origin(@perspective) {\n -webkit-perspective-origin: @perspective;\n -moz-perspective-origin: @perspective;\n perspective-origin: @perspective;\n}\n.transform-origin(@origin) {\n -webkit-transform-origin: @origin;\n -moz-transform-origin: @origin;\n -ms-transform-origin: @origin; // IE9 only\n transform-origin: @origin;\n}\n\n\n// Transitions\n\n.transition(@transition) {\n -webkit-transition: @transition;\n -o-transition: @transition;\n transition: @transition;\n}\n.transition-property(@transition-property) {\n -webkit-transition-property: @transition-property;\n transition-property: @transition-property;\n}\n.transition-delay(@transition-delay) {\n -webkit-transition-delay: @transition-delay;\n transition-delay: @transition-delay;\n}\n.transition-duration(@transition-duration) {\n -webkit-transition-duration: @transition-duration;\n transition-duration: @transition-duration;\n}\n.transition-timing-function(@timing-function) {\n -webkit-transition-timing-function: @timing-function;\n transition-timing-function: @timing-function;\n}\n.transition-transform(@transition) {\n -webkit-transition: -webkit-transform @transition;\n -moz-transition: -moz-transform @transition;\n -o-transition: -o-transform @transition;\n transition: transform @transition;\n}\n\n\n// User select\n// For selecting text on the page\n\n.user-select(@select) {\n -webkit-user-select: @select;\n -moz-user-select: @select;\n -ms-user-select: @select; // IE10+\n user-select: @select;\n}\n",null,"// Gradients\n\n#gradient {\n\n // Horizontal gradient, from left to right\n //\n // Creates two color stops, start and end, by specifying a color and position for each color stop.\n // Color stops are not available in IE9 and below.\n .horizontal(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n background-image: -webkit-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // Safari 5.1-6, Chrome 10+\n background-image: -o-linear-gradient(left, @start-color @start-percent, @end-color @end-percent); // Opera 12\n background-image: linear-gradient(to right, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n background-repeat: repeat-x;\n filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down\n }\n\n // Vertical gradient, from top to bottom\n //\n // Creates two color stops, start and end, by specifying a color and position for each color stop.\n // Color stops are not available in IE9 and below.\n .vertical(@start-color: #555; @end-color: #333; @start-percent: 0%; @end-percent: 100%) {\n background-image: -webkit-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // Safari 5.1-6, Chrome 10+\n background-image: -o-linear-gradient(top, @start-color @start-percent, @end-color @end-percent); // Opera 12\n background-image: linear-gradient(to bottom, @start-color @start-percent, @end-color @end-percent); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n background-repeat: repeat-x;\n filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down\n }\n\n .directional(@start-color: #555; @end-color: #333; @deg: 45deg) {\n background-repeat: repeat-x;\n background-image: -webkit-linear-gradient(@deg, @start-color, @end-color); // Safari 5.1-6, Chrome 10+\n background-image: -o-linear-gradient(@deg, @start-color, @end-color); // Opera 12\n background-image: linear-gradient(@deg, @start-color, @end-color); // Standard, IE10, Firefox 16+, Opera 12.10+, Safari 7+, Chrome 26+\n }\n .horizontal-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n background-image: -webkit-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n background-image: -o-linear-gradient(left, @start-color, @mid-color @color-stop, @end-color);\n background-image: linear-gradient(to right, @start-color, @mid-color @color-stop, @end-color);\n background-repeat: no-repeat;\n filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=1)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n }\n .vertical-three-colors(@start-color: #00b3ee; @mid-color: #7a43b6; @color-stop: 50%; @end-color: #c3325f) {\n background-image: -webkit-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n background-image: -o-linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n background-image: linear-gradient(@start-color, @mid-color @color-stop, @end-color);\n background-repeat: no-repeat;\n filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(startColorstr='%d', endColorstr='%d', GradientType=0)\",argb(@start-color),argb(@end-color))); // IE9 and down, gets no color-stop at all for proper fallback\n }\n .radial(@inner-color: #555; @outer-color: #333) {\n background-image: -webkit-radial-gradient(circle, @inner-color, @outer-color);\n background-image: radial-gradient(circle, @inner-color, @outer-color);\n background-repeat: no-repeat;\n }\n .striped(@color: rgba(255,255,255,.15); @angle: 45deg) {\n background-image: -webkit-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n background-image: -o-linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n background-image: linear-gradient(@angle, @color 25%, transparent 25%, transparent 50%, @color 50%, @color 75%, transparent 75%, transparent);\n }\n}\n","// Reset filters for IE\n//\n// When you need to remove a gradient background, do not forget to use this to reset\n// the IE filter for IE9 and below.\n\n.reset-filter() {\n filter: e(%(\"progid:DXImageTransform.Microsoft.gradient(enabled = false)\"));\n}\n"]} -------------------------------------------------------------------------------- /public/stylesheets/bootstrap-theme.min.css: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v3.2.0 (http://getbootstrap.com) 3 | * Copyright 2011-2014 Twitter, Inc. 4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE) 5 | */.btn-default,.btn-primary,.btn-success,.btn-info,.btn-warning,.btn-danger{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-default:active,.btn-primary:active,.btn-success:active,.btn-info:active,.btn-warning:active,.btn-danger:active,.btn-default.active,.btn-primary.active,.btn-success.active,.btn-info.active,.btn-warning.active,.btn-danger.active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn:active,.btn.active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:hover,.btn-default:focus{background-color:#e0e0e0;background-position:0 -15px}.btn-default:active,.btn-default.active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default:disabled,.btn-default[disabled]{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:-o-linear-gradient(top,#428bca 0,#2d6ca2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#2d6ca2));background-image:linear-gradient(to bottom,#428bca 0,#2d6ca2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff2d6ca2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#2b669a}.btn-primary:hover,.btn-primary:focus{background-color:#2d6ca2;background-position:0 -15px}.btn-primary:active,.btn-primary.active{background-color:#2d6ca2;border-color:#2b669a}.btn-primary:disabled,.btn-primary[disabled]{background-color:#2d6ca2;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:hover,.btn-success:focus{background-color:#419641;background-position:0 -15px}.btn-success:active,.btn-success.active{background-color:#419641;border-color:#3e8f3e}.btn-success:disabled,.btn-success[disabled]{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:hover,.btn-info:focus{background-color:#2aabd2;background-position:0 -15px}.btn-info:active,.btn-info.active{background-color:#2aabd2;border-color:#28a4c9}.btn-info:disabled,.btn-info[disabled]{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:hover,.btn-warning:focus{background-color:#eb9316;background-position:0 -15px}.btn-warning:active,.btn-warning.active{background-color:#eb9316;border-color:#e38d13}.btn-warning:disabled,.btn-warning[disabled]{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:hover,.btn-danger:focus{background-color:#c12e2a;background-position:0 -15px}.btn-danger:active,.btn-danger.active{background-color:#c12e2a;border-color:#b92c28}.btn-danger:disabled,.btn-danger[disabled]{background-color:#c12e2a;background-image:none}.thumbnail,.img-thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{background-color:#357ebd;background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-o-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#357ebd));background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f3f3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f3f3f3));background-image:linear-gradient(to bottom,#ebebeb 0,#f3f3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff3f3f3', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x}.navbar-inverse .navbar-nav>.active>a{background-image:-webkit-linear-gradient(top,#222 0,#282828 100%);background-image:-o-linear-gradient(top,#222 0,#282828 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#222),to(#282828));background-image:linear-gradient(to bottom,#222 0,#282828 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222', endColorstr='#ff282828', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-static-top,.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:-o-linear-gradient(top,#428bca 0,#3071a9 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#3071a9));background-image:linear-gradient(to bottom,#428bca 0,#3071a9 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3071a9', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:hover,.list-group-item.active:focus{text-shadow:0 -1px 0 #3071a9;background-image:-webkit-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:-o-linear-gradient(top,#428bca 0,#3278b3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#3278b3));background-image:linear-gradient(to bottom,#428bca 0,#3278b3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff3278b3', GradientType=0);background-repeat:repeat-x;border-color:#3278b3}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-o-linear-gradient(top,#428bca 0,#357ebd 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#428bca),to(#357ebd));background-image:linear-gradient(to bottom,#428bca 0,#357ebd 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff428bca', endColorstr='#ff357ebd', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)} -------------------------------------------------------------------------------- /public/stylesheets/login.css: -------------------------------------------------------------------------------- 1 | html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,header,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}article,aside,details,figcaption,figure,header,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}table{border-spacing:0}body{background:#87CEFA;overflow:hidden;font:normal 16px/1.5 Helvetica,"Microsoft Yahei",Arial,sans-serif;color:#444;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%}input{padding:10px 15px;outline:0;border:0;border-radius:3px;width:200px}a,a:visited{color:#87CEFA;text-decoration:none;outline:0}a:hover,a:focus{color:#FFF}#clouds{position:absolute;top:0;right:0;bottom:0;left:0}[class^="cloud-"]{position:absolute;right:120%;width:200px;height:60px;background:white;-webkit-border-radius:200px;-moz-border-radius:200px;border-radius:200px}[class^="cloud-"]:before,[class^="cloud-"]:after{content:'';position:absolute;top:-15px;left:10px;width:100px;height:80px;background:#fff;-webkit-border-radius:100px;border-radius:100px;-webkit-transform:rotate(30deg);-moz-transform:rotate(30deg);transform:rotate(30deg)}[class^="cloud-"]:after{top:-55px;left:auto;right:15px;width:120px;height:120px}.cloud-1{top:50px;-webkit-animation:moveclouds 30s linear infinite;-moz-animation:moveclouds 30s linear infinite;-o-animation:moveclouds 30s linear infinite;animation:moveclouds 30s linear infinite}.cloud-2{top:100px;opacity:0.8;-webkit-transform:scale(.8);-moz-transform:scale(.8);transform:scale(.8);-webkit-animation:moveclouds 45s linear infinite;-moz-animation:moveclouds 45s linear infinite;-o-animation:moveclouds 45s linear infinite;animation:moveclouds 45s linear infinite;-webkit-animation-delay:5s;-moz-animation-delay:5s;animation-delay:5s}.cloud-3{top:150px;opacity:0.6;-webkit-transform:scale(.6);-moz-transform:scale(.6);transform:scale(.6);-webkit-animation:moveclouds 40s linear infinite;-moz-animation:moveclouds 40s linear infinite;-o-animation:moveclouds 40s linear infinite;animation:moveclouds 40s linear infinite}.cloud-4{top:200px;opacity:0.75;-webkit-transform:scale(.75);-moz-transform:scale(.75);transform:scale(.75);-webkit-animation:moveclouds 26s linear infinite;-moz-animation:moveclouds 26s linear infinite;-o-animation:moveclouds 26s linear infinite;animation:moveclouds 26s linear infinite;-webkit-animation-delay:8s;-moz-animation-delay:8s;animation-delay:8s}@-webkit-keyframes moveclouds{0%{right:-20%}100%{right:120%}}@-moz-keyframes moveclouds{0%{right:-20%}100%{right:120%}}@-o-keyframes moveclouds{0%{right:-20%}100%{right:120%}}#content{width:100%}.container{width:960px;margin:0 auto;text-align:center}#login,#register{width:400px;height:380px;position:absolute;top:50%;left:50%;margin-top:-200px;margin-left:-200px;background:#F8F8F8;border-radius:10px;box-shadow:0 3px 6px rgba(0,0,0,0.5)}#register{left:120%}#login_header,#register_header{height:60px;line-height:60px;font-size:20px;font-weight:bold;color:#77CA60;background:#FFF;border-radius:10px 10px 0 0;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.icon-home{font-size:30px;position:relative;top:3px}#login_content,#register_content{height:200px;padding:30px 20px}input{width:300px;padding:14px 15px;background:#F0F0F0;font:normal 16px/1.5 Helvetica,"Microsoft Yahei",Arial,sans-serif;color:#444}span{position:relative;display:inline-block;height:50px;margin-bottom:30px}.tip{text-indent:80px;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.tip:focus,.tip:active{text-indent:0}.tip+label{position:absolute;top:16px;left:15px;-webkit-transition:all .3s ease-in-out;-moz-transition:all .3s ease-in-out;transition:all .3s ease-in-out}.tip:focus+label,.tip:active+label{-webkit-transform:translateY(-40px);-moz-transform:translateY(-40px);transform:translateY(-40px)}.icon-user,.icon-lock{position:absolute;top:16px;right:14px;color:#999}.tooltip{width:200px;padding:14px;position:absolute;left:20%;top:0;right:0;color:#999;background:white;text-align:left;z-index:-1;box-shadow:0 1px 3px rgba(0,0,0,0.1)}.tooltip:after{width:0;height:0;content:"";position:absolute;right:100%;top:18px;color:#87CEFA;border:8px solid;border-right-color:white}#login_btn,#register_btn{width:100%;height:60px;line-height:60px;outline:0;border:none;color:white;font-weight:bold;font-size:20px;background:#77CA60;border-radius:0 0 10px 10px;cursor:pointer;text-shadow:1px 1px 1px rgba(0,0,0,0.3)}.ing{width:100%;height:5px;position:absolute;bottom:60px}#register_link,#login_link{width:80px;display:block;margin:20px auto;color:white;border-bottom:1px dashed}.option{width:330px;position:absolute;margin:0 0 0 15px;text-align:left;background:#F07070;cursor:pointer;border-radius:3px}.option_result{display:inline-block;padding:11px 15px}.option_arrow{padding:10px 19px;float:right}.option_arrow .arrow{width:0;height:0;font-size:0;border:6px solid;border-color:#6F7880 #F0F0F0 #F0F0F0}.option_list{background:#F3F3F3;display:none}.option_list li{padding:10px 15px;float:none}.option_list li:hover{background:#DFDFDF} -------------------------------------------------------------------------------- /public/stylesheets/login.less: -------------------------------------------------------------------------------- 1 | /* #Reset & Basics (Inspired by E. Meyers) 2 | ================================================== */ 3 | html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, header, menu, nav, output, ruby, section, summary, time, mark, audio, video { 4 | margin: 0; 5 | padding: 0; 6 | border: 0; 7 | font-size: 100%; 8 | font: inherit; 9 | vertical-align: baseline; 10 | } 11 | 12 | article, aside, details, figcaption, figure, header, menu, nav, section { 13 | display: block; 14 | } 15 | 16 | body { 17 | line-height: 1; 18 | } 19 | 20 | ol, ul { 21 | list-style: none; 22 | } 23 | 24 | blockquote, q { 25 | quotes: none; 26 | } 27 | 28 | blockquote:before, blockquote:after, 29 | q:before, q:after { 30 | content: ''; 31 | content: none; 32 | } 33 | 34 | table { 35 | /*border-collapse: collapse;*/ 36 | border-spacing: 0; 37 | } 38 | 39 | /* #Basic Styles 40 | ================================================== */ 41 | body { 42 | background: #87CEFA; 43 | overflow: hidden; 44 | font: normal 16px/1.5 Helvetica, "Microsoft Yahei", Arial, sans-serif; 45 | color: #444; 46 | -webkit-font-smoothing: antialiased; /* Fix for webkit rendering */ 47 | -webkit-text-size-adjust: 100%; 48 | } 49 | 50 | input { 51 | padding: 10px 15px; 52 | outline: 0; 53 | border: 0; 54 | border-radius: 3px; 55 | width: 200px; 56 | } 57 | 58 | a, a:visited { 59 | color: #87CEFA; 60 | text-decoration: none; 61 | outline: 0; 62 | } 63 | 64 | a:hover, a:focus { 65 | color: #FFF; 66 | } 67 | 68 | /*云层*/ 69 | #clouds { 70 | position: absolute; 71 | top: 0; 72 | right: 0; 73 | bottom: 0; 74 | left: 0; 75 | } 76 | 77 | [class^="cloud-"] { 78 | position: absolute; 79 | right: 120%; 80 | width: 200px; 81 | height: 60px; 82 | background: white; 83 | -webkit-border-radius: 200px; 84 | -moz-border-radius: 200px; 85 | border-radius: 200px; 86 | } 87 | 88 | [class^="cloud-"]:before, [class^="cloud-"]:after { 89 | content: ''; 90 | position: absolute; 91 | top: -15px; 92 | left: 10px; 93 | width: 100px; 94 | height: 80px; 95 | background: #fff; 96 | -webkit-border-radius: 100px; 97 | border-radius: 100px; 98 | -webkit-transform: rotate(30deg); 99 | -moz-transform: rotate(30deg); 100 | transform: rotate(30deg); 101 | } 102 | 103 | [class^="cloud-"]:after { 104 | top: -55px; 105 | left: auto; 106 | right: 15px; 107 | width: 120px; 108 | height: 120px; 109 | } 110 | 111 | .cloud-1 { 112 | top: 50px; 113 | -webkit-animation: moveclouds 30s linear infinite; 114 | -moz-animation: moveclouds 30s linear infinite; 115 | -o-animation: moveclouds 30s linear infinite; 116 | animation: moveclouds 30s linear infinite; 117 | } 118 | 119 | .cloud-2 { 120 | top: 100px; 121 | opacity: 0.8; 122 | -webkit-transform: scale(0.8); 123 | -moz-transform: scale(0.8); 124 | transform: scale(0.8); 125 | -webkit-animation: moveclouds 45s linear infinite; 126 | -moz-animation: moveclouds 45s linear infinite; 127 | -o-animation: moveclouds 45s linear infinite; 128 | animation: moveclouds 45s linear infinite; 129 | -webkit-animation-delay: 5s; 130 | -moz-animation-delay: 5s; 131 | animation-delay: 5s; 132 | } 133 | 134 | .cloud-3 { 135 | top: 150px; 136 | opacity: 0.6; 137 | -webkit-transform: scale(0.6); 138 | -moz-transform: scale(0.6); 139 | transform: scale(0.6); 140 | -webkit-animation: moveclouds 40s linear infinite; 141 | -moz-animation: moveclouds 40s linear infinite; 142 | -o-animation: moveclouds 40s linear infinite; 143 | animation: moveclouds 40s linear infinite; 144 | } 145 | 146 | .cloud-4 { 147 | top: 200px; 148 | opacity: 0.75; 149 | -webkit-transform: scale(0.75); 150 | -moz-transform: scale(0.75); 151 | transform: scale(0.75); 152 | -webkit-animation: moveclouds 26s linear infinite; 153 | -moz-animation: moveclouds 26s linear infinite; 154 | -o-animation: moveclouds 26s linear infinite; 155 | animation: moveclouds 26s linear infinite; 156 | -webkit-animation-delay: 8s; 157 | -moz-animation-delay: 8s; 158 | animation-delay: 8s; 159 | } 160 | 161 | /*云层移动*/ 162 | @-webkit-keyframes moveclouds { 163 | 0% { 164 | right: -20%; 165 | } 166 | 100% { 167 | right: 120%; 168 | } 169 | } 170 | 171 | @-moz-keyframes moveclouds { 172 | 0% { 173 | right: -20%; 174 | } 175 | 100% { 176 | right: 120%; 177 | } 178 | } 179 | 180 | @-o-keyframes moveclouds { 181 | 0% { 182 | right: -20%; 183 | } 184 | 100% { 185 | right: 120%; 186 | } 187 | } 188 | 189 | /* #Content Styles 190 | ================================================== */ 191 | /*内容*/ 192 | #content { 193 | width: 100%; 194 | } 195 | 196 | .container { 197 | width: 960px; 198 | margin: 0 auto; 199 | text-align: center; 200 | } 201 | 202 | /*登录/注册*/ 203 | #login, #register { 204 | width: 400px; 205 | height: 380px; 206 | position: absolute; 207 | top: 50%; 208 | left: 50%; 209 | margin-top: -200px; 210 | margin-left: -200px; 211 | background: #F8F8F8; 212 | border-radius: 10px; 213 | box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5); 214 | } 215 | 216 | #register { 217 | left: 120%; 218 | } 219 | 220 | #login_header, #register_header { 221 | height: 60px; 222 | line-height: 60px; 223 | font-size: 20px; 224 | font-weight: bold; 225 | color: #77CA60; 226 | background: #FFF; 227 | border-radius: 10px 10px 0 0; 228 | -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, .1); 229 | -moz-box-shadow: 0 1px 3px rgba(0, 0, 0, .1); 230 | box-shadow: 0 1px 3px rgba(0, 0, 0, .1); 231 | } 232 | 233 | .icon-home { 234 | font-size: 30px; 235 | position: relative; 236 | top: 3px; 237 | } 238 | 239 | #login_content, #register_content { 240 | height: 200px; 241 | padding: 30px 20px; 242 | } 243 | 244 | input { 245 | width: 300px; 246 | padding: 14px 15px; 247 | background: #F0F0F0; 248 | font: normal 16px/1.5 Helvetica, "Microsoft Yahei", Arial, sans-serif; 249 | color: #444; 250 | } 251 | 252 | span { 253 | position: relative; 254 | display: inline-block; 255 | height: 50px; 256 | margin-bottom: 30px; 257 | } 258 | 259 | .tip { 260 | text-indent: 80px; 261 | -webkit-transition: all .3s ease-in-out; 262 | -moz-transition: all .3s ease-in-out; 263 | transition: all .3s ease-in-out; 264 | } 265 | 266 | .tip:focus, .tip:active { 267 | text-indent: 0; 268 | } 269 | 270 | .tip + label { 271 | position: absolute; 272 | top: 16px; 273 | left: 15px; 274 | -webkit-transition: all .3s ease-in-out; 275 | -moz-transition: all .3s ease-in-out; 276 | transition: all .3s ease-in-out; 277 | } 278 | 279 | .tip:focus + label, .tip:active + label { 280 | -webkit-transform: translateY(-40px); 281 | -moz-transform: translateY(-40px); 282 | transform: translateY(-40px); 283 | } 284 | 285 | .icon-user, .icon-lock { 286 | position: absolute; 287 | top: 16px; 288 | right: 14px; 289 | color: #999; 290 | } 291 | 292 | .tooltip { 293 | width: 200px; 294 | padding: 14px; 295 | position: absolute; 296 | left: 20%; 297 | top: 0; 298 | right: 0; 299 | color: #999; 300 | background: white; 301 | text-align: left; 302 | z-index: -1; 303 | box-shadow: 0 1px 3px rgba(0, 0, 0, .1); 304 | } 305 | 306 | .tooltip:after { 307 | width: 0; 308 | height: 0; 309 | content: ""; 310 | position: absolute; 311 | right: 100%; 312 | top: 18px; 313 | color: #87CEFA; 314 | border: 8px solid; 315 | border-right-color: white; 316 | } 317 | 318 | #login_, #register { 319 | } 320 | 321 | #login_btn, #register_btn { 322 | width: 100%; 323 | height: 60px; 324 | line-height: 60px; 325 | outline: 0; 326 | border: none; 327 | color: white; 328 | font-weight: bold; 329 | font-size: 20px; 330 | background: #77CA60; 331 | border-radius: 0 0 10px 10px; 332 | cursor: pointer; 333 | text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.3); 334 | } 335 | 336 | .ing { 337 | width: 100%; 338 | height: 5px; 339 | position: absolute; 340 | bottom: 60px; 341 | } 342 | 343 | #register_link, #login_link { 344 | width: 80px; 345 | display: block; 346 | margin: 20px auto; 347 | color: white; 348 | border-bottom: 1px dashed; 349 | } 350 | 351 | /*下拉菜单*/ 352 | .option { 353 | width: 330px; 354 | position: absolute; 355 | margin: 0 0 0 15px; 356 | text-align: left; 357 | background: #F07070; 358 | cursor: pointer; 359 | border-radius: 3px; 360 | } 361 | 362 | .option_result { 363 | display: inline-block; 364 | padding: 11px 15px; 365 | } 366 | 367 | .option_arrow { 368 | padding: 10px 19px; 369 | float: right; 370 | } 371 | 372 | .option_arrow .arrow { 373 | width: 0; 374 | height: 0; 375 | font-size: 0; 376 | border: 6px solid; 377 | border-color: #6F7880 #F0F0F0 #F0F0F0; 378 | } 379 | 380 | .option_list { 381 | background: #F3F3F3; 382 | display: none; 383 | } 384 | 385 | .option_list li { 386 | padding: 10px 15px; 387 | float: none; 388 | } 389 | 390 | .option_list li:hover { 391 | background: #DFDFDF; 392 | } -------------------------------------------------------------------------------- /public/stylesheets/main.css: -------------------------------------------------------------------------------- 1 | html,body,#wrap{height:100%}body{background-color:#87CEFA;font-family:"微软雅黑","ff-tisa-web-pro-1","ff-tisa-web-pro-2","Lucida Grande","Helvetica Neue",Helvetica,Arial,"Hiragino Sans GB","Hiragino Sans GB W3","WenQuanYi Micro Hei",sans-serif;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;padding-top:50px}body>#wrap{height:auto;min-height:100%}nav{opacity:0.8}table{background:#fff;opacity:0.9}#main{padding-bottom:120px}#footer{position:relative;margin-top:-120px;height:120px;clear:both}.footer{color:#999;opacity:0.8;text-align:center;padding:20px 0;border-top:2px solid #E7E7E7;border-top-left-radius:1em;border-top-right-radius:1em;background-color:#F7F7F7}.footer p{position:relative}@media (max-height:640px){#footer{margin-top:0}}.submit{text-align:center}@-moz-document url-prefix(){fieldset{display:table-cell}} -------------------------------------------------------------------------------- /public/stylesheets/main.less: -------------------------------------------------------------------------------- 1 | html, body, #wrap { 2 | height: 100%; 3 | } 4 | 5 | body { 6 | background-color: #87CEFA; 7 | font-family: "微软雅黑", "ff-tisa-web-pro-1", "ff-tisa-web-pro-2", "Lucida Grande", "Helvetica Neue", Helvetica, Arial, "Hiragino Sans GB", "Hiragino Sans GB W3", "WenQuanYi Micro Hei", sans-serif; 8 | -webkit-background-size: cover; 9 | -moz-background-size: cover; 10 | -o-background-size: cover; 11 | background-size: cover; 12 | padding-top: 50px; 13 | & > #wrap { 14 | height: auto; 15 | min-height: 100%; 16 | } 17 | } 18 | 19 | nav { 20 | opacity: 0.8; 21 | } 22 | 23 | table { 24 | background: #fff; 25 | opacity: 0.9; 26 | } 27 | 28 | #main { 29 | padding-bottom: 120px; /* 必须使用和footer相同的高度 */ 30 | } 31 | 32 | #footer { 33 | position: relative; 34 | margin-top: -120px; /* footer高度的负值 */ 35 | height: 120px; 36 | clear: both; 37 | } 38 | 39 | .footer { 40 | color: #999; 41 | opacity: 0.8; 42 | text-align: center; 43 | padding: 20px 0; 44 | border-top: 2px solid #E7E7E7; 45 | border-top-left-radius: 1em; 46 | border-top-right-radius: 1em; 47 | background-color: #F7F7F7; 48 | p { 49 | position: relative; 50 | } 51 | } 52 | 53 | @media (max-height: 640px) { 54 | #footer { 55 | margin-top: 0; 56 | } 57 | } 58 | 59 | .submit { 60 | text-align: center; 61 | } 62 | 63 | @-moz-document url-prefix() { 64 | fieldset { 65 | display: table-cell; 66 | } 67 | } -------------------------------------------------------------------------------- /routes/course.coffee: -------------------------------------------------------------------------------- 1 | express = require "express" 2 | mongoose = require 'mongoose' 3 | router = express.Router() 4 | 5 | courseModel = mongoose.model('Course') 6 | gradeModel = mongoose.model('Grade') 7 | 8 | # GET home page. 9 | router.get "/", (req, res) -> 10 | unless req.session.username? 11 | res.redirect '/' 12 | query = req.query.query 13 | courseModel.find("$or": [ 14 | {cname: new RegExp(query)} 15 | {cno: new RegExp(query)} 16 | {teacher: new RegExp(query)} 17 | ],null, {sort: 18 | 'cno': 1 19 | }, 20 | (err, data)-> 21 | if err? 22 | console.log(err) 23 | res.render 'course', 24 | courses: data 25 | username: req.session.username 26 | query: query 27 | status: '' 28 | ) 29 | 30 | # 增加一门课程 31 | router.post "/add", (req, res) -> 32 | unless req.session.username? 33 | res.redirect '/' 34 | _cno = req.body.cno 35 | _cname = req.body.cname 36 | _credit = req.body.credit 37 | _teacher = req.body.teacher 38 | courseEntity = new courseModel 39 | cno: _cno 40 | cname: _cname 41 | credit: _credit 42 | teacher: _teacher 43 | courseEntity.save((err)-> 44 | if err? 45 | console.log(err) 46 | ) 47 | res.redirect '/course' 48 | 49 | # 删除一门课程 50 | router.get "/delete/:cid", (req, res) -> 51 | unless req.session.username? 52 | res.redirect '/' 53 | cid = req.params.cid 54 | console.log(cid) 55 | courseModel.remove( 56 | {_id: cid}, 57 | (err)-> 58 | if err? 59 | console.log(err) 60 | ) 61 | res.redirect '/course' 62 | 63 | # 修改一门课程 64 | router.post "/update/:cid", (req, res) -> 65 | unless req.session.username? 66 | res.redirect '/' 67 | cid = req.params.cid 68 | _cno = req.body.cno 69 | _cname = req.body.cname 70 | _credit = req.body.credit 71 | _teacher = req.body.teacher 72 | courseModel.findByIdAndUpdate(cid, 73 | cno: _cno 74 | cname: _cname 75 | credit: _credit 76 | teacher: _teacher 77 | (err)-> 78 | if err? 79 | console.log(err) 80 | ) 81 | res.redirect '/course' 82 | 83 | module.exports = router -------------------------------------------------------------------------------- /routes/course.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var courseModel, express, gradeModel, mongoose, router; 4 | 5 | express = require("express"); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | router = express.Router(); 10 | 11 | courseModel = mongoose.model('Course'); 12 | 13 | gradeModel = mongoose.model('Grade'); 14 | 15 | router.get("/", function(req, res) { 16 | var query; 17 | if (req.session.username == null) { 18 | res.redirect('/'); 19 | } 20 | query = req.query.query; 21 | return courseModel.find({ 22 | "$or": [ 23 | { 24 | cname: new RegExp(query) 25 | }, { 26 | cno: new RegExp(query) 27 | }, { 28 | teacher: new RegExp(query) 29 | } 30 | ] 31 | }, null, { 32 | sort: { 33 | 'cno': 1 34 | } 35 | }, function(err, data) { 36 | if (err != null) { 37 | console.log(err); 38 | } 39 | return res.render('course', { 40 | courses: data, 41 | username: req.session.username, 42 | query: query, 43 | status: '' 44 | }); 45 | }); 46 | }); 47 | 48 | router.post("/add", function(req, res) { 49 | var courseEntity, _cname, _cno, _credit, _teacher; 50 | if (req.session.username == null) { 51 | res.redirect('/'); 52 | } 53 | _cno = req.body.cno; 54 | _cname = req.body.cname; 55 | _credit = req.body.credit; 56 | _teacher = req.body.teacher; 57 | courseEntity = new courseModel({ 58 | cno: _cno, 59 | cname: _cname, 60 | credit: _credit, 61 | teacher: _teacher 62 | }); 63 | courseEntity.save(function(err) { 64 | if (err != null) { 65 | return console.log(err); 66 | } 67 | }); 68 | return res.redirect('/course'); 69 | }); 70 | 71 | router.get("/delete/:cid", function(req, res) { 72 | var cid; 73 | if (req.session.username == null) { 74 | res.redirect('/'); 75 | } 76 | cid = req.params.cid; 77 | console.log(cid); 78 | courseModel.remove({ 79 | _id: cid 80 | }, function(err) { 81 | if (err != null) { 82 | return console.log(err); 83 | } 84 | }); 85 | return res.redirect('/course'); 86 | }); 87 | 88 | router.post("/update/:cid", function(req, res) { 89 | var cid, _cname, _cno, _credit, _teacher; 90 | if (req.session.username == null) { 91 | res.redirect('/'); 92 | } 93 | cid = req.params.cid; 94 | _cno = req.body.cno; 95 | _cname = req.body.cname; 96 | _credit = req.body.credit; 97 | _teacher = req.body.teacher; 98 | courseModel.findByIdAndUpdate(cid, { 99 | cno: _cno, 100 | cname: _cname, 101 | credit: _credit, 102 | teacher: _teacher 103 | }, function(err) { 104 | if (err != null) { 105 | return console.log(err); 106 | } 107 | }); 108 | return res.redirect('/course'); 109 | }); 110 | 111 | module.exports = router; 112 | 113 | }).call(this); 114 | 115 | //# sourceMappingURL=course.map 116 | -------------------------------------------------------------------------------- /routes/course.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "course.js", 4 | "sour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------------------------------------- /routes/grade.coffee: -------------------------------------------------------------------------------- 1 | express = require "express" 2 | mongoose = require 'mongoose' 3 | router = express.Router() 4 | 5 | gradeModel = mongoose.model "Grade" 6 | courseModel = mongoose.model "Course" 7 | 8 | router.get "/", (req, res)-> 9 | unless req.session.username? 10 | res.redirect '/' 11 | res.redirect '/student' 12 | 13 | router.get "/:sid", (req, res) -> 14 | unless req.session.username? 15 | res.redirect '/' 16 | sid = req.params.sid 17 | gradeModel.find({student: sid}, null, {sort: 18 | 'course.cno': 1 19 | }, 20 | (err, data)-> 21 | if err? 22 | console.log(err) 23 | courseModel.find().exec((err, courses)-> 24 | res.render 'grade', 25 | grades: data 26 | username: req.session.username 27 | status: '' 28 | sid: sid 29 | courses: courses 30 | ) 31 | ).populate("course student") 32 | 33 | # 增加成绩 34 | router.post "/add", (req, res) -> 35 | unless req.session.username? 36 | res.redirect '/' 37 | _cno = req.body.cno 38 | _cname = req.body.cname 39 | _score = req.body.score 40 | _sid = req.body.sid 41 | courseModel.findOne(cno: _cno,(err, data) -> 42 | if err? 43 | console.log(err) 44 | gradeEntity = new gradeModel 45 | student: _sid 46 | course: data._id 47 | score: _score 48 | gradeEntity.save((err)-> 49 | if err? 50 | console.log(err) 51 | ) 52 | res.redirect "/grade/#{_sid}" 53 | ) 54 | 55 | # 删除成绩 56 | router.get "/delete/:gid/:sid", (req, res) -> 57 | unless req.session.username? 58 | res.redirect '/' 59 | gid = req.params.gid 60 | sid = req.params.sid 61 | console.log(gid) 62 | gradeModel.remove( 63 | {_id: gid}, 64 | (err)-> 65 | if err? 66 | console.log(err) 67 | ) 68 | res.redirect "/grade/#{sid}" 69 | 70 | # 修改成绩 71 | router.post "/update/:gid", (req, res) -> 72 | unless req.session.username? 73 | res.redirect '/' 74 | gid = req.params.gid 75 | _cno = req.body.cno 76 | _cname = req.body.cname 77 | _score = req.body.score 78 | _sid = req.body.sid 79 | courseModel.findOne(cno: _cno,(err, data) -> 80 | if err? 81 | console.log(err) 82 | gradeModel.findByIdAndUpdate(gid, 83 | student: _sid 84 | course: data._id 85 | score: _score, 86 | (err)-> 87 | if err? 88 | console.log(err) 89 | ) 90 | ) 91 | res.redirect "/grade/#{_sid}" 92 | 93 | router.get "/average/:cid", (req, res)-> 94 | unless req.session.username? 95 | res.redirect '/' 96 | cid = req.params.cid 97 | gradeModel.find(course: cid,(err, data) -> 98 | sum = 0 99 | sum += datum.score for datum in data 100 | res.send (sum / data.length)+'' 101 | ) 102 | 103 | module.exports = router -------------------------------------------------------------------------------- /routes/grade.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var courseModel, express, gradeModel, mongoose, router; 4 | 5 | express = require("express"); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | router = express.Router(); 10 | 11 | gradeModel = mongoose.model("Grade"); 12 | 13 | courseModel = mongoose.model("Course"); 14 | 15 | router.get("/", function(req, res) { 16 | if (req.session.username == null) { 17 | res.redirect('/'); 18 | } 19 | return res.redirect('/student'); 20 | }); 21 | 22 | router.get("/:sid", function(req, res) { 23 | var sid; 24 | if (req.session.username == null) { 25 | res.redirect('/'); 26 | } 27 | sid = req.params.sid; 28 | return gradeModel.find({ 29 | student: sid 30 | }, null, { 31 | sort: { 32 | 'course.cno': 1 33 | } 34 | }, function(err, data) { 35 | if (err != null) { 36 | console.log(err); 37 | } 38 | return courseModel.find().exec(function(err, courses) { 39 | return res.render('grade', { 40 | grades: data, 41 | username: req.session.username, 42 | status: '', 43 | sid: sid, 44 | courses: courses 45 | }); 46 | }); 47 | }).populate("course student"); 48 | }); 49 | 50 | router.post("/add", function(req, res) { 51 | var _cname, _cno, _score, _sid; 52 | if (req.session.username == null) { 53 | res.redirect('/'); 54 | } 55 | _cno = req.body.cno; 56 | _cname = req.body.cname; 57 | _score = req.body.score; 58 | _sid = req.body.sid; 59 | return courseModel.findOne({ 60 | cno: _cno 61 | }, function(err, data) { 62 | var gradeEntity; 63 | if (err != null) { 64 | console.log(err); 65 | } 66 | gradeEntity = new gradeModel({ 67 | student: _sid, 68 | course: data._id, 69 | score: _score 70 | }); 71 | gradeEntity.save(function(err) { 72 | if (err != null) { 73 | return console.log(err); 74 | } 75 | }); 76 | return res.redirect("/grade/" + _sid); 77 | }); 78 | }); 79 | 80 | router.get("/delete/:gid/:sid", function(req, res) { 81 | var gid, sid; 82 | if (req.session.username == null) { 83 | res.redirect('/'); 84 | } 85 | gid = req.params.gid; 86 | sid = req.params.sid; 87 | console.log(gid); 88 | gradeModel.remove({ 89 | _id: gid 90 | }, function(err) { 91 | if (err != null) { 92 | return console.log(err); 93 | } 94 | }); 95 | return res.redirect("/grade/" + sid); 96 | }); 97 | 98 | router.post("/update/:gid", function(req, res) { 99 | var gid, _cname, _cno, _score, _sid; 100 | if (req.session.username == null) { 101 | res.redirect('/'); 102 | } 103 | gid = req.params.gid; 104 | _cno = req.body.cno; 105 | _cname = req.body.cname; 106 | _score = req.body.score; 107 | _sid = req.body.sid; 108 | courseModel.findOne({ 109 | cno: _cno 110 | }, function(err, data) { 111 | if (err != null) { 112 | console.log(err); 113 | } 114 | return gradeModel.findByIdAndUpdate(gid, { 115 | student: _sid, 116 | course: data._id, 117 | score: _score 118 | }, function(err) { 119 | if (err != null) { 120 | return console.log(err); 121 | } 122 | }); 123 | }); 124 | return res.redirect("/grade/" + _sid); 125 | }); 126 | 127 | router.get("/average/:cid", function(req, res) { 128 | var cid; 129 | if (req.session.username == null) { 130 | res.redirect('/'); 131 | } 132 | cid = req.params.cid; 133 | return gradeModel.find({ 134 | course: cid 135 | }, function(err, data) { 136 | var datum, sum, _i, _len; 137 | sum = 0; 138 | for (_i = 0, _len = data.length; _i < _len; _i++) { 139 | datum = data[_i]; 140 | sum += datum.score; 141 | } 142 | return res.send((sum / data.length) + ''); 143 | }); 144 | }); 145 | 146 | module.exports = router; 147 | 148 | }).call(this); 149 | 150 | //# sourceMappingURL=grade.map 151 | -------------------------------------------------------------------------------- /routes/grade.map: -------------------------------------------------------------------------------- 1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AAC,MAAZ,CAAA,GAAoB,EAA7B,EAHoB;IAAA,CAA5B,EAJwB;EAAA,CAA5B,CA5FA,CAAA;;AAAA,EAsGA,MAAM,CAAC,OAAP,GAAiB,MAtGjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /routes/index.coffee: -------------------------------------------------------------------------------- 1 | express = require "express" 2 | router = express.Router() 3 | 4 | # GET home page. 5 | router.get "/", (req, res) -> 6 | if req.session.username? 7 | # res.render 'index', 8 | # username: req.session.username 9 | res.redirect '/student' 10 | else res.render "login", 11 | status: '' 12 | 13 | router.use "/index", (req, res) -> 14 | unless req.session.username? 15 | res.redirect '/' 16 | res.render 'index', 17 | username: req.session.username 18 | 19 | module.exports = router -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var express, router; 4 | 5 | express = require("express"); 6 | 7 | router = express.Router(); 8 | 9 | router.get("/", function(req, res) { 10 | if (req.session.username != null) { 11 | return res.redirect('/student'); 12 | } else { 13 | return res.render("login", { 14 | status: '' 15 | }); 16 | } 17 | }); 18 | 19 | router.use("/index", function(req, res) { 20 | if (req.session.username == null) { 21 | res.redirect('/'); 22 | } 23 | return res.render('index', { 24 | username: req.session.username 25 | }); 26 | }); 27 | 28 | module.exports = router; 29 | 30 | }).call(this); 31 | 32 | //# sourceMappingURL=index.map 33 | -------------------------------------------------------------------------------- /routes/index.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "index.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "index.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,eAAA;;AAAA,EAAA,OAAA,GAAU,OAAA,CAAQ,SAAR,CAAV,CAAA;;AAAA,EACA,MAAA,GAAS,OAAO,CAAC,MAAR,CAAA,CADT,CAAA;;AAAA,EAIA,MAAM,CAAC,GAAP,CAAW,GAAX,EAAgB,SAAC,GAAD,EAAM,GAAN,GAAA;AACZ,IAAA,IAAG,4BAAH;aAGI,GAAG,CAAC,QAAJ,CAAa,UAAb,EAHJ;KAAA,MAAA;aAIK,GAAG,CAAC,MAAJ,CAAW,OAAX,EACD;AAAA,QAAA,MAAA,EAAQ,EAAR;OADC,EAJL;KADY;EAAA,CAAhB,CAJA,CAAA;;AAAA,EAYA,MAAM,CAAC,GAAP,CAAW,QAAX,EAAqB,SAAC,GAAD,EAAM,GAAN,GAAA;AACjB,IAAA,IAAO,4BAAP;AACI,MAAA,GAAG,CAAC,QAAJ,CAAa,GAAb,CAAA,CADJ;KAAA;WAEA,GAAG,CAAC,MAAJ,CAAW,OAAX,EACI;AAAA,MAAA,QAAA,EAAU,GAAG,CAAC,OAAO,CAAC,QAAtB;KADJ,EAHiB;EAAA,CAArB,CAZA,CAAA;;AAAA,EAkBA,MAAM,CAAC,OAAP,GAAiB,MAlBjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /routes/student.coffee: -------------------------------------------------------------------------------- 1 | express = require "express" 2 | mongoose = require 'mongoose' 3 | router = express.Router() 4 | 5 | studentModel = mongoose.model('Student') 6 | 7 | # GET home page. 8 | router.get "/", (req, res) -> 9 | unless req.session.username? 10 | res.redirect '/' 11 | query = req.query.query 12 | studentModel.find("$or": [ 13 | {sname: new RegExp(query)} 14 | {sno: new RegExp(query)} 15 | {gender: new RegExp(query)} 16 | {class: new RegExp(query)} 17 | {department: new RegExp(query)} 18 | ],null, {sort: 19 | 'sno': 1 20 | }, 21 | (err, data)-> 22 | if err? 23 | console.log(err) 24 | res.render 'student', 25 | students: data 26 | username: req.session.username 27 | query: query 28 | status: '' 29 | ) 30 | 31 | # 增加一个学生 32 | router.post "/add", (req, res) -> 33 | unless req.session.username? 34 | res.redirect '/' 35 | _sno = req.body.sno 36 | _sname = req.body.sname 37 | _gender = req.body.gender 38 | _class = req.body.class 39 | _department = req.body.department 40 | _birthday = req.body.birthday 41 | studentEntity = new studentModel 42 | sno: _sno 43 | sname: _sname 44 | gender: _gender 45 | class: _class 46 | department: _department 47 | birthday: _birthday 48 | studentEntity.save((err)-> 49 | if err? 50 | console.log(err) 51 | ) 52 | res.redirect '/' 53 | 54 | # 删除一个学生 55 | router.get "/delete/:sid", (req, res) -> 56 | unless req.session.username? 57 | res.redirect '/' 58 | sid = req.params.sid 59 | console.log(sid) 60 | studentModel.remove( 61 | {_id: sid}, 62 | (err)-> 63 | if err? 64 | console.log(err) 65 | ) 66 | res.redirect '/student' 67 | 68 | # 修改一个学生 69 | router.post "/update/:sid", (req, res) -> 70 | unless req.session.username? 71 | res.redirect '/' 72 | sid = req.params.sid 73 | _sno = req.body.sno 74 | _sname = req.body.sname 75 | _gender = req.body.gender 76 | _class = req.body.class 77 | _department = req.body.department 78 | _birthday = req.body.birthday 79 | studentModel.findByIdAndUpdate(sid, 80 | sno: _sno 81 | sname: _sname 82 | gender: _gender 83 | class: _class 84 | department: _department 85 | birthday: _birthday, 86 | (err)-> 87 | if err? 88 | console.log(err) 89 | ) 90 | res.redirect '/student' 91 | 92 | module.exports = router -------------------------------------------------------------------------------- /routes/student.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var express, mongoose, router, studentModel; 4 | 5 | express = require("express"); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | router = express.Router(); 10 | 11 | studentModel = mongoose.model('Student'); 12 | 13 | router.get("/", function(req, res) { 14 | var query; 15 | if (req.session.username == null) { 16 | res.redirect('/'); 17 | } 18 | query = req.query.query; 19 | return studentModel.find({ 20 | "$or": [ 21 | { 22 | sname: new RegExp(query) 23 | }, { 24 | sno: new RegExp(query) 25 | }, { 26 | gender: new RegExp(query) 27 | }, { 28 | "class": new RegExp(query) 29 | }, { 30 | department: new RegExp(query) 31 | } 32 | ] 33 | }, null, { 34 | sort: { 35 | 'sno': 1 36 | } 37 | }, function(err, data) { 38 | if (err != null) { 39 | console.log(err); 40 | } 41 | return res.render('student', { 42 | students: data, 43 | username: req.session.username, 44 | query: query, 45 | status: '' 46 | }); 47 | }); 48 | }); 49 | 50 | router.post("/add", function(req, res) { 51 | var studentEntity, _birthday, _class, _department, _gender, _sname, _sno; 52 | if (req.session.username == null) { 53 | res.redirect('/'); 54 | } 55 | _sno = req.body.sno; 56 | _sname = req.body.sname; 57 | _gender = req.body.gender; 58 | _class = req.body["class"]; 59 | _department = req.body.department; 60 | _birthday = req.body.birthday; 61 | studentEntity = new studentModel({ 62 | sno: _sno, 63 | sname: _sname, 64 | gender: _gender, 65 | "class": _class, 66 | department: _department, 67 | birthday: _birthday 68 | }); 69 | studentEntity.save(function(err) { 70 | if (err != null) { 71 | return console.log(err); 72 | } 73 | }); 74 | return res.redirect('/'); 75 | }); 76 | 77 | router.get("/delete/:sid", function(req, res) { 78 | var sid; 79 | if (req.session.username == null) { 80 | res.redirect('/'); 81 | } 82 | sid = req.params.sid; 83 | console.log(sid); 84 | studentModel.remove({ 85 | _id: sid 86 | }, function(err) { 87 | if (err != null) { 88 | return console.log(err); 89 | } 90 | }); 91 | return res.redirect('/student'); 92 | }); 93 | 94 | router.post("/update/:sid", function(req, res) { 95 | var sid, _birthday, _class, _department, _gender, _sname, _sno; 96 | if (req.session.username == null) { 97 | res.redirect('/'); 98 | } 99 | sid = req.params.sid; 100 | _sno = req.body.sno; 101 | _sname = req.body.sname; 102 | _gender = req.body.gender; 103 | _class = req.body["class"]; 104 | _department = req.body.department; 105 | _birthday = req.body.birthday; 106 | studentModel.findByIdAndUpdate(sid, { 107 | sno: _sno, 108 | sname: _sname, 109 | gender: _gender, 110 | "class": _class, 111 | department: _department, 112 | birthday: _birthday 113 | }, function(err) { 114 | if (err != null) { 115 | return console.log(err); 116 | } 117 | }); 118 | return res.redirect('/student'); 119 | }); 120 | 121 | module.exports = router; 122 | 123 | }).call(this); 124 | 125 | //# sourceMappingURL=student.map 126 | -------------------------------------------------------------------------------- /routes/student.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "student.js", 4 | "sourceRoot": "",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,IAAL;AAAA,MACA,KAAA,EAAO,MADP;AAAA,MAEA,MAAA,EAAQ,OAFR;AAAA,MAGA,OAAA,EAAO,MAHP;AAAA,MAIA,UAAA,EAAY,WAJZ;AAAA,MAKA,QAAA,EAAU,SALV;KADJ,EAOI,SAAC,GAAD,GAAA;AACI,MAAA,IAAG,WAAH;eACI,OAAO,CAAC,GAAR,CAAY,GAAZ,EADJ;OADJ;IAAA,CAPJ,CATA,CAAA;WAoBA,GAAG,CAAC,QAAJ,CAAa,UAAb,EArBwB;EAAA,CAA5B,CApEA,CAAA;;AAAA,EA2FA,MAAM,CAAC,OAAP,GAAiB,MA3FjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /routes/test.coffee: -------------------------------------------------------------------------------- 1 | express = require "express" 2 | router = express.Router() 3 | 4 | router.get "/", (req, res) -> 5 | if req.session.username? 6 | res.render 'index', 7 | username: req.session.username 8 | else res.render "login", 9 | status: '' 10 | 11 | module.exports = router -------------------------------------------------------------------------------- /routes/test.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var express, router; 4 | 5 | express = require("express"); 6 | 7 | router = express.Router(); 8 | 9 | router.get("/", function(req, res) { 10 | if (req.session.username != null) { 11 | return res.render('index', { 12 | username: req.session.username 13 | }); 14 | } else { 15 | return res.render("login", { 16 | status: '' 17 | }); 18 | } 19 | }); 20 | 21 | module.exports = router; 22 | 23 | }).call(this); 24 | 25 | //# sourceMappingURL=test.map 26 | -------------------------------------------------------------------------------- /routes/test.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "test.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "test.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,eAAA;;AAAA,EAAA,OAAA,GAAU,OAAA,CAAQ,SAAR,CAAV,CAAA;;AAAA,EACA,MAAA,GAAS,OAAO,CAAC,MAAR,CAAA,CADT,CAAA;;AAAA,EAGA,MAAM,CAAC,GAAP,CAAW,GAAX,EAAgB,SAAC,GAAD,EAAM,GAAN,GAAA;AACZ,IAAA,IAAG,4BAAH;aACI,GAAG,CAAC,MAAJ,CAAW,OAAX,EACI;AAAA,QAAA,QAAA,EAAU,GAAG,CAAC,OAAO,CAAC,QAAtB;OADJ,EADJ;KAAA,MAAA;aAGK,GAAG,CAAC,MAAJ,CAAW,OAAX,EACD;AAAA,QAAA,MAAA,EAAQ,EAAR;OADC,EAHL;KADY;EAAA,CAAhB,CAHA,CAAA;;AAAA,EAUA,MAAM,CAAC,OAAP,GAAiB,MAVjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /routes/user.coffee: -------------------------------------------------------------------------------- 1 | express = require("express") 2 | mongoose = require 'mongoose' 3 | router = express.Router() 4 | 5 | user = mongoose.model('User') 6 | 7 | # GET login listing. 8 | router.post '/Login', (req, res) -> 9 | username = req.body.username 10 | password = req.body.password 11 | user.find 12 | username: username 13 | password: password 14 | , (err, data) -> 15 | if data.length is 0 16 | then res.render 'login', 17 | status: '
用户名或密码错误
' 18 | else 19 | req.session.username = username 20 | res.redirect "/" 21 | 22 | router.get '/login', (req, res) -> 23 | res.redirect '/' 24 | 25 | router.use '/logout', (req, res) -> 26 | req.session.username = null 27 | res.redirect '/' 28 | 29 | router.get '/changepasswd', (req, res)-> 30 | unless req.session.username? 31 | res.redirect '/' 32 | else res.render 'changePasswd', 33 | username: req.session.username 34 | status: '' 35 | 36 | router.post '/Changepasswd', (req, res)-> 37 | unless req.session.username? 38 | res.redirect '/' 39 | else 40 | username = req.session.username 41 | oldPassword = req.body.oldPassword 42 | password = req.body.password 43 | console.log username, oldPassword, password 44 | user.findOne 45 | username: username 46 | password: oldPassword 47 | , (err, data)-> 48 | if not data? 49 | then res.render 'changePasswd', 50 | username: username 51 | status: '
您输入的密码有错误
' 52 | else 53 | passwordRegex = new RegExp(/\w{6,16}/) 54 | if not passwordRegex.test(password) 55 | then res.render 'changePasswd', 56 | username: username 57 | status: '
密码不规范,应为6~16位字母和数字!
' 58 | else data.password = password 59 | data.save() 60 | res.render 'changePasswd', 61 | username: username 62 | status: '
密码修改成功!
' 63 | module.exports = router -------------------------------------------------------------------------------- /routes/user.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var express, mongoose, router, user; 4 | 5 | express = require("express"); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | router = express.Router(); 10 | 11 | user = mongoose.model('User'); 12 | 13 | router.post('/Login', function(req, res) { 14 | var password, username; 15 | username = req.body.username; 16 | password = req.body.password; 17 | return user.find({ 18 | username: username, 19 | password: password 20 | }, function(err, data) { 21 | if (data.length === 0) { 22 | return res.render('login', { 23 | status: '
用户名或密码错误
' 24 | }); 25 | } else { 26 | req.session.username = username; 27 | return res.redirect("/"); 28 | } 29 | }); 30 | }); 31 | 32 | router.get('/login', function(req, res) { 33 | return res.redirect('/'); 34 | }); 35 | 36 | router.use('/logout', function(req, res) { 37 | req.session.username = null; 38 | return res.redirect('/'); 39 | }); 40 | 41 | router.get('/changepasswd', function(req, res) { 42 | if (req.session.username == null) { 43 | return res.redirect('/'); 44 | } else { 45 | return res.render('changePasswd', { 46 | username: req.session.username, 47 | status: '' 48 | }); 49 | } 50 | }); 51 | 52 | router.post('/Changepasswd', function(req, res) { 53 | var oldPassword, password, username; 54 | if (req.session.username == null) { 55 | return res.redirect('/'); 56 | } else { 57 | username = req.session.username; 58 | oldPassword = req.body.oldPassword; 59 | password = req.body.password; 60 | console.log(username, oldPassword, password); 61 | return user.findOne({ 62 | username: username, 63 | password: oldPassword 64 | }, function(err, data) { 65 | var passwordRegex; 66 | if (data == null) { 67 | return res.render('changePasswd', { 68 | username: username, 69 | status: '
您输入的密码有错误
' 70 | }); 71 | } else { 72 | passwordRegex = new RegExp(/\w{6,16}/); 73 | if (!passwordRegex.test(password)) { 74 | res.render('changePasswd', { 75 | username: username, 76 | status: '
密码不规范,应为6~16位字母和数字!
' 77 | }); 78 | } else { 79 | data.password = password; 80 | } 81 | data.save(); 82 | return res.render('changePasswd', { 83 | username: username, 84 | status: '
密码修改成功!
' 85 | }); 86 | } 87 | }); 88 | } 89 | }); 90 | 91 | module.exports = router; 92 | 93 | }).call(this); 94 | 95 | //# sourceMappingURL=user.map 96 | -------------------------------------------------------------------------------- /routes/user.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "user.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "user.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,+BAAA;;AAAA,EAAA,OAAA,GAAU,OAAA,CAAQ,SAAR,CAAV,CAAA;;AAAA,EACA,QAAA,GAAW,OAAA,CAAQ,UAAR,CADX,CAAA;;AAAA,EAEA,MAAA,GAAS,OAAO,CAAC,MAAR,CAAA,CAFT,CAAA;;AAAA,EAIA,IAAA,GAAO,QAAQ,CAAC,KAAT,CAAe,MAAf,CAJP,CAAA;;AAAA,EAOA,MAAM,CAAC,IAAP,CAAY,QAAZ,EAAsB,SAAC,GAAD,EAAM,GAAN,GAAA;AAClB,QAAA,kBAAA;AAAA,IAAA,QAAA,GAAW,GAAG,CAAC,IAAI,CAAC,QAApB,CAAA;AAAA,IACA,QAAA,GAAW,GAAG,CAAC,IAAI,CAAC,QADpB,CAAA;WAEA,IAAI,CAAC,IAAL,CACI;AAAA,MAAA,QAAA,EAAU,QAAV;AAAA,MACA,QAAA,EAAU,QADV;KADJ,EAGE,SAAC,GAAD,EAAM,IAAN,GAAA;AACE,MAAA,IAAG,IAAI,CAAC,MAAL,KAAe,CAAlB;eACK,GAAG,CAAC,MAAJ,CAAW,OAAX,EACD;AAAA,UAAA,MAAA,EAAQ,2CAAR;SADC,EADL;OAAA,MAAA;AAII,QAAA,GAAG,CAAC,OAAO,CAAC,QAAZ,GAAuB,QAAvB,CAAA;eACA,GAAG,CAAC,QAAJ,CAAa,GAAb,EALJ;OADF;IAAA,CAHF,EAHkB;EAAA,CAAtB,CAP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,WADV;OADJ,EAGE,SAAC,GAAD,EAAM,IAAN,GAAA;AACE,YAAA,aAAA;AAAA,QAAA,IAAO,YAAP;iBACK,GAAG,CAAC,MAAJ,CAAW,cAAX,EACD;AAAA,YAAA,QAAA,EAAU,QAAV;AAAA,YACA,MAAA,EAAQ,iDADR;WADC,EADL;SAAA,MAAA;AAKI,UAAA,aAAA,GAAoB,IAAA,MAAA,CAAO,UAAP,CAApB,CAAA;AACA,UAAA,IAAG,CAAA,aAAiB,CAAC,IAAd,CAAmB,QAAnB,CAAP;AACK,YAAA,GAAG,CAAC,MAAJ,CAAW,cAAX,EACD;AAAA,cAAA,QAAA,EAAU,QAAV;AAAA,cACA,MAAA,EAAQ,2DADR;aADC,CAAA,CADL;WAAA,MAAA;AAIK,YAAA,IAAI,CAAC,QAAL,GAAgB,QAAhB,CAJL;WADA;AAAA,UAMA,IAAI,CAAC,IAAL,CAAA,CANA,CAAA;iBAOA,GAAG,CAAC,MAAJ,CAAW,cAAX,EACI;AAAA,YAAA,QAAA,EAAU,QAAV;AAAA,YACA,MAAA,EAAQ,gDADR;WADJ,EAZJ;SADF;MAAA,CAHF,EAPJ;KADyB;EAAA,CAA7B,CAnCA,CAAA;;AAAA,EA8DA,MAAM,CAAC,OAAP,GAAiB,MA9DjB,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /test/courseTest.coffee: -------------------------------------------------------------------------------- 1 | db = require('../config/database'); 2 | mongoose = require 'mongoose' 3 | 4 | courseModel = mongoose.model('Course') 5 | 6 | for i in [200002..200010] 7 | courseEntity = new courseModel( 8 | cno: i + '' 9 | cname: "Thinkins in #{i}" 10 | credit: 6 11 | teacher: 'Steve Jobs' 12 | ) 13 | courseEntity.save (err)-> 14 | if err? 15 | console.log(err) 16 | 17 | -------------------------------------------------------------------------------- /test/courseTest.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var courseEntity, courseModel, db, i, mongoose, _i; 4 | 5 | db = require('../config/database'); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | courseModel = mongoose.model('Course'); 10 | 11 | for (i = _i = 200002; _i <= 200010; i = ++_i) { 12 | courseEntity = new courseModel({ 13 | cno: i + '', 14 | cname: "Thinkins in " + i, 15 | credit: 6, 16 | teacher: 'Steve Jobs' 17 | }); 18 | courseEntity.save(function(err) { 19 | if (err != null) { 20 | return console.log(err); 21 | } 22 | }); 23 | } 24 | 25 | }).call(this); 26 | 27 | //# sourceMappingURL=courseTest.map 28 | -------------------------------------------------------------------------------- /test/courseTest.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "courseTest.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "courseTest.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,8CAAA;;AAAA,EAAA,EAAA,GAAK,OAAA,CAAQ,oBAAR,CAAL,CAAA;;AAAA,EACA,QAAA,GAAW,OAAA,CAAQ,UAAR,CADX,CAAA;;AAAA,EAGA,WAAA,GAAc,QAAQ,CAAC,KAAT,CAAe,QAAf,CAHd,CAAA;;AAKA,OAAS,uCAAT,GAAA;AACI,IAAA,YAAA,GAAmB,IAAA,WAAA,CACf;AAAA,MAAA,GAAA,EAAK,CAAA,GAAI,EAAT;AAAA,MACA,KAAA,EAAQ,cAAA,GAAa,CADrB;AAAA,MAEA,MAAA,EAAQ,CAFR;AAAA,MAGA,OAAA,EAAS,YAHT;KADe,CAAnB,CAAA;AAAA,IAMA,YAAY,CAAC,IAAb,CAAkB,SAAC,GAAD,GAAA;AACd,MAAA,IAAG,WAAH;eACI,OAAO,CAAC,GAAR,CAAY,GAAZ,EADJ;OADc;IAAA,CAAlB,CANA,CADJ;AAAA,GALA;AAAA" 10 | } -------------------------------------------------------------------------------- /test/gradeTest.coffee: -------------------------------------------------------------------------------- 1 | db = require('../config/database'); 2 | mongoose = require 'mongoose' 3 | 4 | gradeModel = require "../model/Grade" 5 | 6 | gradeEntity=new gradeModel( 7 | student:'53b81f0cfb6310cc12ff820f' 8 | course:'53b8d654805cf358317ff37b' 9 | score:90 10 | ) 11 | gradeEntity.save((err)-> 12 | if err? 13 | console.log(err) 14 | ) -------------------------------------------------------------------------------- /test/gradeTest.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var db, gradeEntity, gradeModel, mongoose; 4 | 5 | db = require('../config/database'); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | gradeModel = require("../model/Grade"); 10 | 11 | gradeEntity = new gradeModel({ 12 | student: '53b81f0cfb6310cc12ff820f', 13 | course: '53b8d654805cf358317ff37b', 14 | score: 90 15 | }); 16 | 17 | gradeEntity.save(function(err) { 18 | if (err != null) { 19 | return console.log(err); 20 | } 21 | }); 22 | 23 | }).call(this); 24 | 25 | //# sourceMappingURL=gradeTest.map 26 | -------------------------------------------------------------------------------- /test/gradeTest.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "gradeTest.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "gradeTest.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,qCAAA;;AAAA,EAAA,EAAA,GAAK,OAAA,CAAQ,oBAAR,CAAL,CAAA;;AAAA,EACA,QAAA,GAAW,OAAA,CAAQ,UAAR,CADX,CAAA;;AAAA,EAGA,UAAA,GAAa,OAAA,CAAQ,gBAAR,CAHb,CAAA;;AAAA,EAKA,WAAA,GAAgB,IAAA,UAAA,CACZ;AAAA,IAAA,OAAA,EAAQ,0BAAR;AAAA,IACA,MAAA,EAAO,0BADP;AAAA,IAEA,KAAA,EAAM,EAFN;GADY,CALhB,CAAA;;AAAA,EAUA,WAAW,CAAC,IAAZ,CAAiB,SAAC,GAAD,GAAA;AACb,IAAA,IAAG,WAAH;aACI,OAAO,CAAC,GAAR,CAAY,GAAZ,EADJ;KADa;EAAA,CAAjB,CAVA,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /test/studentTest.coffee: -------------------------------------------------------------------------------- 1 | db = require('../config/database'); 2 | mongoose = require 'mongoose' 3 | 4 | studentModel = require('../model/Student'); 5 | 6 | #for i in [20113092..20113122] 7 | # studentEntity = new student 8 | # sno: '' + i 9 | # sname: '' + i 10 | # gender: if Math.random() > 0.5 then '男' else '女' 11 | # class: '2011221' 12 | # department: '软件工程系' 13 | # console.log studentEntity 14 | # studentEntity.save((err)->if err? 15 | # console.log err) 16 | 17 | 18 | #studentEntity=new studentModel 19 | # sno: '123456' 20 | # sname: '123456' 21 | # gender: '男' 22 | # class: '123456' 23 | # department: '123456' 24 | # birthday: new Date() 25 | #studentEntity.save() -------------------------------------------------------------------------------- /test/studentTest.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var db, mongoose, studentModel; 4 | 5 | db = require('../config/database'); 6 | 7 | mongoose = require('mongoose'); 8 | 9 | studentModel = require('../model/Student'); 10 | 11 | }).call(this); 12 | 13 | //# sourceMappingURL=studentTest.map 14 | -------------------------------------------------------------------------------- /test/studentTest.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "studentTest.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "studentTest.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,0BAAA;;AAAA,EAAA,EAAA,GAAK,OAAA,CAAQ,oBAAR,CAAL,CAAA;;AAAA,EACA,QAAA,GAAW,OAAA,CAAQ,UAAR,CADX,CAAA;;AAAA,EAGA,YAAA,GAAe,OAAA,CAAQ,kBAAR,CAHf,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /test/userTest.coffee: -------------------------------------------------------------------------------- 1 | db = require('../config/database'); 2 | 3 | user = require('../model/User'); 4 | 5 | userEntity = new user 6 | username: '2013000001' 7 | password: '123456' 8 | userEntity.save() 9 | 10 | user.findOne 11 | username:1234567890, 12 | (err,data)-> 13 | console.log data._id 14 | -------------------------------------------------------------------------------- /test/userTest.js: -------------------------------------------------------------------------------- 1 | // Generated by CoffeeScript 1.7.1 2 | (function() { 3 | var db, user, userEntity; 4 | 5 | db = require('../config/database'); 6 | 7 | user = require('../model/User'); 8 | 9 | userEntity = new user({ 10 | username: '2013000001', 11 | password: '123456' 12 | }); 13 | 14 | userEntity.save(); 15 | 16 | user.findOne({ 17 | username: 1234567890 18 | }, function(err, data) { 19 | return console.log(data._id); 20 | }); 21 | 22 | }).call(this); 23 | 24 | //# sourceMappingURL=userTest.map 25 | -------------------------------------------------------------------------------- /test/userTest.map: -------------------------------------------------------------------------------- 1 | { 2 | "version": 3, 3 | "file": "userTest.js", 4 | "sourceRoot": "", 5 | "sources": [ 6 | "userTest.coffee" 7 | ], 8 | "names": [], 9 | "mappings": ";AAAA;AAAA,MAAA,oBAAA;;AAAA,EAAA,EAAA,GAAK,OAAA,CAAQ,oBAAR,CAAL,CAAA;;AAAA,EAEA,IAAA,GAAO,OAAA,CAAQ,eAAR,CAFP,CAAA;;AAAA,EAIA,UAAA,GAAiB,IAAA,IAAA,CACb;AAAA,IAAA,QAAA,EAAU,YAAV;AAAA,IACA,QAAA,EAAU,QADV;GADa,CAJjB,CAAA;;AAAA,EAOA,UAAU,CAAC,IAAX,CAAA,CAPA,CAAA;;AAAA,EASA,IAAI,CAAC,OAAL,CACI;AAAA,IAAA,QAAA,EAAS,UAAT;GADJ,EAEI,SAAC,GAAD,EAAK,IAAL,GAAA;WACI,OAAO,CAAC,GAAR,CAAY,IAAI,CAAC,GAAjB,EADJ;EAAA,CAFJ,CATA,CAAA;AAAA" 10 | } -------------------------------------------------------------------------------- /views/changePasswd.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | <% include public/nav %> 18 |
19 |
20 | <%- status %> 21 |
22 |
修改密码
23 |
24 | 37 |
38 |
39 |
40 |
41 | 65 |
66 |
67 | 68 | <% include public/footer %> 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /views/course.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | <% include public/nav %> 18 |
19 | 20 | 29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 43 | 44 | <% if(courses != undefined){ 45 | courses.forEach(function(course){ %> 46 | 47 | 48 | 49 | 50 | 51 | 52 | 58 | <% });} %> 59 |
课号课程名学分教师平均分 39 | 42 |
<%= course.cno %><%= course.cname %><%= course.credit %><%= course.teacher %> 53 | 56 | 删除 57 |
60 |
61 | 62 | 115 | 116 |
117 |
118 |
119 | 120 | <% include public/footer %> 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /views/error.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 |
18 | 19 |
20 |
21 | 29 |
30 |
31 |
<%= error.stack %>
32 |
33 |
34 |
35 |
36 | 37 | 38 |
39 |
40 |
41 | 42 | <% include public/footer %> 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /views/grade.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | <% include public/nav %> 18 | 19 |
20 | 21 | 返回 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 37 | 38 | <% if(grades != undefined){ 39 | grades.forEach(function(grade){ %> 40 | 41 | 42 | 43 | 44 | 45 | 46 | 52 | <% });} %> 53 |
课号课程名学分教师成绩 33 | 36 |
<%= grade.course.cno %><%= grade.course.cname %><%= grade.course.credit %><%= grade.course.teacher %><%= grade.score %> 47 | 50 | 删除 51 |
54 |
55 | 56 | 113 | 114 |
115 |
116 |
117 | 118 | <% include public/footer %> 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | -------------------------------------------------------------------------------- /views/index.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | <% include public/nav %> 18 |
19 |
20 | 21 | <% include public/footer %> 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /views/login.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 |
18 | 19 | 27 | 28 | 29 |
30 |
31 | 32 |
33 |
学生信息管理系统
34 | 35 |
36 | 37 | 39 | 40 | 41 |
填写您的工号
42 |
43 | 44 | 46 | 47 | 48 |
填写您的密码
49 |
50 | 51 |
52 | <%- status %> 53 |
54 |
55 | 56 | 57 | 61 | 62 | 63 |
64 | 65 |
66 | 67 |
68 | 69 |
70 |
71 | 72 | <% include public/footer %> 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | -------------------------------------------------------------------------------- /views/public/footer.ejs: -------------------------------------------------------------------------------- 1 |
2 | 19 |
-------------------------------------------------------------------------------- /views/public/nav.ejs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /views/student.ejs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 学生信息管理系统 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 |
17 | <% include public/nav %> 18 | 19 |
20 | 21 | 29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 44 | 45 | <% if(students != undefined){ 46 | students.forEach(function(student){ %> 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 58 | 64 | 65 | <% });} %> 66 |
学号姓名性别班级院系生日 40 | 43 |
<%= student.sno %><%= student.sname %><%= student.gender %><%= student.class %><%= student.department %><%= student.birthday.getFullYear() + '-' + 55 | (student.birthday.getMonth()+1 < 10 ? '0' + (student.birthday.getMonth()+1) : (student.birthday.getMonth()+1)) + '-' + 56 | (student.birthday.getDate() < 10 ? '0' + student.birthday.getDate() : student.birthday.getDate()) 57 | %> 59 | 62 | 删除 63 | 查看成绩
67 |
68 | 69 | 144 | 145 |
146 |
147 |
148 | 149 | <% include public/footer %> 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | --------------------------------------------------------------------------------