add: 为前后端添加exam数据库管理

This commit is contained in:
alivender
2025-07-31 14:03:00 +08:00
parent 0cc35ce541
commit 4df583e74b
10 changed files with 1389 additions and 71 deletions

View File

@@ -2354,76 +2354,6 @@ export class DebuggerClient {
return Promise.resolve<boolean>(null as any);
}
/**
* 重新开始触发(刷新后再启动触发器)
*/
restartTrigger( cancelToken?: CancelToken): Promise<boolean> {
let url_ = this.baseUrl + "/api/Debugger/RestartTrigger";
url_ = url_.replace(/[?&]$/, "");
let options_: AxiosRequestConfig = {
method: "POST",
url: url_,
headers: {
"Accept": "application/json"
},
cancelToken
};
return this.instance.request(options_).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.processRestartTrigger(_response);
});
}
protected processRestartTrigger(response: AxiosResponse): Promise<boolean> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (const k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = resultData200 !== undefined ? resultData200 : <any>null;
return Promise.resolve<boolean>(result200);
} else if (status === 400) {
const _responseText = response.data;
let result400: any = null;
let resultData400 = _responseText;
result400 = ProblemDetails.fromJS(resultData400);
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
} else if (status === 500) {
const _responseText = response.data;
return throwException("A server side error occurred.", status, _responseText, _headers);
} else if (status === 401) {
const _responseText = response.data;
let result401: any = null;
let resultData401 = _responseText;
result401 = ProblemDetails.fromJS(resultData401);
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<boolean>(null as any);
}
/**
* 读取触发器状态标志
*/
@@ -2716,6 +2646,241 @@ export class DebuggerClient {
}
}
export class ExamClient {
protected instance: AxiosInstance;
protected baseUrl: string;
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
constructor(baseUrl?: string, instance?: AxiosInstance) {
this.instance = instance || axios.create();
this.baseUrl = baseUrl ?? "http://127.0.0.1:5000";
}
/**
* 获取所有实验列表
* @return 实验列表
*/
getExamList( cancelToken?: CancelToken): Promise<ExamSummary[]> {
let url_ = this.baseUrl + "/api/Exam/list";
url_ = url_.replace(/[?&]$/, "");
let options_: AxiosRequestConfig = {
method: "GET",
url: url_,
headers: {
"Accept": "application/json"
},
cancelToken
};
return this.instance.request(options_).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.processGetExamList(_response);
});
}
protected processGetExamList(response: AxiosResponse): Promise<ExamSummary[]> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (const k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
if (Array.isArray(resultData200)) {
result200 = [] as any;
for (let item of resultData200)
result200!.push(ExamSummary.fromJS(item));
}
else {
result200 = <any>null;
}
return Promise.resolve<ExamSummary[]>(result200);
} else if (status === 401) {
const _responseText = response.data;
let result401: any = null;
let resultData401 = _responseText;
result401 = ProblemDetails.fromJS(resultData401);
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
} else if (status === 500) {
const _responseText = response.data;
return throwException("A server side error occurred.", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<ExamSummary[]>(null as any);
}
/**
* 根据实验ID获取实验详细信息
* @param examId 实验ID
* @return 实验详细信息
*/
getExam(examId: string, cancelToken?: CancelToken): Promise<ExamInfo> {
let url_ = this.baseUrl + "/api/Exam/{examId}";
if (examId === undefined || examId === null)
throw new Error("The parameter 'examId' must be defined.");
url_ = url_.replace("{examId}", encodeURIComponent("" + examId));
url_ = url_.replace(/[?&]$/, "");
let options_: AxiosRequestConfig = {
method: "GET",
url: url_,
headers: {
"Accept": "application/json"
},
cancelToken
};
return this.instance.request(options_).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.processGetExam(_response);
});
}
protected processGetExam(response: AxiosResponse): Promise<ExamInfo> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (const k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = ExamInfo.fromJS(resultData200);
return Promise.resolve<ExamInfo>(result200);
} else if (status === 400) {
const _responseText = response.data;
let result400: any = null;
let resultData400 = _responseText;
result400 = ProblemDetails.fromJS(resultData400);
return throwException("A server side error occurred.", status, _responseText, _headers, result400);
} else if (status === 401) {
const _responseText = response.data;
let result401: any = null;
let resultData401 = _responseText;
result401 = ProblemDetails.fromJS(resultData401);
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
} else if (status === 404) {
const _responseText = response.data;
let result404: any = null;
let resultData404 = _responseText;
result404 = ProblemDetails.fromJS(resultData404);
return throwException("A server side error occurred.", status, _responseText, _headers, result404);
} else if (status === 500) {
const _responseText = response.data;
return throwException("A server side error occurred.", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<ExamInfo>(null as any);
}
/**
* 重新扫描实验文件夹并更新数据库
* @return 更新结果
*/
scanExams( cancelToken?: CancelToken): Promise<ScanResult> {
let url_ = this.baseUrl + "/api/Exam/scan";
url_ = url_.replace(/[?&]$/, "");
let options_: AxiosRequestConfig = {
method: "POST",
url: url_,
headers: {
"Accept": "application/json"
},
cancelToken
};
return this.instance.request(options_).catch((_error: any) => {
if (isAxiosError(_error) && _error.response) {
return _error.response;
} else {
throw _error;
}
}).then((_response: AxiosResponse) => {
return this.processScanExams(_response);
});
}
protected processScanExams(response: AxiosResponse): Promise<ScanResult> {
const status = response.status;
let _headers: any = {};
if (response.headers && typeof response.headers === "object") {
for (const k in response.headers) {
if (response.headers.hasOwnProperty(k)) {
_headers[k] = response.headers[k];
}
}
}
if (status === 200) {
const _responseText = response.data;
let result200: any = null;
let resultData200 = _responseText;
result200 = ScanResult.fromJS(resultData200);
return Promise.resolve<ScanResult>(result200);
} else if (status === 401) {
const _responseText = response.data;
let result401: any = null;
let resultData401 = _responseText;
result401 = ProblemDetails.fromJS(resultData401);
return throwException("A server side error occurred.", status, _responseText, _headers, result401);
} else if (status === 403) {
const _responseText = response.data;
let result403: any = null;
let resultData403 = _responseText;
result403 = ProblemDetails.fromJS(resultData403);
return throwException("A server side error occurred.", status, _responseText, _headers, result403);
} else if (status === 500) {
const _responseText = response.data;
return throwException("A server side error occurred.", status, _responseText, _headers);
} else if (status !== 200 && status !== 204) {
const _responseText = response.data;
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
}
return Promise.resolve<ScanResult>(null as any);
}
}
export class JtagClient {
protected instance: AxiosInstance;
protected baseUrl: string;
@@ -7289,6 +7454,168 @@ export interface IChannelCaptureData {
data: string;
}
/** 实验简要信息类(用于列表显示) */
export class ExamSummary implements IExamSummary {
/** 实验的唯一标识符 */
id!: string;
/** 实验创建时间 */
createdTime!: Date;
/** 实验最后更新时间 */
updatedTime!: Date;
/** 实验标题(从文档内容中提取) */
title!: string;
constructor(data?: IExamSummary) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.createdTime = _data["createdTime"] ? new Date(_data["createdTime"].toString()) : <any>undefined;
this.updatedTime = _data["updatedTime"] ? new Date(_data["updatedTime"].toString()) : <any>undefined;
this.title = _data["title"];
}
}
static fromJS(data: any): ExamSummary {
data = typeof data === 'object' ? data : {};
let result = new ExamSummary();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["createdTime"] = this.createdTime ? this.createdTime.toISOString() : <any>undefined;
data["updatedTime"] = this.updatedTime ? this.updatedTime.toISOString() : <any>undefined;
data["title"] = this.title;
return data;
}
}
/** 实验简要信息类(用于列表显示) */
export interface IExamSummary {
/** 实验的唯一标识符 */
id: string;
/** 实验创建时间 */
createdTime: Date;
/** 实验最后更新时间 */
updatedTime: Date;
/** 实验标题(从文档内容中提取) */
title: string;
}
/** 实验信息类 */
export class ExamInfo implements IExamInfo {
/** 实验的唯一标识符 */
id!: string;
/** 实验文档内容Markdown格式 */
docContent!: string;
/** 实验创建时间 */
createdTime!: Date;
/** 实验最后更新时间 */
updatedTime!: Date;
constructor(data?: IExamInfo) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.id = _data["id"];
this.docContent = _data["docContent"];
this.createdTime = _data["createdTime"] ? new Date(_data["createdTime"].toString()) : <any>undefined;
this.updatedTime = _data["updatedTime"] ? new Date(_data["updatedTime"].toString()) : <any>undefined;
}
}
static fromJS(data: any): ExamInfo {
data = typeof data === 'object' ? data : {};
let result = new ExamInfo();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["id"] = this.id;
data["docContent"] = this.docContent;
data["createdTime"] = this.createdTime ? this.createdTime.toISOString() : <any>undefined;
data["updatedTime"] = this.updatedTime ? this.updatedTime.toISOString() : <any>undefined;
return data;
}
}
/** 实验信息类 */
export interface IExamInfo {
/** 实验的唯一标识符 */
id: string;
/** 实验文档内容Markdown格式 */
docContent: string;
/** 实验创建时间 */
createdTime: Date;
/** 实验最后更新时间 */
updatedTime: Date;
}
/** 扫描结果类 */
export class ScanResult implements IScanResult {
/** 结果消息 */
declare message: string;
/** 更新的实验数量 */
updateCount!: number;
constructor(data?: IScanResult) {
if (data) {
for (var property in data) {
if (data.hasOwnProperty(property))
(<any>this)[property] = (<any>data)[property];
}
}
}
init(_data?: any) {
if (_data) {
this.message = _data["message"];
this.updateCount = _data["updateCount"];
}
}
static fromJS(data: any): ScanResult {
data = typeof data === 'object' ? data : {};
let result = new ScanResult();
result.init(data);
return result;
}
toJSON(data?: any) {
data = typeof data === 'object' ? data : {};
data["message"] = this.message;
data["updateCount"] = this.updateCount;
return data;
}
}
/** 扫描结果类 */
export interface IScanResult {
/** 结果消息 */
message: string;
/** 更新的实验数量 */
updateCount: number;
}
/** 逻辑分析仪运行状态枚举 */
export enum CaptureStatus {
None = 0,

View File

@@ -31,6 +31,12 @@
工程界面
</router-link>
</li>
<li class="my-1 hover:translate-x-1 transition-all duration-300">
<router-link to="/exam" class="text-base font-medium">
<FileText class="icon" />
实验列表
</router-link>
</li>
<li class="my-1 hover:translate-x-1 transition-all duration-300">
<router-link to="/test" class="text-base font-medium">
<FlaskConical class="icon" />

View File

@@ -4,6 +4,7 @@ import AuthView from "../views/AuthView.vue";
import ProjectView from "../views/Project/Index.vue";
import TestView from "../views/TestView.vue";
import UserView from "@/views/User/Index.vue";
import ExamView from "@/views/ExamView.vue";
const router = createRouter({
history: createWebHistory(import.meta.env.BASE_URL),
@@ -13,6 +14,7 @@ const router = createRouter({
{ path: "/project", name: "project", component: ProjectView },
{ path: "/test", name: "test", component: TestView },
{ path: "/user", name: "user", component: UserView },
{ path: "/exam", name: "exam", component: ExamView },
],
});

View File

@@ -13,6 +13,7 @@ import {
NetConfigClient,
OscilloscopeApiClient,
DebuggerClient,
ExamClient,
} from "@/APIClient";
import axios, { type AxiosInstance } from "axios";
@@ -31,7 +32,8 @@ type SupportedClient =
| UDPClient
| NetConfigClient
| OscilloscopeApiClient
| DebuggerClient;
| DebuggerClient
| ExamClient;
export class AuthManager {
// 存储token到localStorage
@@ -190,6 +192,10 @@ export class AuthManager {
return AuthManager.createAuthenticatedClient(DebuggerClient);
}
public static createAuthenticatedExamClient(): ExamClient {
return AuthManager.createAuthenticatedClient(ExamClient);
}
// 登录函数
public static async login(
username: string,

516
src/views/ExamView.vue Normal file
View File

@@ -0,0 +1,516 @@
<template>
<div class="exam-page">
<div class="page-header">
<h1>实验列表</h1>
<div class="header-actions">
<button @click="refreshExams" class="btn btn-primary" :disabled="loading">
<i class="icon-refresh" :class="{ spinning: loading }"></i>
刷新
</button>
<button v-if="isAdmin" @click="scanExams" class="btn btn-secondary" :disabled="scanning">
<i class="icon-scan" :class="{ spinning: scanning }"></i>
扫描实验
</button>
</div>
</div>
<div v-if="loading" class="loading-container">
<div class="loading-spinner"></div>
<p>正在加载实验列表...</p>
</div>
<div v-else-if="error" class="error-container">
<div class="error-message">
<i class="icon-error"></i>
<h3>加载失败</h3>
<p>{{ error }}</p>
<button @click="refreshExams" class="btn btn-primary">重试</button>
</div>
</div>
<div v-else class="exam-list">
<div v-if="exams.length === 0" class="empty-state">
<i class="icon-empty"></i>
<h3>暂无实验</h3>
<p>当前没有可用的实验请联系管理员添加实验内容</p>
</div>
<div v-else class="exam-grid">
<div
v-for="exam in exams"
:key="exam.id"
class="exam-card"
@click="viewExam(exam.id)"
>
<div class="exam-card-header">
<h3 class="exam-title">{{ exam.title || exam.id }}</h3>
<span class="exam-id">{{ exam.id }}</span>
</div>
<div class="exam-card-content">
<div class="exam-meta">
<div class="meta-item">
<i class="icon-calendar"></i>
<span>创建时间{{ formatDate(exam.createdTime) }}</span>
</div>
<div class="meta-item">
<i class="icon-clock"></i>
<span>更新时间{{ formatDate(exam.updatedTime) }}</span>
</div>
</div>
</div>
<div class="exam-card-footer">
<button class="btn btn-outline">查看详情</button>
</div>
</div>
</div>
</div>
<!-- 实验详情模态框 -->
<div v-if="selectedExam" class="modal-overlay" @click="closeExamDetail">
<div class="modal-content exam-detail" @click.stop>
<div class="modal-header">
<h2>{{ selectedExam.id }}</h2>
<button @click="closeExamDetail" class="btn-close">&times;</button>
</div>
<div class="modal-body">
<div class="exam-info">
<div class="info-row">
<span class="label">实验ID</span>
<span class="value">{{ selectedExam.id }}</span>
</div>
<div class="info-row">
<span class="label">创建时间</span>
<span class="value">{{ formatDate(selectedExam.createdTime) }}</span>
</div>
<div class="info-row">
<span class="label">更新时间</span>
<span class="value">{{ formatDate(selectedExam.updatedTime) }}</span>
</div>
</div>
<div class="exam-content">
<MarkdownRenderer :content="selectedExam.docContent" />
</div>
</div>
</div>
</div>
<!-- 扫描结果提示 -->
<div v-if="scanResult" class="toast" :class="{ show: showToast }">
<i class="icon-success"></i>
<span>{{ scanResult.message }}</span>
</div>
</div>
</template>
<script setup lang="ts">
import { ref, onMounted, computed } from 'vue'
import { AuthManager } from '@/utils/AuthManager'
import { ExamClient, DataClient, type ExamSummary, type ExamInfo, type ScanResult } from '@/APIClient'
import MarkdownRenderer from '@/components/MarkdownRenderer.vue'
// 响应式数据
const exams = ref<ExamSummary[]>([])
const selectedExam = ref<ExamInfo | null>(null)
const loading = ref(false)
const scanning = ref(false)
const error = ref<string>('')
const scanResult = ref<ScanResult | null>(null)
const showToast = ref(false)
const isAdmin = ref(false)
// 方法
const checkAdminStatus = async () => {
try {
isAdmin.value = await AuthManager.verifyAdminAuth()
} catch (err) {
console.warn('无法验证管理员权限:', err)
isAdmin.value = false
}
}
const refreshExams = async () => {
loading.value = true
error.value = ''
try {
const client = AuthManager.createAuthenticatedExamClient()
exams.value = await client.getExamList()
} catch (err: any) {
error.value = err.message || '获取实验列表失败'
console.error('获取实验列表失败:', err)
} finally {
loading.value = false
}
}
const viewExam = async (examId: string) => {
try {
const client = AuthManager.createAuthenticatedExamClient()
selectedExam.value = await client.getExam(examId)
} catch (err: any) {
error.value = err.message || '获取实验详情失败'
console.error('获取实验详情失败:', err)
}
}
const closeExamDetail = () => {
selectedExam.value = null
}
const scanExams = async () => {
scanning.value = true
try {
const client = AuthManager.createAuthenticatedExamClient()
scanResult.value = await client.scanExams()
showToast.value = true
setTimeout(() => {
showToast.value = false
}, 3000)
// 刷新实验列表
await refreshExams()
} catch (err: any) {
error.value = err.message || '扫描实验失败'
console.error('扫描实验失败:', err)
} finally {
scanning.value = false
}
}
const formatDate = (date: Date | string) => {
const dateObj = typeof date === 'string' ? new Date(date) : date
return dateObj.toLocaleString('zh-CN', {
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit'
})
}
// 生命周期
onMounted(async () => {
await checkAdminStatus()
await refreshExams()
})
</script>
<style scoped>
.exam-page {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
padding-bottom: 20px;
border-bottom: 1px solid #e1e1e1;
}
.page-header h1 {
margin: 0;
color: #333;
font-size: 2rem;
}
.header-actions {
display: flex;
gap: 10px;
}
.btn {
padding: 8px 16px;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
transition: all 0.2s;
display: flex;
align-items: center;
gap: 5px;
}
.btn:disabled {
opacity: 0.6;
cursor: not-allowed;
}
.btn-primary {
background-color: #007bff;
color: white;
}
.btn-primary:hover:not(:disabled) {
background-color: #0056b3;
}
.btn-secondary {
background-color: #6c757d;
color: white;
}
.btn-secondary:hover:not(:disabled) {
background-color: #545b62;
}
.btn-outline {
background-color: transparent;
color: #007bff;
border: 1px solid #007bff;
}
.btn-outline:hover {
background-color: #007bff;
color: white;
}
.loading-container, .error-container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 300px;
text-align: center;
}
.loading-spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #007bff;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 20px;
}
.error-message {
max-width: 400px;
}
.error-message h3 {
color: #dc3545;
margin-bottom: 10px;
}
.exam-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
gap: 20px;
}
.exam-card {
background: white;
border: 1px solid #e1e1e1;
border-radius: 8px;
padding: 20px;
cursor: pointer;
transition: all 0.2s;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.exam-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.exam-card-header {
margin-bottom: 15px;
}
.exam-title {
margin: 0 0 5px 0;
color: #333;
font-size: 1.2rem;
}
.exam-id {
color: #666;
font-size: 0.9rem;
background: #f8f9fa;
padding: 2px 8px;
border-radius: 12px;
}
.exam-meta {
margin-bottom: 15px;
}
.meta-item {
display: flex;
align-items: center;
gap: 5px;
margin-bottom: 5px;
color: #666;
font-size: 0.9rem;
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal-content {
background: white;
border-radius: 8px;
max-width: 90vw;
max-height: 90vh;
overflow-y: auto;
box-shadow: 0 10px 25px rgba(0,0,0,0.2);
}
.exam-detail {
width: 800px;
}
.modal-header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
border-bottom: 1px solid #e1e1e1;
}
.modal-header h2 {
margin: 0;
color: #333;
}
.btn-close {
background: none;
border: none;
font-size: 1.5rem;
cursor: pointer;
color: #666;
padding: 0;
width: 30px;
height: 30px;
display: flex;
align-items: center;
justify-content: center;
}
.btn-close:hover {
color: #333;
}
.modal-body {
padding: 20px;
}
.exam-info {
background: #f8f9fa;
padding: 15px;
border-radius: 4px;
margin-bottom: 20px;
}
.info-row {
display: flex;
margin-bottom: 8px;
}
.info-row:last-child {
margin-bottom: 0;
}
.label {
font-weight: bold;
color: #333;
min-width: 100px;
}
.value {
color: #666;
}
.exam-content {
border: 1px solid #e1e1e1;
border-radius: 4px;
padding: 20px;
background: white;
max-height: 400px;
overflow-y: auto;
}
.empty-state {
text-align: center;
padding: 60px 20px;
color: #666;
}
.empty-state h3 {
margin-bottom: 10px;
color: #999;
}
.toast {
position: fixed;
top: 20px;
right: 20px;
background: #28a745;
color: white;
padding: 12px 20px;
border-radius: 4px;
box-shadow: 0 4px 12px rgba(0,0,0,0.15);
transform: translateX(100%);
transition: transform 0.3s;
z-index: 1001;
display: flex;
align-items: center;
gap: 8px;
}
.toast.show {
transform: translateX(0);
}
.spinning {
animation: spin 1s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* 深色主题适配 */
@media (prefers-color-scheme: dark) {
.exam-page {
background: #1a1a1a;
color: #e1e1e1;
}
.exam-card {
background: #2d2d2d;
border-color: #404040;
color: #e1e1e1;
}
.modal-content {
background: #2d2d2d;
color: #e1e1e1;
}
.exam-info {
background: #404040;
}
.exam-content {
background: #2d2d2d;
border-color: #404040;
}
}
</style>