Commit 2746966d authored by wildfirecode13's avatar wildfirecode13

update

parent b916b3b6
{"code":null,"data":88363694.04933754,"message":"reprehenderit ullamco minim esse","success":true} {
\ No newline at end of file "code": null,
"data": 0,
"message": "reprehenderit ullamco minim esse",
"success": true
}
\ No newline at end of file
{"code":null,"data":true,"message":"occaecat","success":true} {
\ No newline at end of file "code": null,
"data": 0,
"message": "occaecat",
"success": true
}
\ No newline at end of file
{"code":null,"data":{"alreadyOpenAccount":true,"assistFriendAmount":-14187613.920878664,"assistFriendNum":-91701800.34001528,"assistIncrAmount":-80077469.46236338,"canWithdraw":true,"experienceAmount":-87194523.90880549,"maxExperienceAmount":-24988940.25989467,"yesterdayIncome":"velit dolor magna non anim","sumIncome":"in enim nulla","millionShares":"pariatur reprehenderit ea ut eiusmod","sevenDayAnnualization":"exercitation consectetur nostrud ea et"},"message":"fugiat","success":false} {
\ No newline at end of file "code": null,
"data": {
"alreadyOpenAccount": true,
"assistFriendAmount": -14187613.920878664,
"assistFriendNum": -91701800.34001528,
"assistIncrAmount": -80077469.46236338,
"canWithdraw": true,
"experienceAmount": -87194523.90880549,
"maxExperienceAmount": -24988940.25989467,
"yesterdayIncome": "velit dolor magna non anim",
"sumIncome": "in enim nulla",
"millionShares": "pariatur reprehenderit ea ut eiusmod",
"sevenDayAnnualization": "exercitation consectetur nostrud ea et"
},
"message": "fugiat",
"success": true
}
\ No newline at end of file
...@@ -75,20 +75,15 @@ export class Main { ...@@ -75,20 +75,15 @@ export class Main {
if (isShare()) { if (isShare()) {
changeScene(ShareScene, { query: getQueryParams() }); changeScene(ShareScene, { query: getQueryParams() });
} else { } else {
const indexResult = await sendWebNet(WebNetName.index) const alreadyAcquiredResult = await sendWebNet(WebNetName.alreadyAcquired)
if (indexResult && indexResult.success && indexResult.data) {
if (indexResult.data.isNewbie) { if (!alreadyAcquiredResult.data) {
updateShare('inNewbieScene', indexResult.data.shareCode, 0, 0); updateShare('inNewbieScene', '', 0, 0);
changeScene(NewbieScene, { shareCode: indexResult.data.shareCode }); changeScene(NewbieScene);
} }
else { else {
updateShare('inIndexScene', indexResult.data.shareCode, indexResult.data.amount1, indexResult.data.amount2) changeScene(IndexScene);
changeScene(IndexScene)
}
} else {
//网络异常??
} }
} }
} }
......
...@@ -31,24 +31,6 @@ export enum WebNetName { ...@@ -31,24 +31,6 @@ export enum WebNetName {
/**
* 首页
*/
index = "/projectx/{projectId}/game/index.do",
/**
* 是否可分享
*/
canshare = "/projectx/{projectId}/game/canshare.do",
/**
* 参与
*/
join = "/projectx/{projectId}/game/join.do",
/**
* 获取结果
*/
queryResult = "/projectx/{projectId}/game/queryResult.do",
} }
......
...@@ -11,6 +11,15 @@ import { Tools } from "../Tools"; ...@@ -11,6 +11,15 @@ import { Tools } from "../Tools";
import updateShare from "../updateShare"; import updateShare from "../updateShare";
import { getWebData, sendWebNet, WebNetName } from "../WebNet"; import { getWebData, sendWebNet, WebNetName } from "../WebNet";
let createItemResultComplete, myWalletResultComplete;
const checkUpdateShare = () => {
if (createItemResultComplete && myWalletResultComplete) {
updateShare('inPrizePanel',
createItemResultComplete.data,
myWalletResultComplete.data.sumIncome, myWalletResultComplete.data.experienceAmount)
}
}
export class PrizePanel extends Panel { export class PrizePanel extends Panel {
amountTxt: FYGE.TextField; amountTxt: FYGE.TextField;
percentTxt: FYGE.TextField; percentTxt: FYGE.TextField;
...@@ -47,8 +56,17 @@ export class PrizePanel extends Panel { ...@@ -47,8 +56,17 @@ export class PrizePanel extends Panel {
async start(data) { async start(data) {
super.start(); super.start();
const indexResult = await sendWebNet(WebNetName.index)
updateShare('inPrizePanel', data.shareCode, indexResult.data.amount1, indexResult.data.amount2) sendWebNet(WebNetName.createItem).then(createItemResult => {
createItemResultComplete = createItemResult;
checkUpdateShare();
});
sendWebNet(WebNetName.myWallet).then(myWalletResult => {
myWalletResultComplete = myWalletResult;
checkUpdateShare();
});
} }
hidePanel() { hidePanel() {
......
...@@ -6,7 +6,18 @@ import Marquee from '../common/Marquee'; ...@@ -6,7 +6,18 @@ import Marquee from '../common/Marquee';
import { DrawPanel } from '../panels/draw'; import { DrawPanel } from '../panels/draw';
import { ShareFailPanel } from '../panels/share_fail'; import { ShareFailPanel } from '../panels/share_fail';
import { ShareSuccessPanel } from '../panels/share_success'; import { ShareSuccessPanel } from '../panels/share_success';
import updateShare from '../updateShare';
import { sendWebNet, WebNetName } from '../WebNet'; import { sendWebNet, WebNetName } from '../WebNet';
let createItemResultComplete, myWalletResultComplete;
const checkUpdateShare = () => {
if (createItemResultComplete && myWalletResultComplete) {
updateShare('inIndexScene',
createItemResultComplete.data,
myWalletResultComplete.data.sumIncome, myWalletResultComplete.data.experienceAmount)
}
}
export class IndexScene extends Scene { export class IndexScene extends Scene {
get groupNames() { return ["index"] } get groupNames() { return ["index"] }
get skinName() { return "index" } get skinName() { return "index" }
...@@ -31,10 +42,10 @@ export class IndexScene extends Scene { ...@@ -31,10 +42,10 @@ export class IndexScene extends Scene {
console.log('carouselInfo ', res); console.log('carouselInfo ', res);
const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金'; const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金';
const datas = res.data.map(item=>{ const datas = res.data.map(item => {
let str = template.replace('{phone}',item.nickname); let str = template.replace('{phone}', item.nickname);
str = str.replace('{friend}',item.friend); str = str.replace('{friend}', item.friend);
str = str.replace('{amount}',item.amount); str = str.replace('{amount}', item.amount);
return str return str
}); });
const q = this.addChild(new Marquee(datas)); const q = this.addChild(new Marquee(datas));
...@@ -42,6 +53,17 @@ export class IndexScene extends Scene { ...@@ -42,6 +53,17 @@ export class IndexScene extends Scene {
q.x = 50; q.x = 50;
}); });
sendWebNet(WebNetName.createItem).then(createItemResult => {
createItemResultComplete = createItemResult;
checkUpdateShare();
});
sendWebNet(WebNetName.myWallet).then(myWalletResult => {
myWalletResultComplete = myWalletResult;
checkUpdateShare();
});
} }
async showSharePanel() { async showSharePanel() {
...@@ -55,9 +77,9 @@ export class IndexScene extends Scene { ...@@ -55,9 +77,9 @@ export class IndexScene extends Scene {
onPageVisibilityChange = async (visible) => { onPageVisibilityChange = async (visible) => {
console.log('页面visible', visible); console.log('页面visible', visible);
if(!visible)return; if (!visible) return;
const current = PanelCtrl.instance.current; const current = PanelCtrl.instance.current;
if(current) if (current)
console.log('有弹窗就不重复弹分享弹窗了'); console.log('有弹窗就不重复弹分享弹窗了');
if (visible && !current) { if (visible && !current) {
this.showSharePanel(); this.showSharePanel();
......
...@@ -29,17 +29,19 @@ export class NewbieScene extends Scene { ...@@ -29,17 +29,19 @@ export class NewbieScene extends Scene {
const query = getQueryParams(); const query = getQueryParams();
if (query.autoprize == 1) { if (query.autoprize == 1) {
this.openPrize(data); this.openPrize();
} }
} }
openPrize(data) { openPrize() {
prize = 1; prize = 1;
showPanel(PrizePanel, data); sendWebNet(WebNetName.acquireExperienceAmount).then(acquireExperienceAmount => {
showPanel(PrizePanel, acquireExperienceAmount.data);
})
} }
onClick_prizeBtn() { onClick_prizeBtn() {
this.openPrize(this.data); this.openPrize()
} }
onClick_ruleBtn() { onClick_ruleBtn() {
...@@ -60,10 +62,10 @@ export class NewbieScene extends Scene { ...@@ -60,10 +62,10 @@ export class NewbieScene extends Scene {
console.log('carouselInfo ', res); console.log('carouselInfo ', res);
const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金'; const template = '{phone}邀请了{friend}位好友,获得了{amount}体验金';
const datas = res.data.map(item=>{ const datas = res.data.map(item => {
let str = template.replace('{phone}',item.nickname); let str = template.replace('{phone}', item.nickname);
str = str.replace('{friend}',item.friend); str = str.replace('{friend}', item.friend);
str = str.replace('{amount}',item.amount); str = str.replace('{amount}', item.amount);
return str return str
}); });
const q = this.addChild(new Marquee(datas)); const q = this.addChild(new Marquee(datas));
......
...@@ -69,7 +69,7 @@ export class LoadingScene extends Scene { ...@@ -69,7 +69,7 @@ export class LoadingScene extends Scene {
.call(() => { .call(() => {
if (pro >= 1) { if (pro >= 1) {
this.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this); this.removeEventListener(FYGE.Event.PROGRESS, this.progressEvent, this);
changeScene(StartScene,getWebData(WebNetName.index).data) // changeScene(StartScene,getWebData(WebNetName.index).data)
} }
}) })
} }
......
...@@ -46,16 +46,16 @@ export class StartScene extends Scene { ...@@ -46,16 +46,16 @@ export class StartScene extends Scene {
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
//开始游戏 //开始游戏
this.startBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => { // this.startBtn.addEventListener(FYGE.MouseEvent.CLICK, async () => {
showWaiting(); // showWaiting();
var res = await sendWebNet(WebNetName.join) // var res = await sendWebNet(WebNetName)
hideWaiting(); // hideWaiting();
if (res.success) { // if (res.success) {
changeScene(PlayScene, { ...res.data }); // changeScene(PlayScene, { ...res.data });
} else { // } else {
//TODO // //TODO
} // }
}, this) // }, this)
//规则按钮 //规则按钮
this.ruleBtn.addEventListener(FYGE.MouseEvent.CLICK, () => { this.ruleBtn.addEventListener(FYGE.MouseEvent.CLICK, () => {
showPanel(RulePanel) showPanel(RulePanel)
......
const updateShare = (type, shareCode, amount1, amount2) => { const updateShare = (type, shareCode, sumIncome, experienceAmount) => {
console.log('updateShare', 'type=', type, 'shareCode=', shareCode, 'amount1=', amount1, 'amount2=', amount2) console.log('updateShare', 'type=', type, 'shareCode=', shareCode, 'sumIncome=', sumIncome, 'experienceAmount=', experienceAmount)
} }
export default updateShare export default updateShare
\ 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