1 parent
23844ae301
commit
d25b5dbe6d
268 files changed
+3684
-8861
No files matched your search
@@ -35,14 +35,7 @@ function svgToBitmapShape(svg: string): Promise<confetti.Shape> {
|
||||
resolve({
|
||||
type: "bitmap",
|
||||
bitmap,
|
||||
matrix: [
|
||||
scale,
|
||||
0,
|
||||
0,
|
||||
scale,
|
||||
(-renderSize * scale) / 2,
|
||||
(-renderSize * scale) / 2,
|
||||
],
|
||||
matrix: [scale, 0, 0, scale, (-renderSize * scale) / 2, (-renderSize * scale) / 2],
|
||||
} as unknown as confetti.Shape)
|
||||
} catch (e) {
|
||||
reject(e)
|
||||
@@ -176,14 +169,7 @@ export function useFireworks() {
|
||||
() => {
|
||||
const end = Date.now() + 2000
|
||||
|
||||
const colors = [
|
||||
"#ff595e",
|
||||
"#ff924c",
|
||||
"#ffca3a",
|
||||
"#8ac926",
|
||||
"#1982c4",
|
||||
"#6a4c93",
|
||||
]
|
||||
const colors = ["#ff595e", "#ff924c", "#ffca3a", "#8ac926", "#1982c4", "#6a4c93"]
|
||||
|
||||
const frame = () => {
|
||||
confetti({
|
||||
@@ -228,14 +214,7 @@ export function useFireworks() {
|
||||
x: Math.random(),
|
||||
y: Math.random() - 0.2,
|
||||
},
|
||||
colors: [
|
||||
"#ff0000",
|
||||
"#00ff00",
|
||||
"#0000ff",
|
||||
"#ffff00",
|
||||
"#ff00ff",
|
||||
"#00ffff",
|
||||
],
|
||||
colors: ["#ff0000", "#00ff00", "#0000ff", "#ffff00", "#ff00ff", "#00ffff"],
|
||||
})
|
||||
}, 200)
|
||||
timers.add(interval)
|
||||
@@ -380,8 +359,7 @@ export function useFireworks() {
|
||||
]
|
||||
|
||||
// 随机选择一种效果
|
||||
const randomEffect =
|
||||
fireworkTypes[Math.floor(Math.random() * fireworkTypes.length)]
|
||||
const randomEffect = fireworkTypes[Math.floor(Math.random() * fireworkTypes.length)]
|
||||
randomEffect()
|
||||
}
|
||||
|
||||
|
||||
@@ -33,15 +33,12 @@ export function useMermaidConverter() {
|
||||
nodes.forEach((node: any, index: number) => {
|
||||
idMap.set(node.id, `node_${index}`)
|
||||
})
|
||||
const safeId = (id: string) =>
|
||||
idMap.get(id) || id.replace(/[^a-zA-Z0-9_]/g, "_")
|
||||
const safeId = (id: string) => idMap.get(id) || id.replace(/[^a-zA-Z0-9_]/g, "_")
|
||||
|
||||
// 处理节点 - 根据原始类型和自定义标签
|
||||
nodes.forEach((node: any) => {
|
||||
const nodeId = safeId(node.id)
|
||||
const label = escapeLabel(
|
||||
node.data?.customLabel || node.data?.label || "节点",
|
||||
)
|
||||
const label = escapeLabel(node.data?.customLabel || node.data?.label || "节点")
|
||||
const originalType = node.data?.originalType || node.type
|
||||
|
||||
// 根据节点原始类型确定Mermaid语法
|
||||
@@ -90,20 +87,13 @@ export function useMermaidConverter() {
|
||||
|
||||
// 添加样式定义来区分不同类型的节点
|
||||
mermaid += "\n"
|
||||
mermaid +=
|
||||
" classDef startNode fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef endNode fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef input fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef output fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef process fill:#f0f9ff,stroke:#0284c7,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef decision fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid +=
|
||||
" classDef loop fill:#fae8ff,stroke:#c026d3,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef startNode fill:#dcfce7,stroke:#16a34a,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef endNode fill:#fee2e2,stroke:#dc2626,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef input fill:#dbeafe,stroke:#2563eb,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef output fill:#ede9fe,stroke:#7c3aed,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef process fill:#f0f9ff,stroke:#0284c7,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef decision fill:#fef3c7,stroke:#d97706,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += " classDef loop fill:#fae8ff,stroke:#c026d3,stroke-width:2px,color:#0f172a\n"
|
||||
mermaid += "\n"
|
||||
|
||||
// 为节点应用样式
|
||||
|
||||
@@ -4,10 +4,7 @@ import { getSubmission } from "oj/api"
|
||||
import { SubmissionStatus } from "utils/constants"
|
||||
import type { PendingAchievement, Submission } from "utils/types"
|
||||
import { useAchievementStore } from "shared/store/achievement"
|
||||
import {
|
||||
useSubmissionWebSocket,
|
||||
type SubmissionUpdate,
|
||||
} from "shared/composables/websocket"
|
||||
import { useSubmissionWebSocket, type SubmissionUpdate } from "shared/composables/websocket"
|
||||
|
||||
/**
|
||||
* 判题监控 Composable
|
||||
@@ -29,10 +26,7 @@ export function useSubmissionMonitor() {
|
||||
|
||||
const result = res.result
|
||||
// 判题完成,停止轮询
|
||||
if (
|
||||
result !== SubmissionStatus.judging &&
|
||||
result !== SubmissionStatus.pending
|
||||
) {
|
||||
if (result !== SubmissionStatus.judging && result !== SubmissionStatus.pending) {
|
||||
pausePolling()
|
||||
}
|
||||
} catch (error) {
|
||||
@@ -75,9 +69,7 @@ export function useSubmissionMonitor() {
|
||||
|
||||
// 判题完成或出错,获取完整详情
|
||||
if (data.status === "finished" || data.status === "error") {
|
||||
console.log(
|
||||
`[SubmissionMonitor] 判题${data.status === "finished" ? "完成" : "出错"}`,
|
||||
)
|
||||
console.log(`[SubmissionMonitor] 判题${data.status === "finished" ? "完成" : "出错"}`)
|
||||
|
||||
// 停止轮询(WebSocket已成功)
|
||||
pausePolling()
|
||||
@@ -93,13 +85,8 @@ export function useSubmissionMonitor() {
|
||||
}
|
||||
|
||||
// 初始化 WebSocket
|
||||
const {
|
||||
connect,
|
||||
subscribe,
|
||||
unsubscribe,
|
||||
scheduleDisconnect,
|
||||
cancelScheduledDisconnect,
|
||||
} = useSubmissionWebSocket(handleSubmissionUpdate)
|
||||
const { connect, subscribe, unsubscribe, scheduleDisconnect, cancelScheduledDisconnect } =
|
||||
useSubmissionWebSocket(handleSubmissionUpdate)
|
||||
|
||||
// ==================== 轮询保底启动 ====================
|
||||
const { start: startPollingFallback } = useTimeoutFn(
|
||||
@@ -143,17 +130,11 @@ export function useSubmissionMonitor() {
|
||||
}
|
||||
|
||||
// ==================== 计算属性 ====================
|
||||
const judging = computed(
|
||||
() => submission.value?.result === SubmissionStatus.judging,
|
||||
)
|
||||
const judging = computed(() => submission.value?.result === SubmissionStatus.judging)
|
||||
|
||||
const pending = computed(
|
||||
() => submission.value?.result === SubmissionStatus.pending,
|
||||
)
|
||||
const pending = computed(() => submission.value?.result === SubmissionStatus.pending)
|
||||
|
||||
const submitting = computed(
|
||||
() => submission.value?.result === SubmissionStatus.submitting,
|
||||
)
|
||||
const submitting = computed(() => submission.value?.result === SubmissionStatus.submitting)
|
||||
|
||||
const isProcessing = computed(() => {
|
||||
return judging.value || pending.value || submitting.value
|
||||
|
||||
Reference in new issue
Block a user