Commit d3667fa1 authored by Chen Jiping's avatar Chen Jiping

添加缺省值

parent 9c455268
......@@ -447,8 +447,30 @@ export class PlayComponent implements OnInit, OnDestroy {
* 添加默认数据 便于无数据时的展示
*/
initDefaultData() {
const getDefaultExercisesItem = () => {
const exercises = {
text: 'Lion',
index: '',
audio_url: '',
index_audio_url: ''
};
return exercises;
}
if (!this.data.title) {
this.data.title = getDefaultTile();
if (!this.data.exercisesArr) {
this.data.exercisesArr = [];
for (let i = 0; i < 9; ++i) {
let exer = getDefaultExercisesItem();
exer.index = "" + 1 + i;
this.data.exercisesArr.push(exer);
}
}
}
//设置默认皮肤
......@@ -775,7 +797,7 @@ export class PlayComponent implements OnInit, OnDestroy {
if (exercisesObj.indexShowed) {
this.curAudio = exercisesObj.playAudio('I');
}
else{
else {
this.curAudio = exercisesObj.playAudio('T');
}
}
......
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