├── static ├── .gitkeep ├── logo-192.png ├── logo-48.png ├── logo-96.png ├── join_feedback_group_qr.png └── manifest.json ├── pic ├── done.png ├── group.png ├── upload.png ├── work_1.png ├── group_1.png ├── un_done.png ├── add_group.png └── work_detail.png ├── src ├── assets │ └── logo.png ├── store │ └── index.js ├── components │ ├── Tree.vue │ ├── WelcomeCard.vue │ ├── TreeItem.vue │ ├── Welcome.vue │ ├── teacher │ │ ├── MoveDialog.vue │ │ ├── Preview.vue │ │ ├── Work.vue │ │ └── WorkDetails.vue │ ├── Pagination.vue │ ├── CreateGroup.vue │ ├── student │ │ ├── UnDone.vue │ │ └── Done.vue │ └── Group.vue ├── main.js ├── user │ └── index.js ├── api │ └── index.js ├── router │ └── index.js ├── http │ └── index.js └── App.vue ├── config ├── prod.env.js ├── dev.env.js └── index.js ├── .editorconfig ├── .gitignore ├── .babelrc ├── .postcssrc.js ├── index.html ├── v2版本API.js ├── package.json ├── README.md └── LICENSE /static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /pic/done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/done.png -------------------------------------------------------------------------------- /pic/group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/group.png -------------------------------------------------------------------------------- /pic/upload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/upload.png -------------------------------------------------------------------------------- /pic/work_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/work_1.png -------------------------------------------------------------------------------- /pic/group_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/group_1.png -------------------------------------------------------------------------------- /pic/un_done.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/un_done.png -------------------------------------------------------------------------------- /pic/add_group.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/add_group.png -------------------------------------------------------------------------------- /pic/work_detail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/pic/work_detail.png -------------------------------------------------------------------------------- /src/assets/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/src/assets/logo.png -------------------------------------------------------------------------------- /static/logo-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/static/logo-192.png -------------------------------------------------------------------------------- /static/logo-48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/static/logo-48.png -------------------------------------------------------------------------------- /static/logo-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/static/logo-96.png -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | module.exports = { 3 | NODE_ENV: '"production"' 4 | } 5 | -------------------------------------------------------------------------------- /static/join_feedback_group_qr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/itning/shw_client/master/static/join_feedback_group_qr.png -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | const merge = require('webpack-merge') 3 | const prodEnv = require('./prod.env') 4 | 5 | module.exports = merge(prodEnv, { 6 | NODE_ENV: '"development"' 7 | }) 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | /dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | 8 | # Editor directories and files 9 | .idea 10 | .vscode 11 | *.suo 12 | *.ntvs* 13 | *.njsproj 14 | *.sln 15 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { 4 | "modules": false, 5 | "targets": { 6 | "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] 7 | } 8 | }], 9 | "stage-2" 10 | ], 11 | "plugins": ["transform-vue-jsx", "transform-runtime"] 12 | } 13 | -------------------------------------------------------------------------------- /.postcssrc.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | "plugins": { 5 | "postcss-import": {}, 6 | "postcss-url": {}, 7 | // to edit target browsers: use "browserslist" field in package.json 8 | "autoprefixer": {} 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Vuex from 'vuex' 3 | 4 | Vue.use(Vuex); 5 | 6 | export default new Vuex.Store({ 7 | state: { 8 | existGroup: false 9 | }, 10 | getters: { 11 | exist_group: state => { 12 | return state.existGroup; 13 | } 14 | }, 15 | mutations: { 16 | have_groups(state) { 17 | state.existGroup = true; 18 | }, 19 | none_groups(state) { 20 | state.existGroup = false; 21 | } 22 | } 23 | }) 24 | -------------------------------------------------------------------------------- /static/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "作业管理系统", 3 | "name": "哈信息作业管理系统", 4 | "icons": [ 5 | { 6 | "src": "/static/logo-48.png", 7 | "type": "image/png", 8 | "sizes": "48x48" 9 | }, 10 | { 11 | "src": "/static/logo-96.png", 12 | "type": "image/png", 13 | "sizes": "96x96" 14 | }, 15 | { 16 | "src": "/static/logo-192.png", 17 | "type": "image/png", 18 | "sizes": "192x192" 19 | } 20 | ], 21 | "start_url": "/", 22 | "display": "standalone", 23 | "orientation": "portrait", 24 | "theme_color": "#448aff", 25 | "background_color": "#448aff" 26 | } 27 | -------------------------------------------------------------------------------- /src/components/Tree.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 28 | 29 | 40 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // The Vue build version to load with the `import` command 2 | // (runtime-only or standalone) has been set in webpack.base.conf with an alias. 3 | import Vue from 'vue' 4 | import App from './App' 5 | import router from './router' 6 | import store from './store' 7 | import VueMaterial from 'vue-material' 8 | import Toasted from 'vue-toasted'; 9 | import User from '@/user' 10 | import * as fundebug from "fundebug-javascript"; 11 | import fundebugVue from "fundebug-vue"; 12 | import 'vue-material/dist/vue-material.min.css' 13 | import 'vue-material/dist/theme/default.css' 14 | fundebug.apikey = "2a7ca23266214f8be244652a3d19751ec83e802f16606d4b875f9815eb104327"; 15 | fundebugVue(fundebug, Vue); 16 | 17 | Vue.config.productionTip = false; 18 | 19 | Vue.use(VueMaterial); 20 | Vue.use(Toasted); 21 | Vue.use(User); 22 | 23 | /* eslint-disable no-new */ 24 | new Vue({ 25 | el: '#app', 26 | router, 27 | store, 28 | components: {App}, 29 | template: '' 30 | }); 31 | -------------------------------------------------------------------------------- /src/components/WelcomeCard.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 38 | 39 | 42 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 哈信息学生作业管理系统 18 | 19 | 20 | 24 |
25 | 26 | 27 | -------------------------------------------------------------------------------- /src/user/index.js: -------------------------------------------------------------------------------- 1 | import {Base64} from 'js-base64'; 2 | 3 | let User = {}; 4 | let loginUser = init(); 5 | 6 | function init() { 7 | if (window.localStorage.getItem('authorization_token') === null) { 8 | return {}; 9 | } 10 | try { 11 | return JSON.parse(JSON.parse( 12 | Base64.decode( 13 | window.localStorage.getItem('authorization_token') 14 | .split('.')[1] 15 | ) 16 | ).loginUser); 17 | } catch (e) { 18 | window.localStorage.removeItem('authorization_token'); 19 | return {}; 20 | } 21 | } 22 | 23 | User.loginUser = loginUser; 24 | User.loginName = loginUser.name; 25 | User.user_is_student = loginUser.userType === '99'; 26 | User.user_is_teacher = loginUser.userType !== '99'; 27 | User.supportPreviewFiles = { 28 | officeExtensionNames: ['.doc', '.docx', '.ppt', '.pptx', '.xls', '.xlsx'], 29 | immediacyExtensionNames: ['.bmp', '.gif', '.png', '.jpeg', '.ico', '.jpg', '.pdf', '.htm', '.html', '.cpp', '.c', '.h', '.php', '.java', '.sql', '.bat', '.vue', '.js', '.json', '.cs', '.md', '.log', '.txt',], 30 | zipExtensionNames: ['.zip'] 31 | }; 32 | 33 | User.install = function (Vue, options) { 34 | Vue.prototype.$user = User; 35 | }; 36 | export default User; 37 | -------------------------------------------------------------------------------- /src/components/TreeItem.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 44 | 45 | 56 | -------------------------------------------------------------------------------- /src/api/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | export const BASE_URL = "http://172.16.28.19:9000"; 3 | export const CAS_LOGIN_URL = BASE_URL + "/login"; 4 | export const CAS_LOGOUT_URL = BASE_URL + "/logout"; 5 | 6 | export function Student() { 7 | const str = "/student"; 8 | return { 9 | groups: BASE_URL + str + '/groups', 10 | works_undone: BASE_URL + str + '/works/un_done', 11 | works_done: BASE_URL + str + '/works/done', 12 | upload: BASE_URL + str + '/upload/', 13 | addGroup: BASE_URL + str + '/group', 14 | dropOutGroup: BASE_URL + str + '/group/', 15 | uploadWork: BASE_URL + str + '/work/', 16 | deleteUpload: BASE_URL + str + '/work/', 17 | existGroup: BASE_URL + str + '/group/exist', 18 | downWork: BASE_URL + str + '/down/', 19 | downPreview: BASE_URL + str + '/down_preview/', 20 | notices: BASE_URL + str + '/notices', 21 | getReview: BASE_URL + str + '/review/', 22 | delNotice: BASE_URL + str + '/notice/', 23 | } 24 | } 25 | 26 | export function Teacher() { 27 | const str = "/teacher"; 28 | return { 29 | groups: BASE_URL + str + '/groups', 30 | existGroup: BASE_URL + str + '/group/exist', 31 | createGroup: BASE_URL + str + '/group', 32 | delGroup: BASE_URL + str + '/group/', 33 | upGroupName: BASE_URL + str + '/group/', 34 | works: BASE_URL + str + '/works', 35 | work: BASE_URL + str + '/work/', 36 | createWork: BASE_URL + str + '/work', 37 | delWork: BASE_URL + str + '/work/', 38 | upWorkEnabled: BASE_URL + str + '/work/enabled/', 39 | upWorkName: BASE_URL + str + '/work/name/', 40 | workDetail: BASE_URL + str + '/work_detail/', 41 | pack: BASE_URL + str + '/pack/', 42 | downAll: BASE_URL + str + '/down/', 43 | downNow: BASE_URL + str + '/down_now/', 44 | downInZip: BASE_URL + str + '/down_in_zip/', 45 | zipPreview: BASE_URL + str + '/zip_preview/', 46 | reviewWork: BASE_URL + str + '/review/', 47 | getReviewWork: BASE_URL + str + '/review/', 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /v2版本API.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | export const BASE_URL = "http://itning:8888"; 3 | export const CAS_LOGIN_URL = BASE_URL + "/v2/user/login"; 4 | export const CAS_LOGOUT_URL = BASE_URL + "/v2/user/logout"; 5 | const str = "/v2"; 6 | 7 | export function Student() { 8 | return { 9 | groups: BASE_URL + str + '/student_group', 10 | works_undone: BASE_URL + str + '/work/un_done', 11 | works_done: BASE_URL + str + '/work/done', 12 | upload: BASE_URL + str + '/upload/', 13 | addGroup: BASE_URL + str + '/student_group', 14 | dropOutGroup: BASE_URL + str + '/student_group/', 15 | uploadWork: BASE_URL + str + '/file/up/', 16 | deleteUpload: BASE_URL + str + '/upload/', 17 | existGroup: BASE_URL + str + '/student_group/exist', 18 | downWork: BASE_URL + str + '/file/down/', 19 | downPreview: BASE_URL + str + '/down_preview/', 20 | notices: BASE_URL + str + '/notice', 21 | getReview: BASE_URL + str + '/upload/review/', 22 | delNotice: BASE_URL + str + '/notice/', 23 | } 24 | } 25 | 26 | export function Teacher() { 27 | return { 28 | groups: BASE_URL + str + '/group', 29 | existGroup: BASE_URL + str + '/group/exist', 30 | createGroup: BASE_URL + str + '/group', 31 | delGroup: BASE_URL + str + '/group/', 32 | upGroupName: BASE_URL + str + '/group/', 33 | works: BASE_URL + str + '/work/works', 34 | work: BASE_URL + str + '/work/', 35 | createWork: BASE_URL + str + '/work', 36 | delWork: BASE_URL + str + '/work/', 37 | upWorkEnabled: BASE_URL + str + '/work/enabled/', 38 | upWorkName: BASE_URL + str + '/work/name/', 39 | workDetail: BASE_URL + str + '/work/detail/', 40 | pack: BASE_URL + str + '/pack/', 41 | downAll: BASE_URL + str + '/down/', 42 | downNow: BASE_URL + str + '/file/down_now/', 43 | downInZip: BASE_URL + str + '/down_in_zip/', 44 | zipPreview: BASE_URL + str + '/zip_preview/', 45 | reviewWork: BASE_URL + str + '/review/', 46 | getReviewWork: BASE_URL + str + '/upload/review/', 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | // Template version: 1.3.1 3 | // see http://vuejs-templates.github.io/webpack for documentation. 4 | 5 | const path = require('path') 6 | 7 | module.exports = { 8 | dev: { 9 | 10 | // Paths 11 | assetsSubDirectory: 'static', 12 | assetsPublicPath: '/', 13 | proxyTable: {}, 14 | 15 | // Various Dev Server settings 16 | host: 'localhost', // can be overwritten by process.env.HOST 17 | port: 8090, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined 18 | autoOpenBrowser: false, 19 | errorOverlay: true, 20 | notifyOnErrors: true, 21 | poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions- 22 | 23 | 24 | /** 25 | * Source Maps 26 | */ 27 | 28 | // https://webpack.js.org/configuration/devtool/#development 29 | devtool: 'cheap-module-eval-source-map', 30 | 31 | // If you have problems debugging vue-files in devtools, 32 | // set this to false - it *may* help 33 | // https://vue-loader.vuejs.org/en/options.html#cachebusting 34 | cacheBusting: true, 35 | 36 | cssSourceMap: true 37 | }, 38 | 39 | build: { 40 | // Template for index.html 41 | index: path.resolve(__dirname, '../dist/index.html'), 42 | 43 | // Paths 44 | assetsRoot: path.resolve(__dirname, '../dist'), 45 | assetsSubDirectory: 'static', 46 | assetsPublicPath: '/', 47 | 48 | /** 49 | * Source Maps 50 | */ 51 | 52 | productionSourceMap: true, 53 | // https://webpack.js.org/configuration/devtool/#production 54 | devtool: '#source-map', 55 | 56 | // Gzip off by default as many popular static hosts such as 57 | // Surge or Netlify already gzip all static assets for you. 58 | // Before setting to `true`, make sure to: 59 | // npm install --save-dev compression-webpack-plugin 60 | productionGzip: false, 61 | productionGzipExtensions: ['js', 'css'], 62 | 63 | // Run the build command with an extra argument to 64 | // View the bundle analyzer report after build finishes: 65 | // `npm run build --report` 66 | // Set to `true` or `false` to always turn it on or off 67 | bundleAnalyzerReport: process.env.npm_config_report 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "shw_client", 3 | "version": "1.8.2-RELEASE", 4 | "description": "Student HomeWork Management System Client", 5 | "author": "itning ", 6 | "private": true, 7 | "scripts": { 8 | "dev": "webpack-dev-server --inline --progress --config build/webpack.dev.conf.js", 9 | "start": "npm run dev", 10 | "build": "node build/build.js" 11 | }, 12 | "dependencies": { 13 | "axios": "^0.18.0", 14 | "dayjs": "^1.8.8", 15 | "fundebug-javascript": "^1.7.1", 16 | "fundebug-vue": "^0.0.1", 17 | "js-base64": "^2.5.1", 18 | "vue": "^2.5.2", 19 | "vue-material": "^1.0.0-beta-11", 20 | "vue-router": "^3.0.1", 21 | "vue-toasted": "^1.1.26", 22 | "vuex": "^3.0.1" 23 | }, 24 | "devDependencies": { 25 | "autoprefixer": "^7.1.2", 26 | "babel-core": "^6.22.1", 27 | "babel-helper-vue-jsx-merge-props": "^2.0.3", 28 | "babel-loader": "^7.1.1", 29 | "babel-plugin-syntax-jsx": "^6.18.0", 30 | "babel-plugin-transform-runtime": "^6.22.0", 31 | "babel-plugin-transform-vue-jsx": "^3.5.0", 32 | "babel-preset-env": "^1.3.2", 33 | "babel-preset-stage-2": "^6.22.0", 34 | "chalk": "^2.0.1", 35 | "copy-webpack-plugin": "^4.0.1", 36 | "css-loader": "^0.28.0", 37 | "extract-text-webpack-plugin": "^3.0.0", 38 | "file-loader": "^1.1.4", 39 | "friendly-errors-webpack-plugin": "^1.6.1", 40 | "html-webpack-plugin": "^2.30.1", 41 | "node-notifier": "^5.1.2", 42 | "optimize-css-assets-webpack-plugin": "^3.2.0", 43 | "ora": "^1.2.0", 44 | "portfinder": "^1.0.13", 45 | "postcss-import": "^11.0.0", 46 | "postcss-loader": "^2.0.8", 47 | "postcss-url": "^7.2.1", 48 | "rimraf": "^2.6.0", 49 | "semver": "^5.3.0", 50 | "shelljs": "^0.7.6", 51 | "uglifyjs-webpack-plugin": "^1.1.1", 52 | "url-loader": "^0.5.8", 53 | "vue-loader": "^13.3.0", 54 | "vue-style-loader": "^3.0.1", 55 | "vue-template-compiler": "^2.5.2", 56 | "webpack": "^3.6.0", 57 | "webpack-bundle-analyzer": "^2.9.0", 58 | "webpack-dev-server": "^2.9.1", 59 | "webpack-merge": "^4.1.0" 60 | }, 61 | "engines": { 62 | "node": ">= 6.0.0", 63 | "npm": ">= 3.0.0" 64 | }, 65 | "browserslist": [ 66 | "> 1%", 67 | "last 2 versions", 68 | "not ie <= 8" 69 | ] 70 | } 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 学生作业管理系统客户端 2 | 3 | > Student HomeWork Management System Client 4 | 5 | [![GitHub stars](https://img.shields.io/github/stars/itning/shw_client.svg?style=social&label=Stars)](https://github.com/itning/shw_client/stargazers) 6 | [![GitHub forks](https://img.shields.io/github/forks/itning/shw_client.svg?style=social&label=Fork)](https://github.com/itning/shw_client/network/members) 7 | [![GitHub watchers](https://img.shields.io/github/watchers/itning/shw_client.svg?style=social&label=Watch)](https://github.com/itning/shw_client/watchers) 8 | [![GitHub followers](https://img.shields.io/github/followers/itning.svg?style=social&label=Follow)](https://github.com/itning?tab=followers) 9 | 10 | [![GitHub issues](https://img.shields.io/github/issues/itning/shw_client.svg)](https://github.com/itning/shw_client/issues) 11 | [![GitHub license](https://img.shields.io/github/license/itning/shw_client.svg)](https://github.com/itning/shw_client/blob/master/LICENSE) 12 | [![GitHub last commit](https://img.shields.io/github/last-commit/itning/shw_client.svg)](https://github.com/itning/shw_client/commits) 13 | [![GitHub release](https://img.shields.io/github/release/itning/shw_client.svg)](https://github.com/itning/shw_client/releases) 14 | [![GitHub repo size in bytes](https://img.shields.io/github/repo-size/itning/shw_client.svg)](https://github.com/itning/shw_client) 15 | [![HitCount](http://hits.dwyl.io/itning/shw_client.svg)](http://hits.dwyl.io/itning/shw_client) 16 | [![language](https://img.shields.io/badge/language-Vue-green.svg)](https://github.com/itning/shw_client) 17 | 18 | ## 更改BASE URL 19 | 20 | [https://github.com/itning/shw_client/blob/master/src/api/index.js#L2](https://github.com/itning/shw_client/blob/master/src/api/index.js#L2) 21 | 22 | ## 构建步骤 23 | 24 | [下载yarn](https://classic.yarnpkg.com/zh-Hans/docs/install/#windows-stable) 25 | 26 | ``` bash 27 | # 安装依赖 28 | # 不建议使用 npm install 在本项目中 29 | yarn install 30 | 31 | # 开发服务 32 | npm run dev 33 | 34 | # 构建 35 | npm run build 36 | ``` 37 | 38 | ## 截图 39 | 40 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/add_group.png) 41 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/done.png) 42 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/group.png) 43 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/group_1.png) 44 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/un_done.png) 45 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/upload.png) 46 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/work_1.png) 47 | ![](https://raw.githubusercontent.com/itning/shw_client/master/pic/work_detail.png) 48 | -------------------------------------------------------------------------------- /src/components/Welcome.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 88 | 89 | 92 | -------------------------------------------------------------------------------- /src/components/teacher/MoveDialog.vue: -------------------------------------------------------------------------------- 1 | 13 | 14 | 87 | 88 | 118 | -------------------------------------------------------------------------------- /src/components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 106 | 107 | 110 | -------------------------------------------------------------------------------- /src/components/teacher/Preview.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 119 | 120 | 123 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import Router from 'vue-router' 3 | import {Get} from "@/http"; 4 | import {Student, Teacher} from "@/api"; 5 | import store from "@/store"; 6 | import User from '@/user'; 7 | 8 | Vue.use(Router); 9 | 10 | let router = new Router({ 11 | mode: 'history', 12 | routes: [ 13 | { 14 | path: '/', 15 | redirect: '/welcome' 16 | }, 17 | { 18 | path: '/welcome', 19 | name: 'Welcome', 20 | component: () => import(/* webpackChunkName: "welcome" */ '@/components/Welcome.vue'), 21 | beforeEnter: (to, from, next) => { 22 | window.localStorage.removeItem('student_groups'); 23 | 24 | let info = Vue.toasted.info('检查群组状态', { 25 | position: "top-right", 26 | icon: 'hourglass_empty' 27 | }); 28 | //根据用户角色 99为学生 29 | if (User.user_is_student) { 30 | Get(Student().existGroup).withErrorStartMsg('').do(response => { 31 | if (response.data.data) { 32 | store.commit('have_groups'); 33 | next('un_done'); 34 | } else { 35 | store.commit('none_groups'); 36 | next(); 37 | } 38 | }).doAfter(() => { 39 | info.goAway(500); 40 | }); 41 | } else { 42 | Get(Teacher().existGroup).withErrorStartMsg('').do(response => { 43 | if (response.data.data) { 44 | next('group'); 45 | } else { 46 | next(); 47 | } 48 | }).doAfter(() => { 49 | info.goAway(500); 50 | }); 51 | } 52 | } 53 | }, 54 | { 55 | path: '/un_done', 56 | name: 'UnDone', 57 | component: () => import(/* webpackChunkName: "un_done" */ '@/components/student/UnDone.vue'), 58 | beforeEnter: (to, from, next) => { 59 | if (User.user_is_student) { 60 | next(); 61 | return; 62 | } 63 | next('/'); 64 | } 65 | }, 66 | { 67 | path: '/done', 68 | name: 'Done', 69 | component: () => import(/* webpackChunkName: "done" */ '@/components/student/Done.vue'), 70 | beforeEnter: (to, from, next) => { 71 | if (User.user_is_student) { 72 | next(); 73 | return; 74 | } 75 | next('/'); 76 | } 77 | }, 78 | { 79 | path: '/group', 80 | name: 'Group', 81 | component: () => import(/* webpackChunkName: "group" */ '@/components/Group.vue'), 82 | }, 83 | { 84 | path: '/work/:id', 85 | name: 'Work', 86 | component: () => import(/* webpackChunkName: "work" */ '@/components/teacher/Work.vue'), 87 | props: true, 88 | beforeEnter: (to, from, next) => { 89 | if (User.user_is_teacher) { 90 | next(); 91 | return; 92 | } 93 | next('/'); 94 | } 95 | }, 96 | { 97 | path: '/work_details/:id', 98 | name: 'WorkDetails', 99 | component: () => import(/* webpackChunkName: "work_details" */ '@/components/teacher/WorkDetails.vue'), 100 | props: true, 101 | beforeEnter: (to, from, next) => { 102 | if (User.user_is_teacher) { 103 | next(); 104 | return; 105 | } 106 | next('/'); 107 | } 108 | }, 109 | { 110 | path: '/preview/:type/:url', 111 | name: 'Preview', 112 | component: () => import(/* webpackChunkName: "preview" */ '@/components/teacher/Preview.vue'), 113 | props: true, 114 | beforeEnter: (to, from, next) => { 115 | if (User.user_is_teacher) { 116 | next(); 117 | return; 118 | } 119 | next('/'); 120 | } 121 | }, 122 | { 123 | path: '/token/:id', 124 | name: 'token', 125 | component: () => import(/* webpackChunkName: "welcome" */ '@/components/Welcome.vue'), 126 | beforeEnter: (to, from, next) => { 127 | window.localStorage.setItem('authorization_token', to.params.id); 128 | window.location.href = window.location.protocol + '//' + window.location.host; 129 | next(false); 130 | } 131 | }, 132 | { 133 | path: "*", 134 | redirect: "/" 135 | } 136 | ] 137 | }); 138 | router.beforeEach((to, from, next) => { 139 | if (to.path.startsWith('/token')) { 140 | next(); 141 | return; 142 | } 143 | let path = window.localStorage.getItem('last_path'); 144 | if (path !== null) { 145 | window.localStorage.removeItem('last_path'); 146 | next(path); 147 | } else { 148 | next(); 149 | } 150 | }); 151 | export default router; 152 | -------------------------------------------------------------------------------- /src/components/CreateGroup.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 137 | 138 | 148 | -------------------------------------------------------------------------------- /src/http/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios' 2 | import Vue from 'vue' 3 | import {CAS_LOGIN_URL} from "@/api"; 4 | 5 | //12s超时 6 | let instance = axios.create({timeout: 1000 * 12}); 7 | 8 | //请求拦截器 9 | instance.interceptors.request.use((request) => { 10 | let token = window.localStorage.getItem('authorization_token'); 11 | if (token !== undefined) { 12 | request.headers = { 13 | "Authorization": token, 14 | "Accept": "application/json" 15 | }; 16 | } else { 17 | request.headers = {"Accept": "application/json"}; 18 | } 19 | return request; 20 | 21 | }, function (error) { 22 | // Do something with request error 23 | return Promise.reject(error); 24 | }); 25 | 26 | // 响应拦截器 27 | instance.interceptors.response.use( 28 | response => { 29 | return Promise.resolve(response); 30 | }, 31 | // 服务器状态码不是200的情况 32 | error => { 33 | if (error.response === undefined) { 34 | showErrorToast('网络异常'); 35 | return Promise.reject(error); 36 | } 37 | if (error.response.status) { 38 | switch (error.response.status) { 39 | case 401: 40 | window.localStorage.setItem('last_path', window.location.pathname); 41 | setTimeout(() => { 42 | window.location.href = CAS_LOGIN_URL; 43 | }, 2000); 44 | once401Toast(error.response.data.msg); 45 | return; 46 | case 403: 47 | console.log("403"); 48 | break; 49 | case 404: 50 | console.log("404"); 51 | break; 52 | case 500: 53 | console.log("500"); 54 | break; 55 | case 503: 56 | console.log("503"); 57 | break; 58 | default: 59 | console.log(error.response.data.message); 60 | } 61 | return Promise.reject(error); 62 | } 63 | } 64 | ); 65 | 66 | const showErrorToast = function (msg) { 67 | Vue.toasted.error(msg, { 68 | position: "top-right", 69 | icon: 'clear', 70 | duration: 5000, 71 | }); 72 | }; 73 | 74 | let show = false; 75 | const once401Toast = function (msg) { 76 | if (show) { 77 | return; 78 | } 79 | Vue.toasted.error(msg, { 80 | position: "top-right", 81 | icon: 'clear' 82 | }); 83 | show = true; 84 | }; 85 | 86 | const Method = {GET: 0, POST: 1, DELETE: 2, UPDATE: 3, PUT: 4, PATCH: 5}; 87 | 88 | export function Get(url) { 89 | return new _request(url, Method.GET); 90 | } 91 | 92 | export function Del(url) { 93 | return new _request(url, Method.DELETE); 94 | } 95 | 96 | export function Post(url) { 97 | return new _request(url, Method.POST); 98 | } 99 | 100 | export function Patch(url) { 101 | return new _request(url, Method.PATCH); 102 | } 103 | 104 | function _request(url, method) { 105 | this.method = method; 106 | this.url = url; 107 | this.code = 200; 108 | this.startMsg = '错误:'; 109 | } 110 | 111 | _request.prototype.withErrorStartMsg = function (msg) { 112 | this.startMsg = msg; 113 | return this; 114 | }; 115 | 116 | _request.prototype.withSuccessCode = function (code) { 117 | this.code = code; 118 | return this; 119 | }; 120 | 121 | _request.prototype.withURLSearchParams = function (params) { 122 | let urlSearchParams = new URLSearchParams(); 123 | for (let p in params) { 124 | if (params.hasOwnProperty(p)) { 125 | let v = params[p]; 126 | urlSearchParams.append(p, v); 127 | } 128 | } 129 | this.urlSearchParams = urlSearchParams; 130 | return this; 131 | }; 132 | 133 | _request.prototype.withFormData = function (params, enableUploadProgress = true) { 134 | let formData = new FormData(); 135 | for (let p in params) { 136 | if (params.hasOwnProperty(p)) { 137 | let v = params[p]; 138 | formData.append(p, v); 139 | } 140 | } 141 | this.formData = formData; 142 | this.enableUploadProgress = enableUploadProgress; 143 | return this; 144 | }; 145 | 146 | _request.prototype.doAfter = function (fn) { 147 | this.doAfterFun = fn; 148 | return this; 149 | }; 150 | 151 | _request.prototype.do = function (fn) { 152 | let that = this; 153 | let promise = null; 154 | let uploadToast = null; 155 | switch (this.method) { 156 | case Method.GET: 157 | promise = instance.get(this.url); 158 | break; 159 | case Method.DELETE: 160 | promise = instance.delete(this.url); 161 | break; 162 | case Method.POST: 163 | if (this.urlSearchParams !== undefined) { 164 | promise = instance.post(this.url, this.urlSearchParams); 165 | } else if (this.formData !== undefined) { 166 | if (this.enableUploadProgress === false) { 167 | promise = instance.post(this.url, this.formData, {headers: {'content-type': 'multipart/form-data'}}); 168 | } else { 169 | uploadToast = Vue.toasted.info('正在上传:0%', { 170 | position: "top-right", 171 | icon: 'hourglass_empty' 172 | }); 173 | let config = { 174 | headers: {'content-type': 'multipart/form-data'}, 175 | timeout: 1000 * 60 * 5, 176 | onUploadProgress: progressEvent => { 177 | let progress = (progressEvent.loaded / progressEvent.total * 100 | 0) + '%'; 178 | uploadToast.text("正在上传:" + progress); 179 | if (progress === '100%') { 180 | uploadToast.goAway(100); 181 | } 182 | } 183 | }; 184 | promise = instance.post(this.url, this.formData, config); 185 | } 186 | } else { 187 | promise = instance.post(this.url); 188 | } 189 | break; 190 | case Method.PATCH: 191 | if (this.urlSearchParams !== undefined) { 192 | promise = instance.patch(this.url, this.urlSearchParams); 193 | } else if (this.formData !== undefined) { 194 | promise = instance.patch(this.url, this.formData, {headers: {'content-type': 'multipart/form-data'}}); 195 | } else { 196 | promise = instance.patch(this.url); 197 | } 198 | break; 199 | default: 200 | return Promise.reject('none switch found of ' + this.method); 201 | } 202 | promise 203 | .then(response => { 204 | if (response.status === that.code) { 205 | fn(response) 206 | } else { 207 | showErrorToast(that.startMsg + response.data.msg); 208 | } 209 | }) 210 | .catch(error => { 211 | if (uploadToast !== null) { 212 | uploadToast.goAway(100); 213 | } 214 | if (error.response !== undefined) { 215 | showErrorToast(that.startMsg + error.response.data.msg); 216 | } 217 | }) 218 | .then(() => { 219 | if (that.doAfterFun !== undefined) { 220 | that.doAfterFun(); 221 | } 222 | }); 223 | return this; 224 | }; 225 | 226 | export default instance; 227 | 228 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 90 | 91 | 152 | 153 | 170 | 187 | -------------------------------------------------------------------------------- /src/components/student/UnDone.vue: -------------------------------------------------------------------------------- 1 | 57 | 58 | 197 | 198 | 204 | -------------------------------------------------------------------------------- /src/components/student/Done.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 247 | 248 | 254 | -------------------------------------------------------------------------------- /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 2018 itning 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. 202 | -------------------------------------------------------------------------------- /src/components/teacher/Work.vue: -------------------------------------------------------------------------------- 1 | 96 | 97 | 309 | 310 | 316 | -------------------------------------------------------------------------------- /src/components/Group.vue: -------------------------------------------------------------------------------- 1 | 108 | 109 | 325 | 326 | 339 | -------------------------------------------------------------------------------- /src/components/teacher/WorkDetails.vue: -------------------------------------------------------------------------------- 1 | 87 | 88 | 313 | 314 | 320 | --------------------------------------------------------------------------------