From adbfc847ec84f82def2a120639f2e06c5da33519 Mon Sep 17 00:00:00 2001 From: shawko Date: Sun, 10 May 2026 12:19:29 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=96=B0=E5=A2=9E=E9=94=81=E5=B1=8F?= =?UTF-8?q?=E3=80=81=E4=BD=9C=E4=B8=9A=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playground/src/api/service/class.ts | 6 + playground/src/views/org/class-mgr/home.vue | 78 ++++++++++++ .../question-bank/task-mgr/paper-explain.vue | 117 +++++++++++++++--- playground/vite.config.mts | 4 +- 4 files changed, 186 insertions(+), 19 deletions(-) diff --git a/playground/src/api/service/class.ts b/playground/src/api/service/class.ts index 5d238da..de591e1 100644 --- a/playground/src/api/service/class.ts +++ b/playground/src/api/service/class.ts @@ -1,6 +1,12 @@ +import { post } from '#/api/http' + import { BasicService } from './basic' class ClassService extends BasicService { + async lockScreen(data: { classId: any; status: 0 | 1 }) { + await post('/school/classScreenLock/lock', data) + } + protected findPageUrl(): string { return '/org/class/list' } diff --git a/playground/src/views/org/class-mgr/home.vue b/playground/src/views/org/class-mgr/home.vue index 8a8951b..c4867ef 100644 --- a/playground/src/views/org/class-mgr/home.vue +++ b/playground/src/views/org/class-mgr/home.vue @@ -14,6 +14,7 @@ import MjTable, { mj_form_text, } from '#/components/mj/mj-table' import { pattern_phone } from '#/components/mj/mj-table/fmt' +import hud from '#/utils/hud' import obj from '#/utils/obj' import { grades } from '#/store/basic-data' @@ -73,6 +74,7 @@ const addFields = [ 'contact', 'phone', 'currencyFlag', + 'workMode', 'gradeId', 'masterTeacherId', ] @@ -148,12 +150,27 @@ const editForm = { name: 'VxeSwitch', }, }, + { + field: 'workMode', + title: '作业模式', + span: 12, + itemRender: { + name: 'VxeSwitch', + props: { + openValue: 1, + closeValue: 0, + openLabel: '已开启', + closeLabel: '未开启', + }, + }, + }, ), data: {}, }, addFields, updateFields: ['id', ...addFields], beforeSaveOrUpdate(formData: any) { + formData.workMode ??= 0 if (userInfo.value.isOnlyStaff) { formData.schoolId = userInfo.value.schoolId } @@ -176,6 +193,7 @@ const editForm = { if (userInfo.value.gradeId) { data.gradeId = userInfo.value.gradeId } + data.workMode ??= 0 if (edit) { gridRef.value.hideEditFormItems('schoolName') return data @@ -200,6 +218,13 @@ const searchForm = { // 表格 const grid = { columns: obj.joinObjs( + { + title: '操作', + width: 160, + slots: { + default: 'operation', + }, + }, { type: 'seq' }, { field: 'name', @@ -216,6 +241,12 @@ const grid = { default: 'currencyFlag', }, }, + { + title: '作业模式', + slots: { + default: 'workMode', + }, + }, { field: 'contact', title: '联系人', @@ -249,6 +280,35 @@ function currencyFlagChange(row: any) { row.currencyFlag = oldFlag }) } + +// 作业模式 +function workModeChange(row: any) { + const oldMode = row.workMode === 1 ? 0 : 1 + classService + .saveOrUpdate({ + id: row.id, + workMode: row.workMode, + }) + .catch(() => { + row.workMode = oldMode + }) +} + +function updateScreenLock(row: any, status: 0 | 1) { + const option = status === 1 ? '锁屏' : '解锁' + hud.confirmLoad(`确定${option}【${row.name}】吗?`, { + task: async () => { + await classService.lockScreen({ + classId: row.id, + status, + }) + gridRef.value?.reload() + }, + hideError: true, + option, + hideSuccess: false, + }) +} diff --git a/playground/src/views/question-bank/task-mgr/paper-explain.vue b/playground/src/views/question-bank/task-mgr/paper-explain.vue index 22a2c81..0280f19 100644 --- a/playground/src/views/question-bank/task-mgr/paper-explain.vue +++ b/playground/src/views/question-bank/task-mgr/paper-explain.vue @@ -212,20 +212,41 @@ function resetZoom() { // ======================== 讲解模式 ======================== const currentIndex = ref(0) +const answerExpanded = ref(false) +const explanationExpanded = ref(false) const currentQuestion = computed(() => { return paperDetail.value[currentIndex.value] || null }) +const hasAnswer = computed(() => Boolean(currentQuestion.value?.xkwTitle?.answer)) +const hasExplanation = computed(() => + Boolean(currentQuestion.value?.xkwTitle?.explanation), +) + function getTitleKey(item: any) { return ( item?.xkwTitle?.titleId ?? item?.titleId ?? item?.xkwTitle?.id ?? item?.id ) } +function collapseAnswerAnalysis() { + answerExpanded.value = false + explanationExpanded.value = false +} + +function toggleAnswer() { + answerExpanded.value = !answerExpanded.value +} + +function toggleExplanation() { + explanationExpanded.value = !explanationExpanded.value +} + async function enterExplaining() { initLeftWidth() resetZoom() + collapseAnswerAnalysis() phase.value = 'explaining' currentIndex.value = 0 await callExplainApi(1) @@ -250,6 +271,7 @@ async function callExplainApi(status: number, overrideQuestionId?: string) { function prevQuestion() { if (currentIndex.value > 0) { currentIndex.value-- + collapseAnswerAnalysis() callExplainApi(1) } } @@ -257,12 +279,14 @@ function prevQuestion() { function nextQuestion() { if (currentIndex.value < paperDetail.value.length - 1) { currentIndex.value++ + collapseAnswerAnalysis() callExplainApi(1) } } function goToQuestion(idx: number) { currentIndex.value = idx + collapseAnswerAnalysis() callExplainApi(1) } @@ -402,8 +426,8 @@ async function getTitleStudentInfo(titleId: string, markType: number) {
第 {{ currentIndex + 1 }} 题
-
-
+
+