Commit 1ef72cc6 authored by liujiangnan's avatar liujiangnan

feat: 个人中心所有数据

parent 0bb49d32
......@@ -33,6 +33,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
await this.initSpeakInfo();
await this.initKnowledgeInfo();
await this.drawChart();
await this.drawLearnProcess();
this.initBg();
this.initListener();
}
......@@ -68,6 +69,12 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find("nickname", usercenter).getComponent(cc.Label).string = userInfo.nick_name || "";
// 日历牌
cc.find("learndate", usercenter).getComponent(cc.Label).string = this.getFomartDate();
// 当前学习进度
if (userInfo.last_game_str){
const gameNames = userInfo.last_game_str.split("~!");
cc.find("learning", usercenter).getComponent(cc.RichText).string = `<color=#138977>当前正在学习</c> <color=#ef8d36>${gameNames[0]} - ${gameNames[1]}</color>`;
}
}
// 学习小结
......@@ -201,6 +208,42 @@ export default class SceneComponent extends MyCocosSceneComponent {
chart_line.stroke();
}
async drawLearnProcess() {
if (!this.userInfo) {
return;
}
const draw = async (type) => {
const pdtd: any = await asyncCallNetworkApiGet(`/api/oxford/v1/kid/learn/${type}/process`, { kidid: this.userInfo.id, token: this.token });
const resProcess = JSON.parse(pdtd).data;
const typeNode = cc.find(`Canvas/usercenter/view/content/scollpage/${type}_node/typebg`);
// 现在规定死5个级别
for (let i = 1; i <= 5; i++) {
const prcss = resProcess[i];
if(prcss) {
cc.find(`L${i}/percent`, typeNode).getComponent(cc.Label).string = prcss.process + "%";
const maxLen = cc.find(`L${i}`, typeNode).width
cc.find(`L${i}/processlan`, typeNode).width = Math.floor(maxLen * prcss.process / 100);
}else {
console.log(`L${i}/processlan`);
console.log(cc.find(`L${i}/processlan`, typeNode));
cc.find(`L${i}/percent`, typeNode).getComponent(cc.Label).string = "0%";
cc.find(`L${i}/processlan`, typeNode).width = 0;
}
}
}
// 拼读天地
await draw("pdtd");
// 趣问趣答
await draw("qwqd");
// 阅读加油站
await draw("ydjyz");
}
initBg() {
const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax;
......
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