Commit 235d5aa0 authored by 李维's avatar 李维

添加核心词、高频词、学习字母显示

parent ce1a1fd0
......@@ -45,11 +45,17 @@ export default class NewClass extends cc.Component {
content: cc.Node = null;
@property(cc.Label)
storyWord: cc.Label = null;
storyWordLabel: cc.Label = null;
@property(cc.Label)
storyScentence: cc.Label = null;
storyLetterLabel: cc.Label = null;
@property(cc.Label)
storyStory: cc.Label = null;
storyKeyWordLabel: cc.Label = null;
@property(cc.Label)
storyHFWordLabel: cc.Label = null;
@property(cc.Label)
storyScentenceLabel: cc.Label = null;
@property(cc.Label)
storyStoryLabel: cc.Label = null;
@property(cc.ScrollView)
reportSV: cc.ScrollView = null;
......@@ -57,8 +63,14 @@ export default class NewClass extends cc.Component {
@property(cc.Node)
nd_storyWord: cc.Node = null;
@property(cc.Node)
nd_storyLetter: cc.Node = null;
@property(cc.Node)
nd_storyKeyWord: cc.Node = null;
@property(cc.Node)
nd_storySentence: cc.Node = null;
@property(cc.Node)
nd_storyHFWord: cc.Node = null;
@property(cc.Node)
nd_storyStory: cc.Node = null;
// LIFE-CYCLE CALLBACKS:
......@@ -91,18 +103,13 @@ export default class NewClass extends cc.Component {
});
const lastDate = _data.last_play ? new Date(_data.last_play) : null;
const studyDuration = _data.study_duration
this.title.string = _data.name
this.unit.string = _data.unitName
this.last_play.string = lastDate ? `${dateFormate("yyyy.MM.dd", lastDate)} 学习过` : "未学过"
this.last_play.string = lastDate ? `${dateFormate("yyyy.MM.dd", lastDate)} 学习过` : "未学过1"
this.question_right_percent1.string = _data.question_right_percent // 正确率 - 白色描边
this.question_right_percent2.string = _data.question_right_percent // 正确率 - 主体红字
this.study_duration.string = _data.study_duration > 999 ? Math.floor(_data.study_duration / 60 * 10) / 10 : _data.study_duration // 学习时长
this.study_duration_unit.string = _data.study_duration > 999 ? "小时" : "分钟";
this.question_times.string = _data.question_times // 练习次数
this.record_times.string = _data.record_times // 开口次数
......@@ -122,28 +129,55 @@ export default class NewClass extends cc.Component {
// 句子
if (_data.knowledge) {
// 学习单词
if (_data.knowledge.word) {
this.storyWord.string = _data.knowledge.word
this.storyWordLabel.string = _data.knowledge.word
this.nd_storyWord.active = true
} else {
this.nd_storyWord.active = false
}
// 学习字母
if (_data.knowledge.letter) {
this.storyLetterLabel.string = _data.knowledge.letter
this.nd_storyLetter.active = true
} else {
this.nd_storyLetter.active = false
}
// 核心词汇
if (_data.knowledge.core_word) {
this.storyKeyWordLabel.string = _data.knowledge.core_word
this.nd_storyKeyWord.active = true
} else {
this.nd_storyKeyWord.active = false
}
// 高频词汇
if (_data.knowledge.high_frequency_word) {
this.storyHFWordLabel.string = _data.knowledge.high_frequency_word
this.nd_storyHFWord.active = true
} else {
this.nd_storyHFWord.active = false
}
// 学习句子
if (_data.knowledge.sentence) {
this.storyScentence.string = _data.knowledge.sentence
this.storyScentenceLabel.string = _data.knowledge.sentence
this.nd_storySentence.active = true
} else {
this.nd_storySentence.active = false
}
// 故事梗概
if (_data.knowledge.story) {
this.storyStory.string = _data.knowledge.story
this.storyStoryLabel.string = _data.knowledge.story
this.nd_storyStory.active = true
} else {
this.nd_storyStory.active = false
}
if (!_data.knowledge.word &&
!_data.knowledge.sentence &&
!_data.knowledge.story) {
if (!_data.knowledge.word && !_data.knowledge.sentence && !_data.knowledge.story) {
this.storyItem.active = false
} else {
this.storyItem.active = true
......@@ -185,6 +219,7 @@ export default class NewClass extends cc.Component {
});
})
})
btn_play.on("click", () => {
if (!v.record_url) return
this.stopAudio()
......
......@@ -122,13 +122,13 @@ export default class NewClass extends cc.Component {
const { code, msg, results } = await asyncCallNetworkApiGet(`/api/kyxq/v1/user/course/report`, { syllabusid: this.node["pData"].id })
if (code != '200') {
// 当前没有数据不显示按钮
this.btn_report.active = false
this.btn_report.active = false;
} else {
this.btn_report.active = true
this.btn_report.active = true;
this.reportData = results
}
} else {
this.btn_report.active = false
this.btn_report.active = false;
}
}
......@@ -197,7 +197,6 @@ export default class NewClass extends cc.Component {
}
initCustomBg(bg_image_url) {
console.log("Iniit", bg_image_url)
if (!bg_image_url) {
// 没有背景图 还原默认图
cc.find("bg/bg_default", this.node).active = true;
......
......@@ -28,8 +28,8 @@
"rawHeight": 43,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"borderLeft": 20,
"borderRight": 20,
"subMetas": {}
}
}
......
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