Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
530e1a3d5d
commit
195069450f
480 files changed
+15507
-24650
No files matched your search
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { Icon } from "@iconify/vue"
|
||||
import { errorKind } from "utils/errorKind"
|
||||
import { useBreakpoints } from "shared/composables/breakpoints"
|
||||
import { useTeacherHelp } from "shared/composables/teacherHelp"
|
||||
import { useCollabStore } from "shared/store/collab"
|
||||
import type { CollabRequestItem } from "shared/composables/websocket"
|
||||
import { SubmissionStatus } from "utils/constants"
|
||||
import UserName from "./UserName.vue"
|
||||
import { Icon } from '@iconify/vue'
|
||||
import { errorKind } from 'utils/errorKind'
|
||||
import { useBreakpoints } from 'shared/composables/breakpoints'
|
||||
import { useTeacherHelp } from 'shared/composables/teacherHelp'
|
||||
import { useCollabStore } from 'shared/store/collab'
|
||||
import type { CollabRequestItem } from 'shared/composables/websocket'
|
||||
import { SubmissionStatus } from 'utils/constants'
|
||||
import UserName from './UserName.vue'
|
||||
|
||||
/**
|
||||
* 顶栏「N 人举手」点开的面板(设计稿「举手与协作」HcPanel),挂在按钮下面,不是弹框。
|
||||
@@ -27,7 +27,7 @@ const { isDesktop } = useBreakpoints()
|
||||
const now = useNow({ scheduler: (cb) => useIntervalFn(cb, 1000) })
|
||||
function waited(createdAt: number) {
|
||||
const seconds = Math.max(0, Math.floor((now.value.getTime() - createdAt) / 1000))
|
||||
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, "0")}`
|
||||
return `${Math.floor(seconds / 60)}:${String(seconds % 60).padStart(2, '0')}`
|
||||
}
|
||||
/** 等了三分钟以上标红 */
|
||||
function waitedLong(createdAt: number) {
|
||||
@@ -35,25 +35,25 @@ function waitedLong(createdAt: number) {
|
||||
}
|
||||
|
||||
function kindOf(item: CollabRequestItem) {
|
||||
if (!item.latest) return "还没交过"
|
||||
if (item.latest.result === SubmissionStatus.accepted) return "已经做对了"
|
||||
if (!item.latest) return '还没交过'
|
||||
if (item.latest.result === SubmissionStatus.accepted) return '已经做对了'
|
||||
return errorKind(item.latest).label
|
||||
}
|
||||
|
||||
function pendingOf(items: CollabRequestItem[]) {
|
||||
return items.filter((item) => item.status === "pending")
|
||||
return items.filter((item) => item.status === 'pending')
|
||||
}
|
||||
|
||||
function onHelp(item: CollabRequestItem) {
|
||||
if (help(item.studentId)) emit("close")
|
||||
if (help(item.studentId)) emit('close')
|
||||
}
|
||||
|
||||
/** 「讲这道题」:去这个班的看板、选中这道题,下面展开错着的人按错法归堆,点人就是讲错误弹层 */
|
||||
function explain(items: CollabRequestItem[], problemId: string) {
|
||||
const className = items.find((item) => item.className)?.className
|
||||
emit("close")
|
||||
emit('close')
|
||||
router.push({
|
||||
name: "classroom board",
|
||||
name: 'classroom board',
|
||||
query: { ...(className ? { className } : {}), problem: problemId },
|
||||
})
|
||||
}
|
||||
@@ -66,12 +66,7 @@ function explain(items: CollabRequestItem[], problemId: string) {
|
||||
</div>
|
||||
<n-alert v-if="!isDesktop" type="info" :bordered="false">接单要在电脑上打开</n-alert>
|
||||
<n-empty v-if="collabStore.groupedRequests.length === 0" description="没有人举手" />
|
||||
<div
|
||||
v-for="group in collabStore.groupedRequests"
|
||||
:key="group.problemId"
|
||||
class="group"
|
||||
:class="{ many: pendingOf(group.items).length >= 2 }"
|
||||
>
|
||||
<div v-for="group in collabStore.groupedRequests" :key="group.problemId" class="group" :class="{ many: pendingOf(group.items).length >= 2 }">
|
||||
<div class="group-head">
|
||||
<span class="group-title">
|
||||
<b class="num">{{ group.problemId }}</b>
|
||||
@@ -80,9 +75,7 @@ function explain(items: CollabRequestItem[], problemId: string) {
|
||||
<b class="group-count">{{ group.items.length }} 人</b>
|
||||
<template v-if="pendingOf(group.items).length >= 2">
|
||||
<n-button size="small" @click="explain(group.items, group.problemId)">讲这道题</n-button>
|
||||
<n-button size="small" @click="collabStore.dismiss(group.problemId)">
|
||||
讲完了,都放下
|
||||
</n-button>
|
||||
<n-button size="small" @click="collabStore.dismiss(group.problemId)"> 讲完了,都放下 </n-button>
|
||||
</template>
|
||||
</div>
|
||||
<div v-for="item in group.items" :key="item.studentId" class="row">
|
||||
@@ -94,20 +87,9 @@ function explain(items: CollabRequestItem[], problemId: string) {
|
||||
<n-text type="info" strong class="helping">{{ item.teacherName }} 在帮</n-text>
|
||||
</template>
|
||||
<template v-else>
|
||||
<span class="waited" :class="{ long: waitedLong(item.createdAt) }">
|
||||
等了 {{ waited(item.createdAt) }}
|
||||
</span>
|
||||
<n-button v-if="isDesktop" type="primary" size="small" @click="onHelp(item)">
|
||||
去帮
|
||||
</n-button>
|
||||
<n-button
|
||||
quaternary
|
||||
circle
|
||||
size="small"
|
||||
aria-label="放下举手"
|
||||
title="放下举手"
|
||||
@click="collabStore.reject(item.studentId)"
|
||||
>
|
||||
<span class="waited" :class="{ long: waitedLong(item.createdAt) }"> 等了 {{ waited(item.createdAt) }} </span>
|
||||
<n-button v-if="isDesktop" type="primary" size="small" @click="onHelp(item)"> 去帮 </n-button>
|
||||
<n-button quaternary circle size="small" aria-label="放下举手" title="放下举手" @click="collabStore.reject(item.studentId)">
|
||||
<Icon icon="mdi:close" height="16" />
|
||||
</n-button>
|
||||
</template>
|
||||
|
||||
Reference in new issue
Block a user