├── src ├── store │ ├── index.js │ ├── common │ │ └── save.js │ └── user │ │ └── index.js ├── utils │ ├── key.js │ ├── time.js │ ├── color.js │ ├── auth.js │ ├── oauth-provider.js │ ├── role.js │ ├── device-os.js │ ├── message-type.js │ ├── ua.js │ └── backend-plugin.js ├── plugins │ ├── mitt.js │ ├── index.js │ ├── vuetify.js │ └── p5-banner.js ├── api │ ├── teacher │ │ └── index.js │ ├── attachment │ │ └── index.js │ ├── message │ │ └── index.js │ ├── access │ │ └── index.js │ ├── backend-plugin.js │ ├── oauth │ │ └── index.js │ ├── user │ │ └── index.js │ ├── index.js │ ├── course │ │ ├── creation.js │ │ └── index.js │ ├── student │ │ └── index.js │ └── correct │ │ └── index.js ├── views │ ├── common │ │ ├── personal │ │ │ ├── AboutView.vue │ │ │ ├── StatisticView.vue │ │ │ ├── SecurityView.vue │ │ │ └── InfoView.vue │ │ ├── course │ │ │ ├── CourseView.vue │ │ │ ├── CourseDetailView.vue │ │ │ ├── CourseSectionView.vue │ │ │ └── CourseInfoView.vue │ │ ├── HomeView.vue │ │ └── PersonalCenterView.vue │ ├── plugin │ │ ├── PluginMainView.vue │ │ ├── VuePluginView.vue │ │ ├── FrontendPluginView.vue │ │ └── BackendPluginView.vue │ ├── MainView.vue │ ├── oauth │ │ ├── bind │ │ │ └── GitHubOAuthBindView.vue │ │ └── GitHubOAuthCallbackView.vue │ ├── teacher │ │ ├── TaskCorrectView.vue │ │ ├── correct │ │ │ └── TaskBatchCorrectView.vue │ │ ├── TeacherCourseView.vue │ │ ├── course │ │ │ └── CourseCreateView.vue │ │ └── StudentPerformanceView.vue │ └── LoginView.vue ├── components │ ├── plugin │ │ ├── backend │ │ │ ├── body │ │ │ │ ├── TheJsonContent.vue │ │ │ │ └── TheFormDataContent.vue │ │ │ ├── response │ │ │ │ ├── TheResponseJsonContent.vue │ │ │ │ └── TheResponseHeaderContent.vue │ │ │ ├── request │ │ │ │ ├── TheRequestHeaderContent.vue │ │ │ │ ├── TheRequestParamContent.vue │ │ │ │ └── TheRequestBodyContent.vue │ │ │ ├── TheRequestResult.vue │ │ │ └── TheRequestContent.vue │ │ ├── CustomPluginCard.vue │ │ └── CustomCodeEditor.vue │ ├── TheP5Banner.vue │ ├── CustomFloatBackButton.vue │ ├── personal │ │ ├── statistic │ │ │ └── StatisticEntryCard.vue │ │ ├── about │ │ │ └── TheInstallAppCard.vue │ │ ├── info │ │ │ ├── TheUserBasicInfoCard.vue │ │ │ ├── TheEmailModifyCard.vue │ │ │ ├── TheAccountBindCard.vue │ │ │ └── TheAvatarModifyCard.vue │ │ └── security │ │ │ ├── TheLogoutCard.vue │ │ │ ├── TheDeviceListCard.vue │ │ │ └── ThePasswordModifyCard.vue │ ├── home │ │ ├── ThePluginListCard.vue │ │ └── TheMessageListCard.vue │ ├── CustomAttachmentCard.vue │ ├── CustomDeviceCard.vue │ ├── CustomMessageCard.vue │ ├── CustomHorizontalCourseCard.vue │ ├── course │ │ └── CustomCourseStructureList.vue │ └── TheHeader.vue ├── main.js ├── assets │ ├── img │ │ ├── frontend-plugin-cover.svg │ │ ├── vue-plugin-cover.svg │ │ └── backend-plugin-cover.svg │ └── scss │ │ └── global.scss ├── App.vue └── router │ └── index.js ├── .imgbotconfig ├── .env.production ├── .env.development ├── .browserslistrc ├── public ├── default.jpg └── logo.svg ├── postcss.config.js ├── vercel.json ├── .editorconfig ├── jsconfig.json ├── .gitignore ├── index.html ├── eslint.config.js ├── .github └── dependabot.yml ├── README.md ├── tailwind.config.js ├── LICENSE ├── package.json ├── vite.config.mjs └── components.d.ts /src/store/index.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.imgbotconfig: -------------------------------------------------------------------------------- 1 | { 2 | "schedule": "daily" 3 | } -------------------------------------------------------------------------------- /.env.production: -------------------------------------------------------------------------------- 1 | VITE_BACKEND_BASE_URL='https://api.goopper.top' -------------------------------------------------------------------------------- /.env.development: -------------------------------------------------------------------------------- 1 | VITE_BACKEND_BASE_URL='http://100.116.150.108:8889/' -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | not ie 11 5 | -------------------------------------------------------------------------------- /public/default.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/hedwa/platform-frontend/HEAD/public/default.jpg -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | export default { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | }; 7 | -------------------------------------------------------------------------------- /src/utils/key.js: -------------------------------------------------------------------------------- 1 | export const LOCAL_STORAGE_TOKEN_KEY = 'G-Token'; 2 | 3 | export const AUTHORIZATION_HEADER_KEY = 'G-Authorization'; -------------------------------------------------------------------------------- /vercel.json: -------------------------------------------------------------------------------- 1 | { 2 | "rewrites": [ 3 | { 4 | "source": "/(.*)", 5 | "destination": "/" 6 | } 7 | ] 8 | } -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.{js,jsx,ts,tsx,vue}] 2 | indent_style = space 3 | indent_size = 2 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | -------------------------------------------------------------------------------- /src/plugins/mitt.js: -------------------------------------------------------------------------------- 1 | import mitt from 'mitt'; 2 | 3 | // mitt is a tiny 200 bytes functional event emitter / pubsub. 4 | // It is fast, and has no dependencies. 5 | export default mitt(); -------------------------------------------------------------------------------- /src/api/teacher/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function getTeacherList() { 4 | return request({ 5 | url: '/teacher', 6 | method: 'get' 7 | }); 8 | } -------------------------------------------------------------------------------- /src/views/common/personal/AboutView.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | -------------------------------------------------------------------------------- /src/utils/time.js: -------------------------------------------------------------------------------- 1 | export function timestampToDateString(timestamp) { 2 | var date = new Date(timestamp); 3 | return date.toLocaleDateString('zh-CN', { year: 'numeric', month: 'long', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'}); 4 | } -------------------------------------------------------------------------------- /src/views/common/course/CourseView.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /src/views/common/personal/StatisticView.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | 13 | -------------------------------------------------------------------------------- /src/views/plugin/PluginMainView.vue: -------------------------------------------------------------------------------- 1 | 6 | 11 | -------------------------------------------------------------------------------- /src/components/plugin/backend/body/TheJsonContent.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | // Plugins 2 | import { registerPlugins } from '@/plugins'; 3 | 4 | // Components 5 | import App from './App.vue'; 6 | 7 | // Composable 8 | import { createApp } from 'vue'; 9 | 10 | // Themes 11 | import './assets/scss/global.scss'; 12 | 13 | const app = createApp(App); 14 | 15 | registerPlugins(app); 16 | 17 | app.mount('#app'); 18 | -------------------------------------------------------------------------------- /src/plugins/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugins/index.js 3 | * 4 | * Automatically included in `./src/main.js` 5 | */ 6 | 7 | // Plugins 8 | import vuetify from './vuetify'; 9 | import { router } from '@/router'; 10 | import { createPinia } from 'pinia'; 11 | 12 | 13 | export function registerPlugins (app) { 14 | app.use(createPinia()); 15 | app.use(vuetify); 16 | app.use(router); 17 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowJs": true, 4 | "target": "es5", 5 | "module": "esnext", 6 | "baseUrl": "./", 7 | "moduleResolution": "node", 8 | "paths": { 9 | "@/*": [ 10 | "src/*" 11 | ] 12 | }, 13 | "lib": [ 14 | "esnext", 15 | "dom", 16 | "dom.iterable", 17 | "scripthost" 18 | ] 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/views/plugin/VuePluginView.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /src/views/common/personal/SecurityView.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 14 | 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | 24 | # build output 25 | dev-dist/ 26 | 27 | visualizer.html 28 | 29 | .VSCodeCounter -------------------------------------------------------------------------------- /src/assets/img/frontend-plugin-cover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Goopper 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/views/MainView.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 18 | 19 | 22 | -------------------------------------------------------------------------------- /src/api/attachment/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function uploadAttachment(file) { 4 | var formData = new FormData(); 5 | formData.append('upload', file); 6 | return request({ 7 | url: '/attachment/upload', 8 | data: formData, 9 | method: 'post' 10 | }); 11 | } 12 | 13 | export function deleteAttachment(filename) { 14 | return request({ 15 | url: '/attachment/delete?filename=' + filename, 16 | method: 'delete' 17 | }); 18 | } -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | import pluginVue from 'eslint-plugin-vue'; 2 | 3 | export default [ 4 | // add more generic rulesets here, such as: 5 | // js.configs.recommended, 6 | ...pluginVue.configs['flat/recommended'], 7 | // ...pluginVue.configs['flat/vue2-recommended'], // Use this if you are using Vue.js 2.x. 8 | { 9 | rules: { 10 | // override/add rules settings here, such as: 11 | // 'vue/no-unused-vars': 'error' 12 | 'semi': 'warn', 13 | 'quotes': ['warn', 'single'] 14 | } 15 | }, 16 | { 17 | ignores: ['dev-dist/*'] 18 | } 19 | ]; -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "npm" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /src/components/TheP5Banner.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 28 | 29 | -------------------------------------------------------------------------------- /src/components/plugin/backend/response/TheResponseJsonContent.vue: -------------------------------------------------------------------------------- 1 | 10 | 11 | -------------------------------------------------------------------------------- /src/store/common/save.js: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia'; 2 | 3 | // store save state 4 | export const useSaveStore = defineStore('save', { 5 | state: () => ({ 6 | saved: true, 7 | }), 8 | actions: { 9 | setAsSaved() { 10 | this.saved = true; 11 | }, 12 | setAsUnsaved() { 13 | this.saved = false; 14 | }, 15 | setSaveState(state) { 16 | this.saved = state; 17 | } 18 | }, 19 | getters: { 20 | isSaved(state) { 21 | return state.saved; 22 | }, 23 | }, 24 | }); 25 | -------------------------------------------------------------------------------- /src/utils/color.js: -------------------------------------------------------------------------------- 1 | const color =[ 2 | '#4CAF50', 3 | '#FFA07A', 4 | '#FB8C00', 5 | '#7FFF00', 6 | '#00FFFF', 7 | '#FF4500', 8 | ]; 9 | export function getHashCode(str) { 10 | let hash = 0; 11 | if (str.length == 0) { 12 | return hash; 13 | } 14 | for (let i = 0; i < str.length; i++) { 15 | let char = str.charCodeAt(i); 16 | hash = (hash << 5) - hash + char; 17 | hash = hash & hash; // Convert to 32bit integer 18 | } 19 | return hash; 20 | } 21 | export function getColor(str) { 22 | let hash = getHashCode(str) % 6; 23 | return color[hash]; 24 | } 25 | export default {getColor}; -------------------------------------------------------------------------------- /src/assets/img/vue-plugin-cover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /src/api/message/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function getMessageList(page = 1, title = null, typeId = null) { 4 | let url = `/message?page=${page}`; 5 | if (title) { 6 | url += `&title=${title}`; 7 | } 8 | if (typeId) { 9 | url += `&typeId=${typeId}`; 10 | } 11 | return request({ 12 | url: url, 13 | method: 'get' 14 | }); 15 | } 16 | 17 | export function receiveOneMessage(id) { 18 | return request({ 19 | url: `/message/receive/${id}`, 20 | method: 'get' 21 | }); 22 | } 23 | 24 | export function getMessageTypes() { 25 | return request({ 26 | url: '/message/type', 27 | method: 'get' 28 | }); 29 | } -------------------------------------------------------------------------------- /src/utils/auth.js: -------------------------------------------------------------------------------- 1 | import { LOCAL_STORAGE_TOKEN_KEY } from './key'; 2 | 3 | // login state: jwt token 4 | 5 | export function isLoggedIn() { 6 | // return true if the user is logged in 7 | return !!localStorage.getItem(LOCAL_STORAGE_TOKEN_KEY); 8 | } 9 | 10 | export function setLoginState(token) { 11 | // save the token to localStorage 12 | localStorage.setItem(LOCAL_STORAGE_TOKEN_KEY, token); 13 | } 14 | 15 | export function getLoginState() { 16 | // get the token from localStorage 17 | return localStorage.getItem(LOCAL_STORAGE_TOKEN_KEY); 18 | } 19 | 20 | export function clearLoginState() { 21 | // clear the token from localStorage 22 | localStorage.removeItem(LOCAL_STORAGE_TOKEN_KEY); 23 | } -------------------------------------------------------------------------------- /src/utils/oauth-provider.js: -------------------------------------------------------------------------------- 1 | export default class OAuthProvider { 2 | constructor(id, name, icon) { 3 | this.id = id; 4 | this.name = name; 5 | this.icon = icon; 6 | } 7 | 8 | static GITHUB = new OAuthProvider(1, 'GitHub', 'mdi-github'); 9 | 10 | static getOAuthProviderById(id) { 11 | const names = Object.getOwnPropertyNames(this); 12 | for (let i = 0; i < names.length; i++) { 13 | const name = names[i]; 14 | const desc = Object.getOwnPropertyDescriptor(this, name); 15 | if (desc.value && desc.value.id === id) { 16 | return desc.value; 17 | } 18 | } 19 | return undefined; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/api/access/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function login(number, password) { 4 | const payload = new FormData(); 5 | payload.append('number', number); 6 | payload.append('password', password); 7 | return request({ 8 | method: 'post', 9 | url: '/login', 10 | data: payload 11 | }); 12 | } 13 | 14 | export function logout() { 15 | return request({ 16 | method: 'get', 17 | url: '/logout' 18 | }); 19 | } 20 | 21 | export function logoutDevice(deviceId) { 22 | const payload = new FormData(); 23 | payload.append('tokenId', deviceId); 24 | 25 | return request({ 26 | method: 'delete', 27 | url: '/logout', 28 | data: payload 29 | }); 30 | } -------------------------------------------------------------------------------- /src/components/CustomFloatBackButton.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 36 | 37 | -------------------------------------------------------------------------------- /src/views/common/HomeView.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 24 | 25 | -------------------------------------------------------------------------------- /src/plugins/vuetify.js: -------------------------------------------------------------------------------- 1 | /** 2 | * plugins/vuetify.js 3 | * 4 | * Framework documentation: https://vuetifyjs.com` 5 | */ 6 | 7 | // Styles 8 | import '@mdi/font/css/materialdesignicons.css'; 9 | import 'vuetify/styles'; 10 | 11 | // Composable 12 | import { createVuetify } from 'vuetify'; 13 | 14 | const customLightTheme = { 15 | dark: false, 16 | colors: { 17 | surface: '#383838', 18 | 'on-surface': '#ffffff', 19 | primary: '#383838', 20 | secondary: '#ffffff', 21 | accent: '#8c9eff', 22 | error: '#ff5252', 23 | }, 24 | }; 25 | 26 | // https://vuetifyjs.com/en/introduction/why-vuetify/#feature-guides 27 | export default createVuetify({ 28 | theme: { 29 | defaultTheme: 'customLightTheme', 30 | themes: { 31 | customLightTheme 32 | } 33 | }, 34 | }); 35 | -------------------------------------------------------------------------------- /src/views/common/personal/InfoView.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 37 | 38 | -------------------------------------------------------------------------------- /src/assets/img/backend-plugin-cover.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/components/plugin/backend/response/TheResponseHeaderContent.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | 32 | 33 | -------------------------------------------------------------------------------- /src/utils/role.js: -------------------------------------------------------------------------------- 1 | export default class Role { 2 | constructor(id, name, home) { 3 | this.id = id; 4 | this.name = name; 5 | this.home = home; 6 | } 7 | 8 | static ROLE_ADMIN = new Role(1, 'admin', '/home/teacher'); 9 | static ROLE_TEACHER = new Role(2, 'teacher', '/home/teacher'); 10 | static ROLE_STUDENT = new Role(3, 'student', '/home/student'); 11 | 12 | static getRoleById(roleId) { 13 | const roleNames = Object.getOwnPropertyNames(this); 14 | for (let i = 0; i < roleNames.length; i++) { 15 | const roleName = roleNames[i]; 16 | const roleDescriptor = Object.getOwnPropertyDescriptor(this, roleName); 17 | if (roleDescriptor.value && roleDescriptor.value.id === roleId) { 18 | return roleDescriptor.value; 19 | } 20 | } 21 | return undefined; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/components/personal/statistic/StatisticEntryCard.vue: -------------------------------------------------------------------------------- 1 | 22 | 23 | 33 | 34 | -------------------------------------------------------------------------------- /src/utils/device-os.js: -------------------------------------------------------------------------------- 1 | export default class DeviceOS { 2 | constructor(id, name, icon) { 3 | this.id = id; 4 | this.name = name; 5 | this.icon = icon; 6 | } 7 | 8 | static WINDOWS = new DeviceOS(1, 'Windows', 'mdi-microsoft-windows'); 9 | static MACOS = new DeviceOS(2, 'macOS', 'mdi-apple-finder'); 10 | static LINUX = new DeviceOS(3, 'Linux', 'mdi-linux'); 11 | static ANDROID = new DeviceOS(4, 'Android', 'mdi-android'); 12 | static IOS = new DeviceOS(5, 'iOS', 'mdi-apple-ios'); 13 | static UNKNOWN = new DeviceOS(6, 'Unknown', 'mdi-help'); 14 | 15 | static getDeviceOSByName(target) { 16 | const names = Object.getOwnPropertyNames(this); 17 | for (let i = 0; i < names.length; i++) { 18 | const name = names[i]; 19 | const desc = Object.getOwnPropertyDescriptor(this, name); 20 | if (desc.value && target.includes(desc.value.name)) { 21 | return desc.value; 22 | } 23 | } 24 | return this.UNKNOWN; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | platform-frontend 3 |
4 | 5 |
6 | GitHub License 7 | Website 8 | GitHub code size in bytes 9 | GitHub contributors 10 |
11 | 12 | # Goopper 前端 13 | 14 | ## 简介 15 | 16 | 这是 Goopper 的前端代码仓库。 17 | 18 | ## 安装指南 19 | 20 | ```bash 21 | # 克隆仓库 22 | git clone https://github.com/Goopper/platform-frontend 23 | # 进入项目目录 24 | cd platform-frontend 25 | # 安装依赖 26 | pnpm install 27 | ``` 28 | 29 | ## 快速开始 30 | 31 | ```bash 32 | # 运行项目 33 | npm start 34 | ``` 35 | 36 | ## 许可证 37 | 38 | 本项目采用 [MIT 许可证](LICENSE) 39 | -------------------------------------------------------------------------------- /src/utils/message-type.js: -------------------------------------------------------------------------------- 1 | export default class MessageType { 2 | constructor(id, name, color) { 3 | this.id = id; 4 | this.name = name; 5 | this.color = color; 6 | } 7 | 8 | static CORRECT = new MessageType(1, '作业批改', '#c468c9'); 9 | static CORRECT_RESULT = new MessageType(2, '批改结果', '#06ae5c'); 10 | static NOTIFY = new MessageType(3, '通知', '#2196f3'); 11 | static SYSTEM = new MessageType(4, '系统消息', '#e05d8d'); 12 | 13 | static ALL = [MessageType.CORRECT, MessageType.CORRECT_RESULT, MessageType.NOTIFY, MessageType.SYSTEM]; 14 | 15 | static getTypeById(typeId) { 16 | const typeNames = Object.getOwnPropertyNames(this); 17 | for (let i = 0; i < typeNames.length; i++) { 18 | const typeName = typeNames[i]; 19 | const typeDescriptor = Object.getOwnPropertyDescriptor(this, typeName); 20 | if (typeDescriptor.value && typeDescriptor.value.id === typeId) { 21 | return typeDescriptor.value; 22 | } 23 | } 24 | return undefined; 25 | } 26 | } -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | export default { 3 | content: [ 4 | './index.html', 5 | './src/**/*.{vue,js,ts,jsx,tsx}', 6 | ], 7 | theme: { 8 | extend: { 9 | gridTemplateColumns: { 10 | '52': 'repeat(52, minmax(0, 1fr))' 11 | } 12 | }, 13 | screens: { 14 | 'sm': { 15 | 'max': '768px' 16 | }, 17 | 'smd': { 18 | 'max': '1024px' 19 | }, 20 | 'md': { 21 | 'max': '1280px' 22 | }, 23 | 'lg': { 24 | 'min': '1281px', 25 | 'max': '1440px' 26 | }, 27 | '2lg': { 28 | 'max': '1680px' 29 | }, 30 | 'bsm': { 31 | 'min': '769px' 32 | }, 33 | 'bmd': { 34 | 'min': '1281px' 35 | }, 36 | 'blg': { 37 | 'min': '1441px' 38 | } 39 | } 40 | }, 41 | plugins: [], 42 | }; -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Goopper 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /src/utils/ua.js: -------------------------------------------------------------------------------- 1 | export default function parseUserAgent(ua) { 2 | let userAgent = ua.toLowerCase(); 3 | 4 | let platform = /windows nt 10.0/.test(userAgent) ? 'Windows 10 或者更高' : 5 | /windows nt 6.2/.test(userAgent) ? 'Windows 8' : 6 | /windows nt 6.1/.test(userAgent) ? 'Windows 7' : 7 | /mac os x 10[\._\d]+/.test(userAgent) ? 'macOS' : 8 | /android/.test(userAgent) ? 'Android' : 9 | /iphone|ipad|ipod/.test(userAgent) ? 'iOS' : 10 | /linux/.test(userAgent) ? 'Linux' : 'Unknown'; 11 | 12 | let browser = /msie|trident/.test(userAgent) ? 'Internet Explorer' : 13 | /edg/.test(userAgent) ? 'Edge' : 14 | /chrome/.test(userAgent) ? 'Chrome' : 15 | /safari/.test(userAgent) ? 'Safari' : 16 | /firefox/.test(userAgent) ? 'Firefox' : 17 | /opera/.test(userAgent) ? 'Opera' : 'Unknown'; 18 | 19 | let match = /(edg|chrome|safari|firefox|opera|msie|trident(?=\/))\/?\s*(\d+)/i.exec(userAgent); 20 | let version = match ? match[2] : 'Unknown'; 21 | 22 | return { platform, browser, version }; 23 | } -------------------------------------------------------------------------------- /src/components/home/ThePluginListCard.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 43 | 44 | -------------------------------------------------------------------------------- /src/components/plugin/CustomPluginCard.vue: -------------------------------------------------------------------------------- 1 | 30 | 31 | 48 | 49 | -------------------------------------------------------------------------------- /src/utils/backend-plugin.js: -------------------------------------------------------------------------------- 1 | const requestTemplate = { 2 | name: '未命名请求', 3 | method: 'GET', 4 | url: 'http://127.0.0.1:8888/health', 5 | params: [ 6 | { 7 | key: '', 8 | value: '' 9 | } 10 | ], 11 | body: { 12 | type: 'none', 13 | json: '{}', 14 | formData: [ 15 | { 16 | type: 'text', 17 | key: '', 18 | value: '', 19 | files: [] 20 | } 21 | ] 22 | }, 23 | headers: [ 24 | { 25 | key: '', 26 | value: '' 27 | } 28 | ], 29 | response: undefined 30 | }; 31 | 32 | const paramTemplate = { 33 | key: '', 34 | value: '' 35 | }; 36 | 37 | const formDataTemplate = { 38 | type: 'text', 39 | key: '', 40 | value: '' 41 | }; 42 | 43 | const headerTemplate = { 44 | key: '', 45 | value: '' 46 | }; 47 | 48 | export function getACopy(template) { 49 | let target = JSON.parse(JSON.stringify(template)); 50 | return target; 51 | } 52 | 53 | export function newRequestTemplate() { 54 | return getACopy(requestTemplate); 55 | } 56 | 57 | export function newParamTemplate() { 58 | return getACopy(paramTemplate); 59 | } 60 | 61 | export function newFormDataTemplate() { 62 | return getACopy(formDataTemplate); 63 | } 64 | 65 | export function newHeaderTemplate() { 66 | return getACopy(headerTemplate); 67 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "goopper", 3 | "version": "0.0.0", 4 | "type": "module", 5 | "scripts": { 6 | "dev": "vite", 7 | "build": "vite build", 8 | "preview": "vite preview" 9 | }, 10 | "dependencies": { 11 | "@codemirror/lang-css": "^6.2.1", 12 | "@codemirror/lang-html": "^6.4.9", 13 | "@codemirror/lang-javascript": "^6.2.2", 14 | "@codemirror/lang-json": "^6.0.1", 15 | "@codemirror/view": "^6.26.3", 16 | "@mdi/font": "^7.4.47", 17 | "@vue/repl": "^4.1.2", 18 | "axios": "^1.6.8", 19 | "codemirror": "^6.0.1", 20 | "mitt": "^3.0.1", 21 | "nprogress": "^0.2.0", 22 | "p5": "^1.9.3", 23 | "pinia": "^2.1.7", 24 | "unplugin-fonts": "^1.1.1", 25 | "vue": "^3.4.23", 26 | "vue-codemirror": "^6.1.1", 27 | "vue-router": "^4.3.1", 28 | "vuetify": "^3.5.16" 29 | }, 30 | "devDependencies": { 31 | "@vitejs/plugin-vue": "^5.0.4", 32 | "autoprefixer": "^10.4.19", 33 | "eslint": "^9.0.0", 34 | "eslint-plugin-vue": "^9.25.0", 35 | "postcss": "^8.4.38", 36 | "rollup-plugin-visualizer": "^5.12.0", 37 | "sass": "^1.75.0", 38 | "tailwindcss": "^3.4.3", 39 | "unplugin-vue-components": "^0.26.0", 40 | "vite": "^5.2.9", 41 | "vite-plugin-node-polyfills": "^0.22.0", 42 | "vite-plugin-pwa": "^0.19.8", 43 | "vite-plugin-vuetify": "^2.0.3" 44 | } 45 | } -------------------------------------------------------------------------------- /src/components/plugin/CustomCodeEditor.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 54 | 55 | -------------------------------------------------------------------------------- /src/api/backend-plugin.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | 3 | function buildRequestBody(body) { 4 | if (body.type === 'none') { 5 | return null; 6 | } 7 | if (body.type === 'json') { 8 | return body.json; 9 | } 10 | if (body.type === 'form-data') { 11 | const formData = new FormData(); 12 | body.formData.forEach(item => { 13 | if (item.type === 'text') { 14 | formData.append(item.key, item.value); 15 | } else { 16 | item.files.forEach(file => { 17 | console.log(file); 18 | formData.append(item.key, file); 19 | }); 20 | } 21 | }); 22 | return formData; 23 | } 24 | } 25 | 26 | export function backendPluginRequest(request) { 27 | console.log(request); 28 | 29 | const headers = request.headers.reduce((acc, cur) => { 30 | acc[cur.key] = cur.value; 31 | return acc; 32 | }, {}); 33 | const params = request.params.reduce((acc, cur) => { 34 | acc[cur.key] = cur.value; 35 | return acc; 36 | }, {}); 37 | const data = buildRequestBody(request.body); 38 | console.log(data); 39 | const config = { 40 | url: request.url, 41 | method: request.method, 42 | headers: headers, 43 | timeout: 30000, 44 | params: params, 45 | data: data 46 | }; 47 | return axios(config); 48 | } -------------------------------------------------------------------------------- /src/api/oauth/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function getGitHubOAuthUrl() { 4 | var currentOrigin = window.location.origin; 5 | return request({ 6 | method: 'get', 7 | url: `/oauth/github/url?redirectUrl=${currentOrigin}/oauth/callback/github`, 8 | }); 9 | } 10 | 11 | export function getGitHubOAuthAccount(code) { 12 | return request({ 13 | method: 'get', 14 | url: `/oauth/github/auth?code=${code}`, 15 | }); 16 | } 17 | 18 | export function oAuthLogin(provider, id) { 19 | var payload = new FormData(); 20 | payload.append('oauthId', id); 21 | 22 | return request({ 23 | method: 'post', 24 | url: `/oauth/login/${provider}`, 25 | data: payload, 26 | }); 27 | } 28 | 29 | export function getOAuthURL(providerName) { 30 | var currentOrigin = window.location.origin; 31 | return request({ 32 | url: `/oauth/${providerName}/url?redirectUrl=${currentOrigin}/oauth/bind/github`, 33 | method: 'get' 34 | }); 35 | }; 36 | 37 | export function bindOAuth(providerName, oauthId, oauthName, isRebind = false) { 38 | var formData = new FormData(); 39 | formData.append('oauthId', oauthId); 40 | formData.append('oauthName', oauthName); 41 | formData.append('isRebind', isRebind); 42 | 43 | return request({ 44 | url: `/oauth/bind/${providerName}`, 45 | method: 'post', 46 | data: formData 47 | }); 48 | } 49 | 50 | export function unbindOAuth(providerName) { 51 | return request({ 52 | url: `/oauth/unbind/${providerName}`, 53 | method: 'post' 54 | }); 55 | } -------------------------------------------------------------------------------- /src/components/personal/about/TheInstallAppCard.vue: -------------------------------------------------------------------------------- 1 | 41 | 42 | 67 | 68 | -------------------------------------------------------------------------------- /src/components/personal/info/TheUserBasicInfoCard.vue: -------------------------------------------------------------------------------- 1 | 46 | 47 | 63 | 64 | -------------------------------------------------------------------------------- /src/components/CustomAttachmentCard.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 65 | 66 | -------------------------------------------------------------------------------- /src/components/CustomDeviceCard.vue: -------------------------------------------------------------------------------- 1 | 32 | 33 | 66 | 67 | -------------------------------------------------------------------------------- /src/api/user/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function getMyBasicInfo() { 4 | return request({ 5 | url: '/user', 6 | method: 'get' 7 | }); 8 | } 9 | 10 | export function getAllUserBindsInfo() { 11 | return request({ 12 | url: '/user/binds', 13 | method: 'get' 14 | }); 15 | } 16 | 17 | export function uploadAvatarFile(file) { 18 | var formData = new FormData(); 19 | formData.append('avatar', file); 20 | return request({ 21 | url: '/user/avatar', 22 | data: formData, 23 | method: 'post' 24 | }); 25 | } 26 | 27 | export function updateAvatar(url) { 28 | var formData = new FormData(); 29 | formData.append('url', url); 30 | return request({ 31 | url: '/user/avatar', 32 | data: formData, 33 | method: 'put' 34 | }); 35 | } 36 | 37 | export function updateEmail(old, email) { 38 | var formData = new FormData(); 39 | formData.append('old', old); 40 | formData.append('new', email); 41 | 42 | return request({ 43 | url: '/user/email', 44 | data: formData, 45 | method: 'put' 46 | }); 47 | } 48 | 49 | export function getAllDevices() { 50 | return request({ 51 | url: '/user/device', 52 | method: 'get' 53 | }); 54 | } 55 | 56 | export function updateMyPassword(oldPassword, newPassword) { 57 | var formData = new FormData(); 58 | formData.append('old', oldPassword); 59 | formData.append('new', newPassword); 60 | 61 | return request({ 62 | url: '/user/password', 63 | data: formData, 64 | method: 'put' 65 | }); 66 | } 67 | //老师获取学生详细信息 68 | export function getStudentInfo(studentId) { 69 | return request({ 70 | url: `/user/${studentId}`, 71 | method: 'get' 72 | }); 73 | } 74 | -------------------------------------------------------------------------------- /src/assets/scss/global.scss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | :root { 6 | --custom-primary: #383838; 7 | --custom-secondary: #ffffff; 8 | --custom-background: #fafafa; 9 | } 10 | 11 | html, 12 | body { 13 | margin: 0; 14 | padding: 0; 15 | overflow-x: hidden; 16 | overflow-y: auto; 17 | } 18 | 19 | #nprogress .bar { 20 | background: var(--custom-primary) !important; 21 | } 22 | 23 | .v-application { 24 | background-color: var(--custom-background); 25 | } 26 | 27 | // toast start 28 | .toast-enter-active, 29 | .toast-leave-active { 30 | transition: opacity 0.5s ease, transform 0.5s ease; 31 | } 32 | 33 | .toast-enter-from { 34 | opacity: 0; 35 | transform: translateX(200%); 36 | } 37 | 38 | .toast-leave-to { 39 | opacity: 0; 40 | transform: translateX(100%); 41 | } 42 | 43 | .toast { 44 | position: absolute; 45 | right: 1rem; 46 | margin-left: 1rem; 47 | top: 2rem; 48 | z-index: 9999; 49 | } 50 | 51 | // toast end 52 | 53 | 54 | .bg-primary { 55 | background-color: var(--custom-primary); 56 | } 57 | 58 | .bg-primary-important { 59 | background-color: var(--custom-primary) !important; 60 | } 61 | 62 | .bg-secondary { 63 | background-color: var(--custom-secondary); 64 | } 65 | 66 | .bg-secondary-message { 67 | background-color: var(--custom-secondary); 68 | } 69 | 70 | .bg-secondary-actions { 71 | background-color: var(--custom-secondary); 72 | } 73 | 74 | .bg-background { 75 | background-color: var(--custom-background); 76 | } 77 | 78 | .bg-background-important { 79 | background-color: var(--custom-background) !important; 80 | } 81 | 82 | .bg-default { 83 | background-color: #bdbdbd; 84 | } 85 | 86 | .hover\:bg-primary:hover { 87 | background-color: var(--custom-primary); 88 | } 89 | 90 | .v-tab__slider { 91 | background-color: var(--custom-primary) !important; 92 | } -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 34 | 35 | 69 | 70 | -------------------------------------------------------------------------------- /src/api/index.js: -------------------------------------------------------------------------------- 1 | import axios from 'axios'; 2 | import mitt from '@/plugins/mitt'; 3 | import { getLoginState } from '@/utils/auth'; 4 | 5 | export function request(config) { 6 | const baseURL = import.meta.env.VITE_BACKEND_BASE_URL; 7 | const instance = axios.create({ 8 | baseURL: baseURL || 'http://100.116.150.108:8888', 9 | timeout: 30000, 10 | headers: { 11 | 'G-Authorization': getLoginState(), 12 | } 13 | }); 14 | // encode url 15 | instance.interceptors.request.use(config => { 16 | config.url = encodeURI(config.url); 17 | return config; 18 | }); 19 | instance.interceptors.response.use(res => { 20 | return res.data; 21 | }, err => { 22 | if (err.response) { 23 | const data = err.response.data; 24 | const status = err.response.status; 25 | // error code 400: invalid request 26 | if (data.code === 400) { 27 | if (data.message === 'Access Denied') { 28 | mitt.emit('showToast', { title: '无权访问', color: 'error', icon: '$error', duration: 2000 }); 29 | window.location.href = '/'; 30 | } else { 31 | mitt.emit('showToast', { title: data.message, color: 'error', icon: '$error', duration: 2000 }); 32 | } 33 | } 34 | // error code 403: unauthorized, redirect to login page 35 | if (status === 403) { 36 | mitt.emit('showToast', { title: '未登陆或登陆过期,请重新登陆', color: 'error', icon: '$error', duration: 2000 }); 37 | window.location.href = '/login'; 38 | } 39 | } else { 40 | // axios error (timeout maybe) 41 | mitt.emit('showToast', { title: `网络错误:${err.message}`, color: 'error', icon: '$error', duration: 2000 }); 42 | } 43 | }); 44 | return instance(config); 45 | } -------------------------------------------------------------------------------- /src/components/CustomMessageCard.vue: -------------------------------------------------------------------------------- 1 | 36 | 37 | 64 | 65 | -------------------------------------------------------------------------------- /src/api/course/creation.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | 3 | export function getCourseCreationInfo(id) { 4 | return request({ 5 | url: `/course/creation/${id}`, 6 | method: 'get' 7 | }); 8 | } 9 | 10 | export function getSectionCreationInfo(id) { 11 | return request({ 12 | url: `/section/creation/${id}`, 13 | method: 'get' 14 | }); 15 | } 16 | 17 | export function getTaskCreationInfo(id) { 18 | return request({ 19 | url: `/task/creation/${id}`, 20 | method: 'get' 21 | }); 22 | } 23 | 24 | export function getTaskSubmitTypes() { 25 | return request({ 26 | url: '/task/submit/type', 27 | method: 'get' 28 | }); 29 | } 30 | 31 | export function createSection(section, courseId) { 32 | return request({ 33 | url: `/section/${courseId}`, 34 | method: 'post', 35 | data: section 36 | }); 37 | } 38 | 39 | export function updateSection(section) { 40 | return request({ 41 | url: '/section', 42 | method: 'put', 43 | data: section 44 | }); 45 | } 46 | 47 | export function deleteSection(sectionId) { 48 | return request({ 49 | url: `/section/${sectionId}`, 50 | method: 'delete' 51 | }); 52 | } 53 | 54 | export function createTask(task, sectionId) { 55 | return request({ 56 | url: `/task/${sectionId}`, 57 | method: 'post', 58 | data: task 59 | }); 60 | } 61 | 62 | export function updateTask(task) { 63 | return request({ 64 | url: '/task', 65 | method: 'put', 66 | data: task 67 | }); 68 | } 69 | 70 | 71 | export function deleteTask(taskId) { 72 | return request({ 73 | url: `/task/${taskId}`, 74 | method: 'delete' 75 | }); 76 | } 77 | 78 | export function publishCourse(courseId) { 79 | return request({ 80 | url: `/course/publish/${courseId}`, 81 | method: 'post' 82 | }); 83 | } -------------------------------------------------------------------------------- /src/views/common/PersonalCenterView.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 69 | 70 | -------------------------------------------------------------------------------- /src/store/user/index.js: -------------------------------------------------------------------------------- 1 | import { defineStore } from 'pinia'; 2 | import { getMyBasicInfo } from '@/api/user'; 3 | import mitt from '@/plugins/mitt'; 4 | import Role from '@/utils/role'; 5 | 6 | export const useUserStore = defineStore('user', { 7 | state: () => ({ 8 | user: null, 9 | role: null, 10 | }), 11 | actions: { 12 | setUser(user) { 13 | this.user = user; 14 | }, 15 | setRole(role) { 16 | this.role = role; 17 | }, 18 | setAvatar(avatar) { 19 | this.user.avatar = avatar; 20 | }, 21 | setEmail(email) { 22 | this.user.email = email; 23 | }, 24 | async loadUserInfo() { 25 | mitt.emit('globalLoading'); 26 | const me = (await getMyBasicInfo()); 27 | if (me) { 28 | this.setUser(me.data); 29 | const currentRole = Role.getRoleById(me.data.roleId); 30 | this.setRole(currentRole); 31 | } else { 32 | mitt.emit('showToast', { 33 | title: '获取用户信息失败!请重新登录。', 34 | color: 'error', 35 | icon: '$error', 36 | }); 37 | // clear login state, redirect to login page 38 | mitt.emit('unauthorized'); 39 | } 40 | mitt.emit('globalLoading'); 41 | } 42 | }, 43 | getters: { 44 | isLoggedIn(state) { 45 | return !!state.user; 46 | }, 47 | roleId(state) { 48 | if (state.user) { 49 | return state.user.roleId; 50 | } 51 | return null; 52 | }, 53 | roleInfo(state) { 54 | return state.role; 55 | }, 56 | userInfo(state) { 57 | return state.user; 58 | }, 59 | isTeacher(state) { 60 | return state.user && state.user.roleId === Role.ROLE_TEACHER.id; 61 | } 62 | }, 63 | }); -------------------------------------------------------------------------------- /src/components/personal/security/TheLogoutCard.vue: -------------------------------------------------------------------------------- 1 | 53 | 54 | 80 | 81 | -------------------------------------------------------------------------------- /src/api/student/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | import mitt from '@/plugins/mitt'; 3 | 4 | 5 | export function getCurrentCourse() { 6 | return request({ 7 | url: '/student/course/current', 8 | method: 'get' 9 | }); 10 | } 11 | 12 | export function getAllLearnedYears() { 13 | return request({ 14 | url: '/student/statistic', 15 | method: 'get' 16 | }); 17 | } 18 | 19 | export function getLearnedPerformanceByYear(year) { 20 | return request({ 21 | url: `/student/statistic/${year}`, 22 | method: 'get' 23 | }); 24 | } 25 | 26 | export function getAllLearningCourse(typeId, name) { 27 | let url = `/student/course/current/all?name=${name}`; 28 | if (typeId) { 29 | url += `&typeId=${typeId}`; 30 | } 31 | return request({ 32 | url: url, 33 | method: 'get' 34 | }); 35 | } 36 | 37 | export function getAllSelectableCourses(typeId, name) { 38 | let url = `/student/course?name=${name}`; 39 | if (typeId) { 40 | url += `&typeId=${typeId}`; 41 | } 42 | return request({ 43 | url: url, 44 | method: 'get' 45 | }); 46 | } 47 | 48 | export function teacherGetStudentLearningPerformance(name, page, groupId, courseTypeId) { 49 | let url = `/statistic/performance/student?studentName=${name}&page=${page}`; 50 | if (groupId) { 51 | url += `&groupId=${groupId}`; 52 | } 53 | if (courseTypeId) { 54 | url += `&courseTypeId=${courseTypeId}`; 55 | } 56 | return request({ 57 | url: url, 58 | method: 'get' 59 | }); 60 | } 61 | 62 | export function manualSelectCourse(courseId) { 63 | return request({ 64 | url: `/course/select/${courseId}`, 65 | method: 'post' 66 | }); 67 | } 68 | //修改密码 69 | export async function changePassword(data) { 70 | const res = await request({ 71 | url: '/user/student/password', 72 | method: 'put', 73 | data: data 74 | }); 75 | if (res.code == '200') { 76 | mitt.emit('showToast', { title: '修改成功', color: 'success', icon: '$success' }); 77 | } else { 78 | mitt.emit('showToast', { title: '修改失败', color: 'error', icon: '$error' }); 79 | } 80 | } -------------------------------------------------------------------------------- /src/views/common/course/CourseDetailView.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 65 | 66 | -------------------------------------------------------------------------------- /src/components/personal/info/TheEmailModifyCard.vue: -------------------------------------------------------------------------------- 1 | 33 | 34 | 92 | 93 | -------------------------------------------------------------------------------- /vite.config.mjs: -------------------------------------------------------------------------------- 1 | // Plugins 2 | import Components from 'unplugin-vue-components/vite'; 3 | import Vue from '@vitejs/plugin-vue'; 4 | import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'; 5 | import { VitePWA } from 'vite-plugin-pwa'; 6 | import { visualizer } from 'rollup-plugin-visualizer'; 7 | import { nodePolyfills } from 'vite-plugin-node-polyfills'; 8 | 9 | // Utilities 10 | import { defineConfig } from 'vite'; 11 | import { fileURLToPath, URL } from 'node:url'; 12 | // https://vitejs.dev/config/ 13 | export default defineConfig({ 14 | plugins: [ 15 | Vue({ 16 | template: { transformAssetUrls } 17 | }), 18 | // https://github.com/vuetifyjs/vuetify-loader/tree/master/packages/vite-plugin#readme 19 | Vuetify(), 20 | Components(), 21 | VitePWA({ 22 | registerType: 'autoUpdate', 23 | manifest: { 24 | id: 'app.goopper.top', 25 | name: 'Goopper 计算机实训平台', 26 | launch_handler: { 27 | client_mode: 'auto', 28 | }, 29 | orientation: 'portrait-primary', 30 | short_name: 'Goopper', 31 | description: 'Goopper 计算机实训平台', 32 | theme_color: '#1f1f1f', 33 | lang: 'zh-CN', 34 | edge_side_panel: '512', 35 | categories: ['education'], 36 | dir: 'ltr', 37 | icons: [ 38 | { 39 | src: 'logo.svg', 40 | sizes: 'any', 41 | type: 'image/svg+xml', 42 | purpose: 'any' 43 | }, 44 | { 45 | src: 'logo.svg', 46 | sizes: '512x512', 47 | type: 'image/svg+xml', 48 | purpose: 'any' 49 | }, 50 | ], 51 | screenshots: [], 52 | }, 53 | devOptions: { 54 | enabled: true 55 | } 56 | }), 57 | // 打包体积分析 58 | visualizer({ 59 | open: true, 60 | filename: 'visualizer.html' //分析图生成的文件名 61 | }), 62 | nodePolyfills() 63 | ], 64 | define: { 'process.env': {} }, 65 | resolve: { 66 | alias: { 67 | '@': fileURLToPath(new URL('./src', import.meta.url)) 68 | }, 69 | extensions: [ 70 | '.js', 71 | '.json', 72 | '.jsx', 73 | '.mjs', 74 | '.ts', 75 | '.tsx', 76 | '.vue', 77 | ], 78 | }, 79 | server: { 80 | port: 3000 81 | }, 82 | build: { 83 | rollupOptions: { 84 | output: { 85 | manualChunks: { 86 | 'code-mirror': ['codemirror','vue-codemirror'], 87 | 'p5': ['p5'], 88 | 'vendor': ['mitt', 'vue', 'vue-router', 'axios', 'vuetify', 'nprogress', 'pinia', 'unplugin-fonts'] 89 | } 90 | } 91 | } 92 | } 93 | }); -------------------------------------------------------------------------------- /src/views/oauth/bind/GitHubOAuthBindView.vue: -------------------------------------------------------------------------------- 1 | 48 | 49 | 99 | 100 | -------------------------------------------------------------------------------- /src/components/plugin/backend/request/TheRequestHeaderContent.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 100 | 101 | -------------------------------------------------------------------------------- /src/components/plugin/backend/request/TheRequestParamContent.vue: -------------------------------------------------------------------------------- 1 | 80 | 81 | 104 | 105 | -------------------------------------------------------------------------------- /src/components/plugin/backend/request/TheRequestBodyContent.vue: -------------------------------------------------------------------------------- 1 | 79 | 80 | 109 | 110 | -------------------------------------------------------------------------------- /src/router/index.js: -------------------------------------------------------------------------------- 1 | import { createRouter, createWebHistory } from 'vue-router'; 2 | import { routes } from '@/routes'; 3 | import { useUserStore } from '@/store/user'; 4 | import Role from '@/utils/role'; 5 | import mitt from '@/plugins/mitt'; 6 | import { clearLoginState } from '@/utils/auth'; 7 | import { LOCAL_STORAGE_TOKEN_KEY } from '@/utils/key'; 8 | import nProgress from 'nprogress'; 9 | import 'nprogress/nprogress.css'; 10 | import { useSaveStore } from '@/store/common/save'; 11 | 12 | nProgress.configure({ showSpinner: false }); 13 | 14 | export const whiteList = [ 15 | '/login', 16 | '/oauth/callback/github', 17 | '/plugin/backend', 18 | '/plugin/frontend', 19 | '/plugin/vue', 20 | ]; 21 | 22 | export const router = createRouter({ 23 | history: createWebHistory(), 24 | routes, 25 | }); 26 | 27 | // unauthorized 28 | mitt.on('unauthorized', () => { 29 | clearLoginState(); 30 | router.push('/login'); 31 | }); 32 | 33 | router.beforeEach(async (to, from) => { 34 | nProgress.start(); 35 | 36 | // permission check 37 | if (!whiteList.includes(to.path)) { 38 | // need authentication 39 | const userStore = useUserStore(); 40 | 41 | // localStorage don't have token 42 | if (!localStorage.getItem(LOCAL_STORAGE_TOKEN_KEY)) { 43 | return '/login'; 44 | } 45 | 46 | // unauthenticated and not in white list 47 | // if has localStorage token, try to load user info 48 | if (!userStore.isLoggedIn) { 49 | // try to load user info 50 | await userStore.loadUserInfo(); 51 | nProgress.inc(0.5); 52 | } 53 | 54 | // role redirect 55 | const currentRole = userStore.roleInfo; 56 | if (currentRole) { 57 | let uri = currentRole.name; 58 | if (uri === 'admin') uri = 'teacher'; 59 | if (to.path === '/') { 60 | return '/home/'+uri; 61 | } 62 | if (to.path === '/course') { 63 | return '/course/'+uri; 64 | } 65 | } 66 | 67 | // role check 68 | const requireRole = to.meta.requireRole; 69 | if (requireRole) { 70 | const roleId = userStore.roleId; 71 | // access denied (admin can access all pages) 72 | if ( 73 | roleId !== requireRole.id && 74 | roleId !== Role.ROLE_ADMIN.id 75 | ) { 76 | mitt.emit('showToast', { title: '无权访问!', color: 'error', icon: '$error' }); 77 | return '/login'; 78 | } 79 | } 80 | } 81 | 82 | // confirm check 83 | if (from.meta.routeConfirm) { 84 | const saveStore = useSaveStore(); 85 | if (saveStore.isSaved) { 86 | return true; 87 | } else { 88 | const result = confirm('当前页面有未保存的内容,是否继续?'); 89 | if (result) { 90 | saveStore.setAsSaved(); 91 | } else { 92 | mitt.emit('course-item-selection-update'); 93 | return false; 94 | } 95 | } 96 | } 97 | }); 98 | 99 | router.afterEach(() => { 100 | nProgress.done(); 101 | }); -------------------------------------------------------------------------------- /src/views/common/course/CourseSectionView.vue: -------------------------------------------------------------------------------- 1 | 53 | 87 | -------------------------------------------------------------------------------- /src/components/plugin/backend/TheRequestResult.vue: -------------------------------------------------------------------------------- 1 | 69 | 70 | 101 | 102 | -------------------------------------------------------------------------------- /src/components/plugin/backend/body/TheFormDataContent.vue: -------------------------------------------------------------------------------- 1 | 76 | 77 | 115 | 116 | -------------------------------------------------------------------------------- /src/components/CustomHorizontalCourseCard.vue: -------------------------------------------------------------------------------- 1 | 75 | 76 | -------------------------------------------------------------------------------- /src/views/oauth/GitHubOAuthCallbackView.vue: -------------------------------------------------------------------------------- 1 | 49 | 50 | 124 | 125 | -------------------------------------------------------------------------------- /src/api/correct/index.js: -------------------------------------------------------------------------------- 1 | import { request } from '..'; 2 | import mitt from '@/plugins/mitt'; 3 | export function getAnswerByMessageId(messageId) { 4 | return request({ 5 | url: '/answer/' + messageId, 6 | method: 'get' 7 | }); 8 | } 9 | 10 | export function submitCorrect(answerId, comment, score) { 11 | var data = JSON.stringify({ 12 | 'id': answerId, 13 | 'comment': comment, 14 | 'score': score 15 | }); 16 | 17 | return request({ 18 | url: '/answer/correct', 19 | method: 'post', 20 | headers: { 21 | 'content-type': 'application/json' 22 | }, 23 | data: data 24 | }); 25 | } 26 | 27 | //提交任务答案 28 | export function submitTaskAnswer(taskId, content, attachments) { 29 | return request({ 30 | url: '/answer/submit', 31 | method: 'post', 32 | data: { 33 | taskId, 34 | content, 35 | attachments 36 | } 37 | }); 38 | } 39 | 40 | //查询所有学生提交的作业 41 | export function getAnswer({corrected, groupId, courseId, sectionName, taskName, studentName, page}) { 42 | if (!page) { 43 | page = 1; 44 | } 45 | if (corrected == null) { 46 | corrected = ''; 47 | } 48 | if (groupId == null) { 49 | groupId = ''; 50 | } 51 | if (courseId == null) { 52 | courseId = ''; 53 | } 54 | if (sectionName == null) { 55 | sectionName = ''; 56 | } 57 | if (taskName == null) { 58 | taskName = ''; 59 | } 60 | if (studentName == null) { 61 | studentName = ''; 62 | } 63 | return request({ 64 | url: '/answer', 65 | method: 'get', 66 | params: { 67 | corrected, 68 | groupId, 69 | courseId, 70 | sectionName, 71 | taskName, 72 | studentName, 73 | page 74 | } 75 | }); 76 | } 77 | //根据多个id查询任务名称 78 | export function getTaskNameByIds(ids) { 79 | let answerIds = ids.map(id => `answerIds=${id}`).join('&'); 80 | return request({ 81 | url: `/answer/batch?${answerIds}`, 82 | method: 'get', 83 | }); 84 | } 85 | //单独批改任务 86 | export async function TaskIndividualCorrection(answerId, comment, score) { 87 | const res = await request({ 88 | url: '/answer/correct', 89 | method: 'post', 90 | data: { 91 | id: answerId, 92 | comment, 93 | score 94 | } 95 | }); 96 | if (res.code == '200') { 97 | mitt.emit('showToast', { title: '批改完成', color: 'success', icon: '$success' }); 98 | } else { 99 | mitt.emit('showToast', { title: '批改失败', color: 'error', icon: '$error' }); 100 | } 101 | } 102 | //批量批改任务 103 | export async function TaskBatchCorrection(answerIds,comment,score) { 104 | const res = await request({ 105 | url: '/answer/correct/batch', 106 | method: 'post', 107 | data: { 108 | ids: answerIds, 109 | comment, 110 | score 111 | } 112 | }); 113 | if (res.code == '200') { 114 | mitt.emit('showToast', { title: '批改完成', color: 'success', icon: '$success' }); 115 | } else { 116 | mitt.emit('showToast', { title: '批改失败', color: 'error', icon: '$error' }); 117 | } 118 | } 119 | //获取作业详细 120 | export function getAnswerByCorrectId(correctId) { 121 | return request({ 122 | url: '/answer/' + correctId, 123 | method: 'get' 124 | }); 125 | } 126 | //获取已批改作业信息 127 | export function CorrectedAnswer(correctId) { 128 | return request({ 129 | url: `/answer/corrected/${correctId}`, 130 | method: 'get' 131 | }); 132 | } -------------------------------------------------------------------------------- /src/components/personal/security/TheDeviceListCard.vue: -------------------------------------------------------------------------------- 1 | 62 | 63 | 126 | 127 | -------------------------------------------------------------------------------- /src/views/common/course/CourseInfoView.vue: -------------------------------------------------------------------------------- 1 | 55 | 88 | -------------------------------------------------------------------------------- /components.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | /* prettier-ignore */ 3 | // @ts-nocheck 4 | // Generated by unplugin-vue-components 5 | // Read more: https://github.com/vuejs/core/pull/3399 6 | export {} 7 | 8 | declare module 'vue' { 9 | export interface GlobalComponents { 10 | CustomAttachmentCard: typeof import('./src/components/CustomAttachmentCard.vue')['default'] 11 | CustomCodeEditor: typeof import('./src/components/plugin/CustomCodeEditor.vue')['default'] 12 | CustomCourseCard: typeof import('./src/components/course/CustomCourseCard.vue')['default'] 13 | CustomCourseStructureList: typeof import('./src/components/course/CustomCourseStructureList.vue')['default'] 14 | CustomDeviceCard: typeof import('./src/components/CustomDeviceCard.vue')['default'] 15 | CustomFloatBackButton: typeof import('./src/components/CustomFloatBackButton.vue')['default'] 16 | CustomHorizontalCourseCard: typeof import('./src/components/CustomHorizontalCourseCard.vue')['default'] 17 | CustomMessageCard: typeof import('./src/components/CustomMessageCard.vue')['default'] 18 | CustomPluginCard: typeof import('./src/components/plugin/CustomPluginCard.vue')['default'] 19 | RouterLink: typeof import('vue-router')['RouterLink'] 20 | RouterView: typeof import('vue-router')['RouterView'] 21 | StatisticEntryCard: typeof import('./src/components/personal/statistic/StatisticEntryCard.vue')['default'] 22 | TheAccountBindCard: typeof import('./src/components/personal/info/TheAccountBindCard.vue')['default'] 23 | TheAvatarModifyCard: typeof import('./src/components/personal/info/TheAvatarModifyCard.vue')['default'] 24 | TheCourseContentModifyCard: typeof import('./src/components/course/TheCourseContentModifyCard.vue')['default'] 25 | TheCourseCreationForm: typeof import('./src/components/course/TheCourseCreationForm.vue')['default'] 26 | TheDeviceListCard: typeof import('./src/components/personal/security/TheDeviceListCard.vue')['default'] 27 | TheEmailModifyCard: typeof import('./src/components/personal/info/TheEmailModifyCard.vue')['default'] 28 | TheFormDataContent: typeof import('./src/components/plugin/backend/body/TheFormDataContent.vue')['default'] 29 | TheHeader: typeof import('./src/components/TheHeader.vue')['default'] 30 | TheInstallAppCard: typeof import('./src/components/personal/about/TheInstallAppCard.vue')['default'] 31 | TheJsonContent: typeof import('./src/components/plugin/backend/body/TheJsonContent.vue')['default'] 32 | TheLogoutCard: typeof import('./src/components/personal/security/TheLogoutCard.vue')['default'] 33 | TheMessageListCard: typeof import('./src/components/home/TheMessageListCard.vue')['default'] 34 | TheP5Banner: typeof import('./src/components/TheP5Banner.vue')['default'] 35 | ThePasswordModifyCard: typeof import('./src/components/personal/security/ThePasswordModifyCard.vue')['default'] 36 | ThePluginListCard: typeof import('./src/components/home/ThePluginListCard.vue')['default'] 37 | TheRequestBodyContent: typeof import('./src/components/plugin/backend/request/TheRequestBodyContent.vue')['default'] 38 | TheRequestContent: typeof import('./src/components/plugin/backend/TheRequestContent.vue')['default'] 39 | TheRequestHeaderContent: typeof import('./src/components/plugin/backend/request/TheRequestHeaderContent.vue')['default'] 40 | TheRequestParamContent: typeof import('./src/components/plugin/backend/request/TheRequestParamContent.vue')['default'] 41 | TheRequestResult: typeof import('./src/components/plugin/backend/TheRequestResult.vue')['default'] 42 | TheResponseHeaderContent: typeof import('./src/components/plugin/backend/response/TheResponseHeaderContent.vue')['default'] 43 | TheResponseJsonContent: typeof import('./src/components/plugin/backend/response/TheResponseJsonContent.vue')['default'] 44 | TheUserBasicInfoCard: typeof import('./src/components/personal/info/TheUserBasicInfoCard.vue')['default'] 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/components/personal/security/ThePasswordModifyCard.vue: -------------------------------------------------------------------------------- 1 | 88 | 89 | 133 | 134 | -------------------------------------------------------------------------------- /src/components/personal/info/TheAccountBindCard.vue: -------------------------------------------------------------------------------- 1 | 80 | 81 | 159 | 160 | -------------------------------------------------------------------------------- /src/components/personal/info/TheAvatarModifyCard.vue: -------------------------------------------------------------------------------- 1 | 99 | 100 | 167 | 168 | -------------------------------------------------------------------------------- /src/plugins/p5-banner.js: -------------------------------------------------------------------------------- 1 | import p5 from 'p5'; 2 | 3 | function hexToRgb(hex) { 4 | let result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); 5 | return result ? { 6 | r: parseInt(result[1], 16), 7 | g: parseInt(result[2], 16), 8 | b: parseInt(result[3], 16) 9 | } : null; 10 | } 11 | 12 | function sketch(p) { 13 | const sketchHolder = document.getElementById('banner'); 14 | const w = sketchHolder.offsetWidth; 15 | const h = sketchHolder.offsetHeight; 16 | let g; 17 | let bg; 18 | let sum; 19 | let bigParticles = []; 20 | let smallParticles = []; 21 | 22 | class Particle { 23 | constructor(x, y) { 24 | this.loc = new p5.Vector(x, y); 25 | this.vel = new p5.Vector(0, 0); 26 | this.dir = new p5.Vector(0, 0); 27 | this.speed = p.random(0.5, 1); 28 | this.alpha = -10; 29 | this.randomColor = p.random(1); 30 | 31 | this.move = function () { 32 | let angle = p.noise( 33 | this.loc.x / 1000, 34 | this.loc.y / 1000, 35 | p.frameCount / 1000 36 | ) * p.TWO_PI; 37 | this.dir.x = p.cos(angle); 38 | this.dir.y = p.sin(angle); 39 | this.vel = this.dir.copy(); 40 | this.vel.mult(this.speed); 41 | this.loc.add(this.vel); 42 | }; 43 | 44 | this.checkBigEdges = function () { 45 | if ( 46 | g.pixels[p.int((this.loc.x + this.loc.y * g.width)) * 4 + 3] == 0 && 47 | p.dist(this.loc.x, this.loc.y, x, y) > 35 48 | ) { 49 | this.loc.x = x + p.random(-2, 2); 50 | this.loc.y = y + p.random(-2, 2); 51 | this.alpha = 0; 52 | } 53 | }; 54 | 55 | this.checkSmallEdges = function () { 56 | if ( 57 | this.loc.x > w && 58 | this.loc.x < p.width - w && 59 | this.loc.y > h && 60 | this.loc.y < height - h 61 | ) { 62 | this.loc.x = p.random(p.width); 63 | this.loc.y = p.random(p.height); 64 | } else if ( 65 | this.loc.x < 0 || 66 | this.loc.x > p.width || 67 | this.loc.y < 0 || 68 | this.loc.y > p.height 69 | ) { 70 | this.loc.x = p.random(p.width); 71 | this.loc.y = p.random(p.height); 72 | } 73 | }; 74 | 75 | this.display = function (r, i) { 76 | this.alpha += (255 - this.alpha) * 0.05; 77 | 78 | if (this.randomColor > 0.55) { 79 | let color1 = hexToRgb('#00c2ff'); 80 | p.fill(color1.r, color1.g, color1.b, this.alpha); 81 | } else if (this.randomColor <= 0.55 && this.randomColor >= 0.2) { 82 | let color2 = hexToRgb('#094293'); 83 | p.fill(color2.r, color2.g, color2.b, this.alpha); 84 | } else { 85 | let color3 = hexToRgb('#eefdff'); 86 | p.fill(color3.r, color3.g, color3.b, this.alpha); 87 | } 88 | p.noStroke(); 89 | 90 | p.ellipse(this.loc.x, this.loc.y, r, r); 91 | }; 92 | } 93 | } 94 | 95 | p.setup = function () { 96 | p.createCanvas(w, h); 97 | p.pixelDensity(1); 98 | g = p.createGraphics(w,h); 99 | g.textSize(500); 100 | g.textAlign(p.CENTER,p.CENTER); 101 | g.text('G',w/2, h/2); 102 | g.loadPixels(); 103 | sum = 0; 104 | 105 | for(let i = 0 ; i < 1000; i++){ 106 | smallParticles[i] = new Particle( 107 | p.random(p.width), 108 | p.random(p.height), 109 | ); 110 | } 111 | 112 | for(let y = 0; y < g.height; y+=4){ 113 | for(let x = 0 ; x < g.width; x+=4){ 114 | let index = p.int((y*g.width+x))*4; 115 | if( g.pixels[index+3] != 0 ){ 116 | bigParticles[sum] = new Particle( 117 | x + p.random(-5, 5), 118 | y + p.random(-5, 5), 119 | ); 120 | sum ++; 121 | } 122 | } 123 | } 124 | g.updatePixels(); 125 | 126 | bg = hexToRgb('#0a0a0a'); 127 | }; 128 | 129 | p.draw = function() { 130 | p.background(bg.r, bg.g, bg.b, 30); 131 | for (let i = 0; i < sum; i+=12) { 132 | bigParticles[i].move(); 133 | bigParticles[i].checkBigEdges(); 134 | bigParticles[i].display(12,i); 135 | } 136 | for (let i = 0; i < 300; i++) { 137 | smallParticles[i].move(); 138 | smallParticles[i].checkSmallEdges(); 139 | smallParticles[i].display(5,i); 140 | } 141 | }; 142 | }; 143 | 144 | export const drawBanner = (id) => { 145 | new p5(sketch, id); 146 | }; -------------------------------------------------------------------------------- /src/views/teacher/TaskCorrectView.vue: -------------------------------------------------------------------------------- 1 | 104 | 105 | -------------------------------------------------------------------------------- /src/views/teacher/correct/TaskBatchCorrectView.vue: -------------------------------------------------------------------------------- 1 | 64 | 130 | -------------------------------------------------------------------------------- /src/views/plugin/FrontendPluginView.vue: -------------------------------------------------------------------------------- 1 |