sg-exam Teaching and Examination Management Platform

repository·master·Indexed 20 days ago

https://github.com/wells2333/sg-exam

A comprehensive online teaching and examination management platform built with Spring Boot and Vue. It features a web frontend for students, an H5 mobile client for exam participation, and an admin dashboard for educational operations. Key capabilities include multi-tenancy, fine-grained permission management, diverse course media support, and flexible assessment modes (exams, practice, and questionnaires) with various question types.

Tokens
105.5K
Snippets
314
Records
384
Agent score
68%

What's inside sg-exam

  1. Overview of sg-exam teaching management platform

    master

    sg-exam is an efficient teaching management platform built with Spring Boot and Vue. It is designed for seamless multi-tenancy and fine-grained permission management, covering core features such as online examinations, daily practice, and interactive learning.

    Key Capabilities

    • Diverse Course Experiences: Supports various media formats including text, images, and video courses.
    • Flexible Assessment Modes: Supports switching between exams, practice sessions, and questionnaires. Assessment modes include one-time completion, sequential answering, and timed exams.
    • Innovative Question Types: Includes single-choice, multiple-choice, true/false, short answer, and multimedia questions (video, audio).
    • Smart Question Bank: Supports manual creation, quick selection from existing banks, or intelligent random paper generation.
    • User Interaction: Users can bookmark exams, questions, and courses for targeted practice.
  2. Database Schema Overview

    master

    The sg-exam project uses a database named sg-exam-user-dev. The schema is organized into several functional modules including exam management, course management, system administration, and user/student management.

    Key modules include:

    • Exam Management: Tables for exam information, subjects, answers, records, and favorites.
    • Course Management: Tables for courses, chapters, sections, knowledge points, and evaluations.
    • System Administration: Tables for users, roles, menus, departments, logs, and configurations.
    • User/Student Management: Tables for students, user roles, and user-student associations.
  3. Understand the sg-exam system components

    master

    The project is composed of three main architectural components:

    • Web Frontend: Focused on the online education experience, allowing users to take exams, participate in courses, and engage in personalized practice.
    • H5 Client: A lightweight mobile client focused on exam participation, enabling users to learn and take assessments anywhere.
    • Admin Management System: A powerful backend tool for educational operations, including:
      • System Configuration: Management of units, users, departments, roles, menus, and operation logs (supports code auto-generation).
      • Exam Management: Full lifecycle management from course creation to grade evaluation, including course, exam, question bank, and score management.
  4. Initialize the H2 database in the development environment

    master
    In the development environment, the project uses an H2 file database by default. The database schema and sample data are automatically initialized during startup using the spring.sql.init property, which executes the SQL script located at config-repo/h2/schema-h2.sql in the project root.
  5. Access deployment documentation and source code analysis

    master

    To obtain the deployment documentation, operation manuals, source code analysis, and video tutorials for sg-exam, follow these steps:

    1. Follow the WeChat Official Account: "AI 程序员 Gary".
    2. Send the keyword "文档" (Documentation) to the account to receive the access links.
  6. Run the mobile (H5) application locally

    master

    To run the mobile H5 application in a local development environment, you must set the NODE_OPTIONS environment variable to use the legacy OpenSSL provider (required for compatibility with certain build tools) and then execute the dev:h5 script via yarn.

    Note: The export command sets the environment variable for the current shell session.

    export NODE_OPTIONS=--openssl-legacy-provider && yarn dev:h5
  7. Generate code using the sg-generator tool

    master

    The sg-generator tool provides endpoints to automate the process of importing database tables and generating corresponding code. The workflow typically involves two steps: first, importing the table metadata with comments, and second, generating the actual code files based on that table.

    Note: These endpoints are hosted on the user-service and require a running instance of the service (e.g., at http://localhost:8080).

    # Step 1: Import the table metadata
    # Parameters:
    # - table: The name of the database table
    # - comment: A description/comment for the table
    # - tenantCode: The tenant identifier
    GET http://localhost:8080/user-service/tool/gen/importTable?table=exam_subject_favorites&comment=收藏&tenantCode=gitee
    
    # Step 2: Generate the code
    # Parameters:
    # - table: The name of the database table
    GET http://localhost:8080/user-service/tool/gen/genCode/exam_subject_favorites
  8. Navigate the sg-exam web application layout

    master

    The Index.vue component serves as the primary layout wrapper for the sg-exam-web application. It provides a global navigation header and manages the main content area via the OMain component.

    Key navigation features include:

    • Main Menu: Access to Home (/home), Examinations (/exams), Courses (/courses), and Exam Records (/exam-record).
    • Admin Access: A dedicated link to open the administration panel at the current origin's /admin path.
    • User Account Management: If logged in, users can access their personal account settings, change passwords, and log out.
    • Authentication: Quick links for Register (/register) and Login (/login) are available for unauthenticated users.
    • Language Switching: Supports switching between zh (Chinese) and en (English) using vue-i18n.
  9. Manage Speech Synthesis in sg-exam-admin

    master

    The SynthesisManagement view (located in frontend/sg-exam-admin/src/views/speech/synthesis/index.vue) provides a management interface for speech synthesis records. It uses a BasicTable to list existing synthesis entries and a SynthesisModal to create or edit them.

    Key Operations

    • List Records: Uses getSpeechSynthesisList API to fetch data and displays it in a table with search capabilities via searchFormSchema.
    • Create New Record: Triggers handleCreate, which opens the SynthesisModal with isUpdate: false.
    • Edit Record: Triggers handleEdit, which opens the SynthesisModal with the specific record data and isUpdate: true.
    • Delete Record: Triggers handleDelete, which calls the deleteSpeech API using the record's id, shows a success message, and reloads the table.
    • Refresh Data: The table can be reloaded using the reload function returned by useTable after successful mutations.
  10. Manage exam subjects in the admin interface

    master

    The SubjectManagement component (found in frontend/sg-exam-admin/src/views/exam/subject/index.vue) provides a full interface for managing exam subjects. It integrates a category tree for filtering, a data table for viewing subjects, and various modals for creation, editing, importing, and category management.

    Key Capabilities

    • Filtering: Select a category from the SubjectCategoryTree to filter the subject list.
    • CRUD Operations: Create new subjects, edit existing ones via SubjectModal, and delete single or multiple subjects.
    • Data Management: Import subjects via ImportModal and export subjects to an .xlsx file.
    • Category Management: Manage the subject hierarchy using CategoryModal.

    Required Permissions

    The UI elements are gated by the following permission keys:

    • exam:subject:category:add: Access to Category Management.
    • exam:subject:bank:add: Access to Create Subject.
    • exam:subject:bank:import: Access to Import Subjects.
    • exam:subject:bank:export: Access to Export Subjects.
    • exam:subject:bank:del: Access to Batch Delete.
    • exam:subject:bank:edit: Access to Edit individual subjects.