后台:json上传
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user