Commit 07e7f310 authored by shunx 马's avatar shunx 马

删除spark/ui

parent b3249a9d
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
"webpack-merge": "^4.1.2" "webpack-merge": "^4.1.2"
}, },
"dependencies": { "dependencies": {
"@spark/api-base": "^2.0.30",
"@spark/share": "^2.0.90", "@spark/share": "^2.0.90",
"duiba-utils": "^1.0.11" "duiba-utils": "^1.0.11"
}, },
......
import { showPanel, wait } from "../../module/ctrls"; import { showPanel, showToast, wait } from "../../module/ctrls";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { layers } from "../../module/views/layers"; import { layers } from "../../module/views/layers";
import { Panel } from "../../module/views/Panel"; import { Panel } from "../../module/views/Panel";
...@@ -12,8 +12,14 @@ import { NoPrizePanel } from "./noprize"; ...@@ -12,8 +12,14 @@ import { NoPrizePanel } from "./noprize";
import { notEnoughMoneyPanel } from "./notEnoughMoney"; import { notEnoughMoneyPanel } from "./notEnoughMoney";
import { PrizePanel } from "./prize"; import { PrizePanel } from "./prize";
import { waitAPI } from "./wait2"; import { waitAPI } from "./wait2";
import { polling } from '@spark/api-base';
let section; let section;
let projectId: string;
const projectxString = "projectx/";
export class CostPanel extends Panel { export class CostPanel extends Panel {
start() { start() {
super.start(); super.start();
...@@ -28,25 +34,56 @@ export class CostPanel extends Panel { ...@@ -28,25 +34,56 @@ export class CostPanel extends Panel {
this.getPrize(e.target); this.getPrize(e.target);
} }
getProjectId(): string {
if (projectId) return projectId;
let windowUrl = window.location.href;
let splitArr = windowUrl.split(projectxString);
if (splitArr.length != 2) {
return projectId = "projectId"
}
let start = windowUrl.indexOf(projectxString) + projectxString.length;
let end = splitArr[1].indexOf("/");
return projectId = windowUrl.substr(start, end);
}
getPrize = async (btn:FYGE.Sprite) => { getPrize = async (btn:FYGE.Sprite) => {
btn.mouseEnable=false; btn.mouseEnable=false;
const indexResult = getWebData(WebNetName.index); const indexResult = getWebData(WebNetName.index);
const params: any = { const params: any = {
toPlaywayId: 'dazzle', toActionId: 'drawPrize' toPlaywayId: 'dazzle', toActionId: 'drawPrize'
}; };
let result, prizeData, resultPolling;
let result, prizeData;
if (indexResult.data.type == 1) { if (indexResult.data.type == 1) {
const projectId = this.getProjectId();
console.log("====>",projectId)
params.credits = indexResult.data.needCredits; params.credits = indexResult.data.needCredits;
result = await sendWebNet(WebNetName.getCreditCost, params); result = await sendWebNet(WebNetName.getCreditCost, params);
await waitAPI(500); resultPolling = await polling(
if(!result.success) { (rsp) => rsp.code == "0000000000",
`/projectx/${projectId}/credits/queryStatus.do`,
{
ticketNum: result.data
},
10,
500,
'get'
).catch((e) => {
console.log("2222222", e);
showToast("积分扣除失败");
})
if (resultPolling == 1) {
if(!result.success) {
btn.mouseEnable=true;
return;
}
prizeData = await sendWebNetWithToken(WebNetName.drawPrize, { ticket: result.data });
btn.mouseEnable=true; btn.mouseEnable=true;
return; } else if (resultPolling == 2) {
showToast("积分扣除失败");
} }
prizeData = await sendWebNetWithToken(WebNetName.drawPrize, { ticket: result.data });
btn.mouseEnable=true;
} }
else { else {
prizeData = await sendWebNetWithToken(WebNetName.drawPrize); prizeData = await sendWebNetWithToken(WebNetName.drawPrize);
...@@ -70,6 +107,8 @@ export class CostPanel extends Panel { ...@@ -70,6 +107,8 @@ export class CostPanel extends Panel {
} }
get groupNames() { get groupNames() {
return ["cost"]; return ["cost"];
} }
......
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