- classLabel / groupClassOptions / classSelectOptions 挪到 utils/classes.ts,useTone 挪到 shared/composables/tone.ts:原来放在 oj/submission/ 下,被前台、后台、shared 引了 50 多处 - 流程图编辑器的草稿键改由题目页传进来(键名不变,学生存着的草稿照样读得到)。原来编辑器 自己读题目页的 store 和路由拼,后台出题页也用这个组件,那边 store 是空的 - SQL 表名补全改由题目页传表进来。原来补全直接读题目页的 store,自学页的 SQL 代码块会 补出上一道看过的题的表名 实跑:提交列表、题目页、排名、后台题目页、SQL 题、流程图题打开无报错;SQL 题输入 stu 补出 students;流程图加一步,草稿照旧存在 flowchart-v2-problem-<题号>。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
465dbfd42f
commit
309ca0ece2
59 files changed
+168
-142
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import { useThemeVars } from "naive-ui"
|
||||
import { useDark } from "@vueuse/core"
|
||||
|
||||
export type Tone = "success" | "error" | "warning" | "info" | "default"
|
||||
|
||||
export function rgba(hex: string, alpha: number) {
|
||||
const value = hex.replace("#", "")
|
||||
const full =
|
||||
value.length === 3
|
||||
? value
|
||||
.split("")
|
||||
.map((c) => c + c)
|
||||
.join("")
|
||||
: value.slice(0, 6)
|
||||
const n = parseInt(full, 16)
|
||||
return `rgba(${(n >> 16) & 255}, ${(n >> 8) & 255}, ${n & 255}, ${alpha})`
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交列表里各种小胶囊的配色:浅底 + 深一档的字(设计稿「提交列表重设计 · 定稿」)。
|
||||
* 从主题色里取,暗色下字换成主题色本身(深色字放在暗底上看不清)。
|
||||
* 不用 color-mix:Chrome 105 没有(111 才有),机房有一部分还是 105。
|
||||
*/
|
||||
export function useTone() {
|
||||
const theme = useThemeVars()
|
||||
const isDark = useDark()
|
||||
|
||||
return function tone(kind: Tone) {
|
||||
const t = theme.value
|
||||
const base = {
|
||||
success: t.successColor,
|
||||
error: t.errorColor,
|
||||
warning: t.warningColor,
|
||||
info: t.infoColor,
|
||||
default: t.textColor3,
|
||||
}[kind]
|
||||
const pressed = {
|
||||
success: t.successColorPressed,
|
||||
error: t.errorColorPressed,
|
||||
warning: t.warningColorPressed,
|
||||
info: t.infoColorPressed,
|
||||
default: t.textColor2,
|
||||
}[kind]
|
||||
return {
|
||||
color: isDark.value ? base : pressed,
|
||||
background: kind === "default" ? t.actionColor : rgba(base, isDark.value ? 0.16 : 0.12),
|
||||
solid: base,
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user