Commit 883aeb66 authored by liujiangnan's avatar liujiangnan

feat: 主界面适配

parent 28e00509
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -147,13 +147,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -147,13 +147,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
cc.find("sentencecount", smallbg_2_right).getComponent(cc.RichText).string = `<color=#41954F>${this.sentencecount}</c> <color=#726E6F><size=15>个</size></c>`; cc.find("sentencecount", smallbg_2_right).getComponent(cc.RichText).string = `<color=#41954F>${this.sentencecount}</c> <color=#726E6F><size=15>个</size></c>`;
} }
learntimes = [0, 0, 25, 50, 99, 73, 8]; learntimes = [0, 0, 0, 0, 0, 0, 0];
learntotal = 0; learntotal = 0;
average = 0; average = 0;
async drawChart() { async drawChart() {
if (!this.userInfo) { if (!this.userInfo) {
return; return;
} }
const res: any = await asyncCallNetworkApiGet("/api/oxford/v1/kid/learn/chart", { kidid: this.userInfo.id, token: this.token }); const res: any = await asyncCallNetworkApiGet("/api/oxford/v1/kid/learn/chart", { kidid: this.userInfo.id, token: this.token });
const chartInfo = JSON.parse(res).data; const chartInfo = JSON.parse(res).data;
if (chartInfo) { if (chartInfo) {
...@@ -164,6 +165,14 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -164,6 +165,14 @@ export default class SceneComponent extends MyCocosSceneComponent {
const linebg = cc.find("Canvas/usercenter/view/content/scollpage/linebg"); const linebg = cc.find("Canvas/usercenter/view/content/scollpage/linebg");
cc.find("textbg/desc", linebg).getComponent(cc.RichText).string = `<color=#726E6F>累计学习时长</c><color=#41954F><size=30> ${this.learntotal} </size></c><color=#726E6F>分钟</c>,<color=#726E6F>平均每日学习</c><color=#41954F><size=30> ${this.average} </size></c><color=#726E6F>分钟</c>`; cc.find("textbg/desc", linebg).getComponent(cc.RichText).string = `<color=#726E6F>累计学习时长</c><color=#41954F><size=30> ${this.learntotal} </size></c><color=#726E6F>分钟</c>,<color=#726E6F>平均每日学习</c><color=#41954F><size=30> ${this.average} </size></c><color=#726E6F>分钟</c>`;
// 清理之前的点
for (let i = 1; i < 8; i++) {
const beforeDot = cc.find(`dot_${i}`, linebg);
if(beforeDot) {
linebg.removeChild(beforeDot);
}
}
const dotHide = cc.find("dothide", linebg); const dotHide = cc.find("dothide", linebg);
const xAxis = cc.find("xline", linebg); const xAxis = cc.find("xline", linebg);
...@@ -206,6 +215,7 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -206,6 +215,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
} }
const dotClone = cc.instantiate(dotHide); const dotClone = cc.instantiate(dotHide);
dotClone.parent = linebg; dotClone.parent = linebg;
dotClone.name = `dot_${i}`;
cc.find("pop/text", dotClone).getComponent(cc.Label).string = `${value}分钟`; cc.find("pop/text", dotClone).getComponent(cc.Label).string = `${value}分钟`;
dotClone.setPosition(xNode.parent.x, itemLen * value + baseY); dotClone.setPosition(xNode.parent.x, itemLen * value + baseY);
dotClone.active = true; dotClone.active = true;
...@@ -251,8 +261,11 @@ export default class SceneComponent extends MyCocosSceneComponent { ...@@ -251,8 +261,11 @@ export default class SceneComponent extends MyCocosSceneComponent {
const bgNode = cc.find('Canvas/bg'); const bgNode = cc.find('Canvas/bg');
bgNode.scale = this._mapScaleMax; bgNode.scale = this._mapScaleMax;
// const reportNode = cc.find('Canvas/learnreport'); // 设置界面大小
// reportNode.scale = this._mapScaleMax; const bottomItem = cc.find(`Canvas/usercenter/view/content/scollpage/ydjyz_node`);
cc.find(`Canvas/usercenter/view/content`).height = Math.abs(bottomItem.y) + 400;
cc.find(`Canvas/usercenter/view/content/scollpage`).height = Math.abs(bottomItem.y) + 400;
cc.find(`Canvas/usercenter/view/content/scollpage/bg`).height = Math.abs(bottomItem.y) + 400;
} }
// update (dt) {} // update (dt) {}
......
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