Commit 313a18ae authored by limingzhe's avatar limingzhe

fix: 陪跑营 退出提示 加载提示

parent fe51cefa
......@@ -59,8 +59,11 @@ export default class NewClass extends middleLayerBase {
this.course_id = bundleInfo.course_id;
this.courseware_id = bundleInfo.courseware_id;
if (bundleInfo.homework_id != null && bundleInfo.syllabus_id != null && bundleInfo.user_id != null) {
this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id, bundleInfo.user_id);
this.setCurHomeworkData( bundleInfo.homework_id, bundleInfo.syllabus_id, bundleInfo.user_id);
this.initExitPanel();
this.initNetworkLoading();
}
cc.sys.localStorage.setItem('student_token', bundleInfo.token);
console.log("student_token 1: ", bundleInfo.token);
......@@ -115,6 +118,53 @@ export default class NewClass extends middleLayerBase {
this.showBackBtn();
}
initExitPanel() {
const exitPanel = cc.find('middleLayer/UI/exit_panel');
exitPanel.active = false;
const exitBtn = cc.find('middleLayer/UI/exit_panel/bg/btn_exit');
exitBtn.on(cc.Node.EventType.TOUCH_END, () => {
exitPanel.active = false;
this.curHomeworkId = null;
this.curSyllabusId = null;
this.curUserId = null;
this.exitGame();
});
const cancelBtn = cc.find('middleLayer/UI/exit_panel/bg/btn_cancel');
cancelBtn.on(cc.Node.EventType.TOUCH_END, () => {
exitPanel.active = false;
});
}
initNetworkLoading() {
const networkLoading = cc.find('middleLayer/UI/network_loading');
networkLoading.active = false;
const icon = cc.find('middleLayer/UI/network_loading/icon');
icon.active = true;
// 创建一个永久旋转的动画
cc.tween(icon)
.by(2, { angle: -360 }) // 逆时针旋转360度
.repeatForever() // 无限重复
.start();
}
showNetworkLoading() {
const networkLoading = cc.find('middleLayer/UI/network_loading');
networkLoading.active = true;
}
hideNetworkLoading() {
const networkLoading = cc.find('middleLayer/UI/network_loading');
setTimeout(() => {
networkLoading.active = false;
}, 2000);
}
showBackBtn() {
const backBtn = cc.find("middleLayer/UI/back_btn");
backBtn.active = true;
......@@ -153,10 +203,23 @@ export default class NewClass extends middleLayerBase {
});
}
showExitPanel() {
const exitPanel = cc.find('middleLayer/UI/exit_panel');
exitPanel.active = true;
}
exitGame(data = null) {
console.log(' in exitGame data: ', data);
console.log(' this.token: ', this.token);
if (this.curHomeworkId != null) {
this.showExitPanel();
return;
}
// if (this.node) {
// cc.game.removePersistRootNode(this.node);
......@@ -368,6 +431,8 @@ export default class NewClass extends middleLayerBase {
console.log(' curHomeworkId : ' + this.curHomeworkId);
console.log(' curSyllabusId : ' + this.curSyllabusId);
this.showNetworkLoading();
this.callNetworkApiPostNew(`v1/learning-camp/finish/${this.curUserId}/${this.curHomeworkId}`, {
"id": this.curHomeworkId,
"useTime": 10,
......@@ -375,6 +440,8 @@ export default class NewClass extends middleLayerBase {
"accuracy": 1
}, res => {
this.hideNetworkLoading();
this.curSyllabusId = null;
this.curHomeworkId = null;
callback && callback(res);
......
{
"ver": "1.1.2",
"uuid": "01e90c71-7152-4175-906b-bbff2cb9df7f",
"isBundle": false,
"bundleName": "",
"priority": 1,
"compressionType": {},
"optimizeHotUpdate": {},
"inlineSpriteFrames": {},
"isRemoteBundle": {},
"subMetas": {}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "0c44d4a7-a9f1-4046-96d2-b8d64c2133c1",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 680,
"height": 372,
"platformSettings": {},
"subMetas": {
"bg": {
"ver": "1.0.4",
"uuid": "bce536e3-fafb-45a0-9f06-b76b5d8af485",
"rawTextureUuid": "0c44d4a7-a9f1-4046-96d2-b8d64c2133c1",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 680,
"height": 372,
"rawWidth": 680,
"rawHeight": 372,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "650a2302-c250-47ad-bf3f-ef3373dd863f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 10,
"height": 10,
"platformSettings": {},
"subMetas": {
"black": {
"ver": "1.0.4",
"uuid": "1c01289b-2f21-401f-b317-b2909b9d4442",
"rawTextureUuid": "650a2302-c250-47ad-bf3f-ef3373dd863f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 10,
"height": 10,
"rawWidth": 10,
"rawHeight": 10,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "a473e0ff-27f3-4009-bf58-237a7eb223ba",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 244,
"height": 96,
"platformSettings": {},
"subMetas": {
"btn_blue": {
"ver": "1.0.4",
"uuid": "e82134cd-0507-4231-88ff-2f689e47b7d2",
"rawTextureUuid": "a473e0ff-27f3-4009-bf58-237a7eb223ba",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 244,
"height": 96,
"rawWidth": 244,
"rawHeight": 96,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "d882e28c-d9ff-48dc-aca3-60f2de2e308e",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 244,
"height": 96,
"platformSettings": {},
"subMetas": {
"btn_red": {
"ver": "1.0.4",
"uuid": "ea12cde9-b60e-4e61-b0ac-0cae49816317",
"rawTextureUuid": "d882e28c-d9ff-48dc-aca3-60f2de2e308e",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 244,
"height": 96,
"rawWidth": 244,
"rawHeight": 96,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "873e0fd9-1e00-4dab-a3fb-7fa2982a1e25",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 182,
"height": 182,
"platformSettings": {},
"subMetas": {
"loading": {
"ver": "1.0.4",
"uuid": "6e74838e-6177-4adf-8a37-def1f71ed598",
"rawTextureUuid": "873e0fd9-1e00-4dab-a3fb-7fa2982a1e25",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 2,
"trimY": 2,
"width": 178,
"height": 178,
"rawWidth": 182,
"rawHeight": 182,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "8b893da8-bd2f-46e8-aea3-a57676d98f3f",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 69,
"height": 35,
"platformSettings": {},
"subMetas": {
"txt_cancel": {
"ver": "1.0.4",
"uuid": "3ba61ddc-dfa0-4889-94b2-249fa136d6e8",
"rawTextureUuid": "8b893da8-bd2f-46e8-aea3-a57676d98f3f",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 69,
"height": 35,
"rawWidth": 69,
"rawHeight": 35,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "168085f0-7b9c-4aae-8c38-eb5b7a9c8424",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 70,
"height": 34,
"platformSettings": {},
"subMetas": {
"txt_exit": {
"ver": "1.0.4",
"uuid": "44f9d8b0-dc56-4a8f-baed-6ab4d0d3020d",
"rawTextureUuid": "168085f0-7b9c-4aae-8c38-eb5b7a9c8424",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 70,
"height": 34,
"rawWidth": 70,
"rawHeight": 34,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "6474d046-7d75-4220-a9fd-61aa1d9b9af2",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 313,
"height": 31,
"platformSettings": {},
"subMetas": {
"txt_tip": {
"ver": "1.0.4",
"uuid": "122e6ed5-e311-4340-b3c5-6afa972b473e",
"rawTextureUuid": "6474d046-7d75-4220-a9fd-61aa1d9b9af2",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 313,
"height": 31,
"rawWidth": 313,
"rawHeight": 31,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
{
"ver": "2.3.5",
"uuid": "3d705e25-b74d-4096-a189-8dce3644ca72",
"type": "sprite",
"wrapMode": "clamp",
"filterMode": "bilinear",
"premultiplyAlpha": false,
"genMipmaps": false,
"packable": true,
"width": 539,
"height": 39,
"platformSettings": {},
"subMetas": {
"txt_title": {
"ver": "1.0.4",
"uuid": "96e1088f-571a-4992-8f9d-ae34dea803f2",
"rawTextureUuid": "3d705e25-b74d-4096-a189-8dce3644ca72",
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 539,
"height": 39,
"rawWidth": 539,
"rawHeight": 39,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"subMetas": {}
}
}
}
\ No newline at end of file
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