Commit 10734c46 authored by shunx 马's avatar shunx 马

111

parent 27290ee0
{ {
"code": null, "code": null,
"data": { "data": {
"surplusCount": 0, "surplusCount": 1,
"credits": 22222, "credits": 22222,
"needCredits": 3333, "needCredits": 3333,
"type": 2, "type": 1,
"isMember":1 "isMember":1
}, },
"message": null, "message": null,
......
...@@ -7,6 +7,7 @@ import { sendWebNetWithToken } from "../sendWebNetWithToken"; ...@@ -7,6 +7,7 @@ import { sendWebNetWithToken } from "../sendWebNetWithToken";
import { sendWebNet } from "../WebNet"; import { sendWebNet } from "../WebNet";
import { WebNetName } from "../WebNetName"; import { WebNetName } from "../WebNetName";
import { NoPrizePanel } from "./noprize"; import { NoPrizePanel } from "./noprize";
import { notEnoughMoneyPanel } from "./notEnoughMoney";
import { PrizePanel } from "./prize"; import { PrizePanel } from "./prize";
let section; let section;
......
import { showPanel } from "../../module/ctrls";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { Panel } from "../../module/views/Panel"; import { Panel } from "../../module/views/Panel";
import centerTextField from "../common/centerTextField"; import centerTextField from "../common/centerTextField";
import getObject from "../common/getObject"; import getObject from "../common/getObject";
import { hideShareMask, showShareMask } from "../common/ShareMask";
import { SharePanel } from "./share";
let section; let section;
export class getTimesPanel extends Panel { export class getTimesPanel extends Panel {
click_getTimes_go(){ click_getTimes_go() {
console.log('click_getTimes_go'); this.hidePanel();
showShareMask();
setTimeout(() => {
hideShareMask();
showPanel(SharePanel);
},2000)
} }
get groupNames() { return ["getTimes"] } get groupNames() { return ["getTimes"] }
......
...@@ -22,8 +22,9 @@ import { showShareMask } from "../common/ShareMask"; ...@@ -22,8 +22,9 @@ import { showShareMask } from "../common/ShareMask";
let boxGroup: BoxGroup; let boxGroup: BoxGroup;
let boxArea; let boxArea;
let hand: FYGE.Sprite; let hand;
let shareButton; let shareButton;
let indexData;
export class IndexScene extends Scene { export class IndexScene extends Scene {
get groupNames() { return ["index"] } get groupNames() { return ["index"] }
...@@ -35,8 +36,6 @@ export class IndexScene extends Scene { ...@@ -35,8 +36,6 @@ export class IndexScene extends Scene {
start() { start() {
super.start(); super.start();
// this.initNonmemberMask();
// getObject(this,'index_sharetips').visible=false;
this.initContainer(); this.initContainer();
this.initmask(); this.initmask();
const limit = getObject(this, 'index_timestips2'); const limit = getObject(this, 'index_timestips2');
...@@ -49,20 +48,21 @@ export class IndexScene extends Scene { ...@@ -49,20 +48,21 @@ export class IndexScene extends Scene {
index_moneytips.position.set(480, 1131); index_moneytips.position.set(480, 1131);
const index_timestips = getObject(this, 'index_timestips'); const index_timestips = getObject(this, 'index_timestips');
index_timestips.position.set(127, 1131); index_timestips.position.set(127, 1131);
const list = new FYGE.ScrollList(ScrollItem, 131+20, 131, 620, 154, false); const list = new FYGE.ScrollList(ScrollItem, 131 + 20, 131, 620, 154, false);
const array = ['//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png'];
list.updateData(array);
list.position.set(80, 1240 + 30); list.position.set(80, 1240 + 30);
this.addChild(list); this.addChild(list);
if (hand) { hand = getObject(this, 'index_sharehand');
const tw = FYGE.Tween.get(hand, { loop: true }).to({ scaleX: 1.5, scaleY: 1.5 }, 1000).to({ scaleX: 1, scaleY: 1 }, 1000); this.addChild(hand);
}
this.getIndex(); this.getIndex();
const result = getWebData(WebNetName.index)
const array = ['//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png','//yun.duiba.com.cn/spark/assets/1398924a1b804f0f20f9d3e16ed3158c2b3d686b.png'];
list.updateData(array);
hand && FYGE.Tween.get(hand, { loop: true }).to({ scaleX: 1.5, scaleY: 1.5 }, 1000).to({ scaleX: 1, scaleY: 1 }, 1000);
this.stage.addEventListener("restartEnterFrame", this.onRestartFrame, this); this.stage.addEventListener("restartEnterFrame", this.onRestartFrame, this);
boxGroup.addEventListener("stopIndexEnterFrame", this.removeEvent, this); boxGroup.addEventListener("stopIndexEnterFrame", this.removeEvent, this);
shareButton = getObject(this, 'index_sharetips'); shareButton = getObject(this, 'index_sharetips');
shareButton.addEventListener(FYGE.MouseEvent.CLICK, () => { shareButton.addEventListener(FYGE.MouseEvent.CLICK, () => {
showShareMask(); this.handleShare();
},this) },this)
} }
...@@ -121,16 +121,19 @@ export class IndexScene extends Scene { ...@@ -121,16 +121,19 @@ export class IndexScene extends Scene {
this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this); this.removeEventListener(FYGE.Event.ENTER_FRAME, this.onEnterFrame, this);
} }
handleShare = async() =>{ handleShare = async () => {
showShareMask(); if (indexData.data.type == 2 && indexData.data.surplusCount <= 0) {
showPanel(timesNotEnoughPanel);
} else {
showPanel(getTimesPanel);
await getWebData(WebNetName.getFreeCount); await getWebData(WebNetName.getFreeCount);
this.getIndex(); this.getIndex();
} }
}
getIndex = async () => { getIndex = async () => {
const result = await getWebData(WebNetName.index); const result = await getWebData(WebNetName.index);
hand = getObject(this, 'index_sharehand'); indexData = result;
this.addChild(hand);
hand.visible = false; hand.visible = false;
if (result && result.data) { if (result && result.data) {
const getBoxButton = getObject(this, 'index_opentips'); const getBoxButton = getObject(this, 'index_opentips');
...@@ -155,13 +158,22 @@ export class IndexScene extends Scene { ...@@ -155,13 +158,22 @@ export class IndexScene extends Scene {
shareButton.visible = false; shareButton.visible = false;
} }
} else { } else {
if (result.data.surplusCount > 0) {
needCredits.text = '免费拆盒1次'; needCredits.text = '免费拆盒1次';
reDegree.text = `${result.data.surplusCount}`; reDegree.text = `${result.data.surplusCount}`;
getBoxButton.visible = false;
shareButton.visible = true;
hand.visible = true;
} else {
reDegree.text = '0';
needCredits.text = `${result.data.needCredits}` + "积分/次";
getBoxButton.visible = true; getBoxButton.visible = true;
shareButton.visible = false; shareButton.visible = 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