Commit 429ec53a authored by zhangjinzhou's avatar zhangjinzhou

分页暂存

parent 6cdb0879
...@@ -82,6 +82,7 @@ import HelpBloodPanel from "../../src/panels/help/HelpBloodPanel"; ...@@ -82,6 +82,7 @@ import HelpBloodPanel from "../../src/panels/help/HelpBloodPanel";
import HelpInvitePanel from "../../src/panels/help/HelpInvitePanel"; import HelpInvitePanel from "../../src/panels/help/HelpInvitePanel";
import HelpScratchPanel from "../../src/panels/help/HelpScratchPanel"; import HelpScratchPanel from "../../src/panels/help/HelpScratchPanel";
import HelpInvitePanel2 from "../../src/panels/help/HelpInvitePanel2"; import HelpInvitePanel2 from "../../src/panels/help/HelpInvitePanel2";
import levelHomeData from "../../src/levelHomeData";
export default class MainBase extends eui.UILayer { export default class MainBase extends eui.UILayer {
constructor() { constructor() {
...@@ -610,6 +611,10 @@ export default class MainBase extends eui.UILayer { ...@@ -610,6 +611,10 @@ export default class MainBase extends eui.UILayer {
window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) }; window['getaward'] = () => { getRedBombAward((param) => { console.log(param) }) };
localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次 localStorage.setItem('taskCenter' + window['CFG'].consumerId, 'true'); // 任务中心强提示,每次进入游戏只强提示一次
await this.hcHome(); await this.hcHome();
let playerlevel = getHomeData().playerlevel;
console.error("玩家level===>",playerlevel);
await levelHomeData.initMapLevelData();
console.log("获取到玩家level数据==>");
await Promise.all([ await Promise.all([
// this.getAd(), // this.getAd(),
this.ajaxElement(), this.ajaxElement(),
......
...@@ -2605,4 +2605,20 @@ export class NetManager extends ABNetManager { ...@@ -2605,4 +2605,20 @@ export class NetManager extends ABNetManager {
}; };
this.send(net); this.send(net);
} }
public hc_levelhome(callback: Function, pageNo:Number,pageSize:Number): void {
const net: INetData = {
name: 'hc_levelhome',
uri: window['duiba'] + '/customActivity/happyclear/findConsumerRecords',
type: 'get',
dataType: 'json',
param: {
activityId: DataManager.ins.customCfgData.actId,
pageNo:pageNo,
pageSize:pageSize
},
callback: callback
};
this.send(net);
}
} }
\ No newline at end of file
...@@ -9,7 +9,7 @@ class FriendWxShare extends ComponentBase { ...@@ -9,7 +9,7 @@ class FriendWxShare extends ComponentBase {
start(rank) { start(rank) {
const data = getHomeData(); const data = getHomeData();
this['ranktxt'].text =`我在好友中排名第${rank}`; this['ranktxt'].text =`我在好友中排名第${rank}`;
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['avatar'].mask = this['avatarMask']; this['avatar'].mask = this['avatarMask'];
const { data: user } = DataManager.ins.getData('hc_userInfo'); const { data: user } = DataManager.ins.getData('hc_userInfo');
this['avatar'].source = user.avatar; this['avatar'].source = user.avatar;
......
import { DataManager } from "../libs/tw/manager/DataManager"; import { DataManager } from "../libs/tw/manager/DataManager";
interface IHomeData { interface IHomeData {
levels:{levelNum,maxScore,stars}[]; // levels:{levelNum,maxScore,stars}[];
playerlevel:number;
totalStars; totalStars;
canReceiveTreasureBoxNum; canReceiveTreasureBoxNum;
isGetAllTreasureBox; isGetAllTreasureBox;
......
...@@ -7,7 +7,7 @@ import { DataManager } from "../libs/tw/manager/DataManager"; ...@@ -7,7 +7,7 @@ import { DataManager } from "../libs/tw/manager/DataManager";
class Share extends ComponentBase { class Share extends ComponentBase {
start() { start() {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length ==0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel ==0 ? 1 : data.playerlevel;
} }
get skinKey() { return 'Share' } get skinKey() { return 'Share' }
......
...@@ -5,7 +5,7 @@ class ShowOff extends ComponentBase { ...@@ -5,7 +5,7 @@ class ShowOff extends ComponentBase {
pic; pic;
start() { start() {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length; this['lvTxt'].text = data.playerlevel;
this['tipsTxt'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`; this['tipsTxt'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`;
} }
......
import { NetManager } from "../libs/tw/manager/NetManager";
import getHomeData from "./getHomeData";
import MapBottomPart from "./mapScene/MapBottomPart";
import MapRpeatPart from "./mapScene/MapRpeatPart";
import MapTopPart from "./mapScene/MapTopPart";
export default class levelHomeData {
static leveldata = {};
static getlevelData(idx) {
if (this.leveldata[idx]) {
return this.leveldata[idx].stars;
} else {
console.error("未取到对应数据===》", idx);
return 1;
}
}
static async getPageLevelData(idx, pagesize = 30) {
return new Promise((r) => {
let playerlevel = getHomeData().playerlevel;
if(idx>playerlevel){
return r();
}
let chalevel = playerlevel - idx;
let pageno = Math.floor(chalevel / pagesize);
let startidx = playerlevel - pageno * pagesize;
let endidx = startidx - pagesize;
if (endidx < 0) {
endidx = 0;
}
let shouldget = false;
for (let i1 = endidx+1; i1 < startidx; i1++) {
if (!this.leveldata[i1]) {
// console.log("33",this.leveldata[i1],this.leveldata,i1);
shouldget = true;
break;
}
}
if (!shouldget) {
// console.error("已存在,不必请求");
return r();
}else{
// console.error("还需要请求=====》",endidx,startidx,idx,this.leveldata);
}
NetManager.ins.hc_levelhome((s, data) => {
// console.error("hc_levelhome",s,data);
if (s) {
if (data && data.data) {
let levels = data.data;
let levelsleng = levels.length - 1;
let j=0;
for (let i = levelsleng; i > -1; i--) {
let idata = levels[i];
this.leveldata[startidx-j] = idata;
j++;
}
}
// console.error("请求一次page", pageno);
// console.log("获取levelData===>", this.leveldata.length, pageno);
}
r();
}, pageno, pagesize);
return;
})
}
static updateLevelData(idx, pagesize = 30) {
let playerlevel = getHomeData().playerlevel;
let chalevel = playerlevel-idx;
let pageno = Math.floor(chalevel/pagesize);
let startidx = playerlevel-pageno*pagesize;
NetManager.ins.hc_levelhome((s,data)=>{
if(s){
if(data&&data.data){
let levels = data.data;
let levelsleng = levels.length-1;
let j=0;
for(let i=levelsleng;i>-1;i--){
let idata = levels[i];
this.leveldata[startidx-j]=idata;
j++;
}
}
}
},pageno,pagesize);
return;
// let pageno = Math.ceil(idx / pagesize);
// let startidx = pagesize * (pageno - 1);
// NetManager.ins.hc_levelhome((s, data1) => {
// if (s) {
// let data = data1;
// if (data && data.data && data.data.levels) {
// let levels = data.data.levels;
// let levelsleng = levels.length - 1;
// for (let i = levelsleng; i > -1; i--) {
// let idata = levels[i];
// this.leveldata[i + startidx] = idata;
// }
// }
// }
// }, pageno, pagesize);
}
static async initMapLevelData() {
let playerlevel = getHomeData().playerlevel;
if(playerlevel>30){
if(playerlevel>60){
await this.getPageLevelData(8);
}
await this.getPageLevelData(playerlevel-30);
}
await this.getPageLevelData(playerlevel);
}
}
\ No newline at end of file
...@@ -125,6 +125,7 @@ import Food from '../something/class/Food'; ...@@ -125,6 +125,7 @@ import Food from '../something/class/Food';
import foodAni from '../something/anis/foodAni'; import foodAni from '../something/anis/foodAni';
import shuzhi from '../something/class/shuzhi'; import shuzhi from '../something/class/shuzhi';
import gamePool from '../configData/gamePool'; import gamePool from '../configData/gamePool';
import levelHomeData from '../levelHomeData';
const aniClass = { const aniClass = {
"BoomAni": BoomAni, "BoomAni": BoomAni,
...@@ -5185,6 +5186,9 @@ export default class MainScene extends Scene { ...@@ -5185,6 +5186,9 @@ export default class MainScene extends Scene {
}, 1300) }, 1300)
} }
} }
//更新地图关卡数据
levelHomeData.updateLevelData(this.chapter)
}, },
DataManager.ins.getData("hc_doJoin").data, DataManager.ins.getData("hc_doJoin").data,
this.chapter, this.chapter,
......
This diff is collapsed.
...@@ -64,12 +64,12 @@ export default class HbNoPrize extends Panel { ...@@ -64,12 +64,12 @@ export default class HbNoPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(60)); NetManager.ins.clickLog(getlogItem(60));
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -50,12 +50,12 @@ export default class HbNoPrize extends Panel { ...@@ -50,12 +50,12 @@ export default class HbNoPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(60)); NetManager.ins.clickLog(getlogItem(60));
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -94,12 +94,12 @@ export default class HbPrize extends Panel { ...@@ -94,12 +94,12 @@ export default class HbPrize extends Panel {
onTouchOK() { onTouchOK() {
NetManager.ins.clickLog(getlogItem(59)); NetManager.ins.clickLog(getlogItem(59));
if ((getHomeData().levels.length + 1) > window['last_level']) { if ((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
protected get closeBtns(): eui.Button[] { protected get closeBtns(): eui.Button[] {
......
...@@ -49,13 +49,13 @@ export default class InviteCutTimePanel extends Panel { ...@@ -49,13 +49,13 @@ export default class InviteCutTimePanel extends Panel {
} }
onTouchOK() { onTouchOK() {
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
initUI() { initUI() {
......
...@@ -50,13 +50,13 @@ export default class InvitePrizePanel extends Panel { ...@@ -50,13 +50,13 @@ export default class InvitePrizePanel extends Panel {
} }
onTouchOK() { onTouchOK() {
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
GDispatcher.dispatchEvent("getInviteInfo"); GDispatcher.dispatchEvent("getInviteInfo");
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} }
onTapGoPrize() { onTapGoPrize() {
......
...@@ -56,12 +56,12 @@ export default class ScratchPrizePanel extends Panel { ...@@ -56,12 +56,12 @@ export default class ScratchPrizePanel extends Panel {
window.location.href = window['__link__']; window.location.href = window['__link__'];
break; break;
case (e.target == this.game_btn): // 继续闯关 case (e.target == this.game_btn): // 继续闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
break; break;
default: default:
......
...@@ -44,7 +44,7 @@ export default class StartPanel extends Panel { ...@@ -44,7 +44,7 @@ export default class StartPanel extends Panel {
}, DataManager.ins.getData("getUserShareCode").data) }, DataManager.ins.getData("getUserShareCode").data)
} }
if(data > homedata.levels.length) { if(data > homedata.playerlevel) {
addAdComp(68, 890+10, this, 29); addAdComp(68, 890+10, this, 29);
NetManager.ins.showLog(getlogItem(29)); NetManager.ins.showLog(getlogItem(29));
} else } else
......
...@@ -32,12 +32,12 @@ export default class TaskCenterNoPrize extends Panel { ...@@ -32,12 +32,12 @@ export default class TaskCenterNoPrize extends Panel {
this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this.btn.addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(taskData.status == 1) { if(taskData.status == 1) {
// 去闯关 // 去闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} else { } else {
window.open(taskData.appIncompletelink); window.open(taskData.appIncompletelink);
super.hidePanel(); super.hidePanel();
......
...@@ -35,12 +35,12 @@ export default class TaskCenterPrize extends Panel { ...@@ -35,12 +35,12 @@ export default class TaskCenterPrize extends Panel {
if(taskData.status == 1) { if(taskData.status == 1) {
NetManager.ins.clickLog(getlogItem(66)); NetManager.ins.clickLog(getlogItem(66));
// 去闯关 // 去闯关
if((getHomeData().levels.length + 1) > window['last_level']) { if((getHomeData().playerlevel + 1) > window['last_level']) {
changeMapScene(); changeMapScene();
super.hidePanel(); super.hidePanel();
return; return;
} }
PanelCtrl.instance.show("StartPanel", getHomeData().levels.length + 1); PanelCtrl.instance.show("StartPanel", getHomeData().playerlevel + 1);
} else { } else {
window.location.href = taskData.appIncompletelink; window.location.href = taskData.appIncompletelink;
super.hidePanel(); super.hidePanel();
......
...@@ -7,7 +7,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl"; ...@@ -7,7 +7,7 @@ import PanelCtrl from "../../libs/new_wx/ctrls/panelCtrl";
export const gotoNextLevel = (currentLevel?) => { export const gotoNextLevel = (currentLevel?) => {
    if (!currentLevel) {     if (!currentLevel) {
        currentLevel = getHomeData().levels.length;         currentLevel = getHomeData().playerlevel;
    }     }
    const onMapScene = SceneCtrl.instance.currentScene instanceof MapScene;     const onMapScene = SceneCtrl.instance.currentScene instanceof MapScene;
......
...@@ -31,8 +31,8 @@ class Share2 extends ComponentBase { ...@@ -31,8 +31,8 @@ class Share2 extends ComponentBase {
const data = getHomeData(); const data = getHomeData();
this['tipsTxt0'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`; this['tipsTxt0'].text = `超过了${Math.ceil(Math.random() * 100)}%的好友`;
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['lvTxt0'].text = data.levels.length; this['lvTxt0'].text = data.playerlevel;
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if(iswx()) { //微信端 if(iswx()) { //微信端
......
...@@ -30,7 +30,7 @@ class Share3 extends ComponentBase { ...@@ -30,7 +30,7 @@ class Share3 extends ComponentBase {
const data = getHomeData(); const data = getHomeData();
this['lvTxt'].text = data.levels.length == 0 ? 1 : data.levels.length; this['lvTxt'].text = data.playerlevel == 0 ? 1 : data.playerlevel;
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => { this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
if (iswx()) { //微信端 if (iswx()) { //微信端
......
...@@ -210,6 +210,9 @@ const config = { ...@@ -210,6 +210,9 @@ const config = {
'/customActivity/happyclear/getConfigInfo':{ '/customActivity/happyclear/getConfigInfo':{
data:'./happyclear/getConfigInfo.json' data:'./happyclear/getConfigInfo.json'
}, },
'/customActivity/happyclear/findConsumerRecords': {
data: './happyclear/homelevel.json'
},
}; };
for (let item in config) { for (let item in config) {
......
This diff is collapsed.
{
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1566885811031,
"data": [
{
"levelNum": 1,
"maxScore": 39870,
"stars": 3
},
{
"levelNum": 2,
"maxScore": 36770,
"stars": 2
},
{
"levelNum": 3,
"maxScore": 28800,
"stars": 3
},
{
"levelNum": 4,
"maxScore": 36340,
"stars": 2
},
{
"levelNum": 5,
"maxScore": 64750,
"stars": 3
},
{
"levelNum": 6,
"maxScore": 59590,
"stars": 2
},
{
"levelNum": 7,
"maxScore": 37810,
"stars": 3
},
{
"levelNum": 8,
"maxScore": 24050,
"stars": 2
},
{
"levelNum": 9,
"maxScore": 43210,
"stars": 3
},
{
"levelNum": 10,
"maxScore": 25630,
"stars": 2
},
{
"levelNum": 11,
"maxScore": 25420,
"stars": 3
},
{
"levelNum": 12,
"maxScore": 32580,
"stars": 2
},
{
"levelNum": 13,
"maxScore": 56700,
"stars": 3
},
{
"levelNum": 14,
"maxScore": 34450,
"stars": 2
},
{
"levelNum": 15,
"maxScore": 42080,
"stars": 3
},
{
"levelNum": 16,
"maxScore": 18990,
"stars": 2
},
{
"levelNum": 17,
"maxScore": 51180,
"stars": 3
},
{
"levelNum": 18,
"maxScore": 38390,
"stars": 2
},
{
"levelNum": 19,
"maxScore": 20160,
"stars": 3
},
{
"levelNum": 20,
"maxScore": 55860,
"stars": 2
},
{
"levelNum": 21,
"maxScore": 21630,
"stars": 3
},
{
"levelNum": 22,
"maxScore": 115670,
"stars": 2
},
{
"levelNum": 23,
"maxScore": 26840,
"stars": 3
},
{
"levelNum": 24,
"maxScore": 39310,
"stars": 2
},
{
"levelNum": 25,
"maxScore": 28010,
"stars": 3
},
{
"levelNum": 21,
"maxScore": 21630,
"stars": 3
},
{
"levelNum": 22,
"maxScore": 115670,
"stars": 2
},
{
"levelNum": 23,
"maxScore": 26840,
"stars": 3
},
{
"levelNum": 24,
"maxScore": 39310,
"stars": 2
},
{
"levelNum": 25,
"maxScore": 28010,
"stars": 3
}
]
}
\ 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