feat: 添加排行榜分数编辑和题目详情展示功能
- 在排行榜详情页中,添加队伍题目分数编辑功能,支持批量保存 - 新增打字机组件用于题目答案的动态展示 - 优化游戏页面的答题数量统计逻辑,使用 UserAnswerFont 解析 - 更新题目导入工具,支持更多 JSON 格式 - 调整游戏倒计时逻辑,优先使用题目详情中的时间 - 移除排行榜中的部分冗余列,优化界面显示
This commit is contained in:
@ -40,10 +40,6 @@ interface Question {
|
||||
ImageUrl: string
|
||||
}
|
||||
|
||||
interface QuestionBank {
|
||||
question_bank: Question[]
|
||||
}
|
||||
|
||||
async function importQuestions() {
|
||||
try {
|
||||
// 检查资源目录是否存在
|
||||
@ -64,11 +60,17 @@ async function importQuestions() {
|
||||
const filePath = path.join(ASSET_DIR, file)
|
||||
console.log(`\nStarting import for file: ${file}`)
|
||||
|
||||
const data: QuestionBank = await fs.readJSON(filePath)
|
||||
const questions = data.question_bank
|
||||
const data: any = await fs.readJSON(filePath)
|
||||
let questions: Question[] = []
|
||||
|
||||
if (!questions || !Array.isArray(questions)) {
|
||||
console.error(`Invalid JSON format in ${file}: question_bank array not found.`)
|
||||
if (Array.isArray(data)) {
|
||||
questions = data
|
||||
}
|
||||
else if (data.question_bank && Array.isArray(data.question_bank)) {
|
||||
questions = data.question_bank
|
||||
}
|
||||
else {
|
||||
console.error(`Invalid JSON format in ${file}: question_bank array not found or data is not an array.`)
|
||||
continue
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user