后台:json上传

This commit is contained in:
luying
2021-05-12 18:56:47 +08:00
parent 2fc5017af8
commit 148a11edab
102 changed files with 1675 additions and 1117 deletions
+10 -8
View File
@@ -1,5 +1,5 @@
// 奇遇题库
import {readJsonFile} from '../util'
import {readFileAndParse} from '../util'
import { FILENAME } from '../../consts'
export interface DicQuestion {
@@ -14,15 +14,17 @@ export interface DicQuestion {
}
const str = readJsonFile(FILENAME.DIC_QUESTION);
let arr = JSON.parse(str);
export const dicQuestion = new Map<number, DicQuestion>();
export function loadQuestion() {
arr.forEach(o => {
o.answer = parseAnswer(o.a1, o.a2, o.a3, o.a4)
dicQuestion.set(o.id, o);
});
let arr = readFileAndParse(FILENAME.DIC_QUESTION);
arr.forEach(o => {
o.answer = parseAnswer(o.a1, o.a2, o.a3, o.a4)
dicQuestion.set(o.id, o);
});
arr = undefined;
}
function parseAnswer(a1: string, a2: string, a3: string, a4: string) {
let answer = new Array<string>();