Commit 9b3584a0 authored by limingzhe's avatar limingzhe

fix: debug

parent 642da394
...@@ -585,19 +585,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -585,19 +585,19 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
const ipa = targetRow[1].replace(/"/g, ''); const ipa = targetRow[1].replace(/"/g, '');
const zh_cn = targetRow[3].replace(/"/g, ''); const zh_cn = targetRow[3].replace(/"/g, '');
const pos = targetRow[4].replace(/"/g, ''); const pos = targetRow[4].replace(/"/g, '');
ques.word = word; ques.word = word;
ques.ipa = ipa; ques.ipa = ipa;
ques.zh_cn = zh_cn; ques.zh_cn = zh_cn;
ques.pos = pos; ques.pos = pos;
console.log("word: " , word);
console.log("ipa: " , ipa);
console.log("zh_cn: " , zh_cn);
console.log("pos: " , pos);
console.log("targetRow: " , targetRow); console.log("word: ", word);
console.log("ipa: ", ipa);
console.log("zh_cn: ", zh_cn);
console.log("pos: ", pos);
console.log("targetRow: ", targetRow);
this.refresh(); this.refresh();
}; };
...@@ -644,7 +644,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -644,7 +644,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
const ipa = targetRow[1].replace(/"/g, ''); const ipa = targetRow[1].replace(/"/g, '');
const zh_cn = targetRow[3].replace(/"/g, ''); const zh_cn = targetRow[3].replace(/"/g, '');
const pos = targetRow[4].replace(/"/g, ''); const pos = targetRow[4].replace(/"/g, '');
ques.word = word.split('').join(' '); ques.word = word.split('').join(' ');
...@@ -657,7 +657,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -657,7 +657,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// ques.ipa = ipa; // ques.ipa = ipa;
// ques.zh_cn = zh_cn; // ques.zh_cn = zh_cn;
// ques.pos = pos; // ques.pos = pos;
// console.log("word: " , word); // console.log("word: " , word);
// console.log("ipa: " , ipa); // console.log("ipa: " , ipa);
// console.log("zh_cn: " , zh_cn); // console.log("zh_cn: " , zh_cn);
...@@ -667,7 +667,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -667,7 +667,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
this.refresh(); this.refresh();
}; };
reader.readAsText(textFile); reader.readAsText(textFile);
...@@ -681,18 +681,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -681,18 +681,18 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// 听写 // 听写
this.addOnePageBtnClick(false);
var curQues = this.item.quesArr[this.item.quesArr.length - 1];
curQues.type = 'dictation'; this.addOnePageBtnClick(false);
curQues.title = 'Listen. Write down the word on your note book.'; var curQues = this.item.quesArr[this.item.quesArr.length - 1];
const optionArr = []; curQues.type = 'dictation';
curQues.title = 'Listen. Write down the word on your note book.';
const optionArr = [];
for (let i = 0; i < this.wordDataArr.length; i++) {
for (let i = 0; i < this.wordDataArr.length; i++) {
const textFile = this.wordDataArr[i].textFile; const textFile = this.wordDataArr[i].textFile;
const audioFile = this.wordDataArr[i].audioFile; const audioFile = this.wordDataArr[i].audioFile;
...@@ -712,12 +712,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -712,12 +712,12 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
// const ipa = targetRow[1].replace(/"/g, ''); // const ipa = targetRow[1].replace(/"/g, '');
// const zh_cn = targetRow[3].replace(/"/g, ''); // const zh_cn = targetRow[3].replace(/"/g, '');
// const pos = targetRow[4].replace(/"/g, ''); // const pos = targetRow[4].replace(/"/g, '');
option['text'] = word; option['text'] = word;
}; };
reader.readAsText(textFile); reader.readAsText(textFile);
optionArr.push(option); optionArr.push(option);
} }
...@@ -761,7 +761,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -761,7 +761,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
if (_rightData) { if (_rightData) {
option = _rightData; option = _rightData;
} else { } else {
const randomIndex = Math.floor( Math.random() * copyData.length ); const randomIndex = Math.floor(Math.random() * copyData.length);
option = copyData[randomIndex]; option = copyData[randomIndex];
copyData.splice(randomIndex, 1); copyData.splice(randomIndex, 1);
} }
...@@ -782,19 +782,25 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -782,19 +782,25 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
const zh_cn = targetRow[3].replace(/"/g, ''); const zh_cn = targetRow[3].replace(/"/g, '');
const pos = targetRow[4].replace(/"/g, ''); const pos = targetRow[4].replace(/"/g, '');
const oneOption = { const oneOption = {
text: quesData.selectType == 'en' ? zh_cn : word, text: quesData.selectType == 'en' ? zh_cn : word,
answer: _rightData ? 'isRight' : 'isWrong' answer: _rightData ? 'isRight' : 'isWrong'
}; };
if (quesData.selectType != 'en') { if (quesData.selectType != 'en') {
oneOption['audio_url'] = audioFile?.response?.url || ''; oneOption['audio_url'] = audioFile?.response?.url || '';
} }
optionArr.push( optionArr.push(
oneOption oneOption
) )
for (let i = optionArr.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
[optionArr[i], optionArr[j]] = [optionArr[j], optionArr[i]]; // 使用ES6的解构赋值进行交换
}
this.refresh(); this.refresh();
}; };
...@@ -817,7 +823,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy { ...@@ -817,7 +823,7 @@ export class FormComponent implements OnInit, OnChanges, OnDestroy {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment