Commit f144d97b authored by liujiangnan's avatar liujiangnan

feat: 录音报告展示

parent 1c7443f4
......@@ -41,7 +41,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initData() {
const middleLayer = cc.find('middleLayer');
if (!middleLayer) {
cc.sys.localStorage.setItem('token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicGhvbmUiOiIxNTUwMDAwMDAwMSIsInNpZ24iOiJmYWYxMzkxZi1iYzk4LTQ1ZjUtYmNjOC1mYjIxZmIyYTY3MmMiLCJpYXQiOjE2NTQ2Njk5OTgsImV4cCI6MTY1NzI2MTk5OH0.4UtU-6XFVgPjvSvlwHLZ74WW6Gqk_n7X5zJvtVEyq_c');
cc.sys.localStorage.setItem('token', 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6NCwicGhvbmUiOiIxNTUwMDAwMDAwMSIsInNpZ24iOiI3MjhlYzkwZC1kZmIyLTQxMzktOWMyMS0yNGQwZjg4NDYwMmUiLCJpYXQiOjE2NTU3MDY4MjUsImV4cCI6MTY1ODI5ODgyNX0.Rkhjn9MJxXAOoHnjBzjdCcLBtE-87ps5790SIdYQrZE');
}
this.token = cc.sys.localStorage.getItem("token");
}
......
import { asyncDelay, asyncCallNetworkApiGet, getSpriteFrimeByUrl } from "./util";
import { asyncDelay, asyncCallNetworkApiGet, getSpriteFrimeByUrl, playAudioByUrl } from "./util";
const { ccclass, property } = cc._decorator;
const levels = {
......@@ -197,6 +197,14 @@ export default class NewClass extends cc.Component {
sentenceItem.parent = node;
sentenceRow.removeAllChildren();
sentenceItem.parent = sentenceRow;
// 录音
const tips = cc.find("tips_bg", contentNode);
const row = cc.find("row", tips);
row.parent = node;
tips.removeAllChildren();
row.parent = tips;
}
async onShowLearnDetail(evt: cc.Event) {
......@@ -219,11 +227,13 @@ export default class NewClass extends cc.Component {
recordcount,
kn_letters,
kn_words,
kn_sentences
kn_sentences,
OP05,
OP_06_3
} = JSON.parse(res).data;
cc.find("Canvas/reportdetail/view/content/userdetail_scollpage/learnshow/itembg/recordbg/recordcount").getComponent(cc.Label).string = learntimes;
cc.find("Canvas/reportdetail/view/content/userdetail_scollpage/learnshow/itembg/learnbg/learntime").getComponent(cc.Label).string = recordcount;
cc.find("Canvas/reportdetail/view/content/userdetail_scollpage/learnshow/itembg/recordbg/recordcount").getComponent(cc.Label).string = recordcount;
cc.find("Canvas/reportdetail/view/content/userdetail_scollpage/learnshow/itembg/learnbg/learntime").getComponent(cc.Label).string = learntimes;
const resultNode = cc.find("Canvas/reportdetail/view/content/userdetail_scollpage/learnresult/itembg");
......@@ -298,6 +308,25 @@ export default class NewClass extends cc.Component {
cc.find("split_line", resultNode).active = false;
}
if (OP05) {
const rowData = JSON.parse(OP05).result;
const tips = cc.find("tips_bg", resultNode);
const row = cc.find("row", tips);
for (let i = 0; i < rowData.length; i++) {
const {word, score, audio_url} = rowData[i];
const itemClone = cc.instantiate(row);
itemClone.parent = tips;
itemClone.active = true;
cc.find("item1/word", itemClone).getComponent(cc.Label).string = word;
cc.find("item3/goodjob", itemClone).active = (score >= 80);
cc.find("item2/play_icon", itemClone).attr({audio_url});
}
} else {
cc.find(`Canvas/reportdetail/view/content/userdetail_scollpage/learnresult/itembg/tips_bg/row`).active = false;
}
// 设置页面高度
this.scheduleOnce(() => {
const learnresult = cc.find(`Canvas/reportdetail/view/content/userdetail_scollpage/learnresult`);
......@@ -322,7 +351,10 @@ export default class NewClass extends cc.Component {
const animationState = playNode.getComponent(cc.Animation).getAnimationState("play1");
animationState.wrapMode = cc.WrapMode.Loop;
animationState.play();
playAudioByUrl(node.audio_url, () => {
animationState.stop();
playNode.active = false;
})
}
......
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