Commit 5bd7925a authored by 王勇霞's avatar 王勇霞

接入接口

parent 2cb2b413
...@@ -19,6 +19,10 @@ const config = { ...@@ -19,6 +19,10 @@ const config = {
'/hdtool/recon/ngame/getNgameStartStatus': { '/hdtool/recon/ngame/getNgameStartStatus': {
data: './json/getNgameStartStatus.json' data: './json/getNgameStartStatus.json'
}, },
// 本次内容
'/zy-activity/game/index': {
data: './json/gameIndex.json'
}
} }
for (let item in config) { for (let item in config) {
......
{
"success": true,
"desc": "elit",
"data": {
"data": [
{
"num": "sint consectetur id quis",
"context": "in dolore",
"ifComplete": -46608589.20993536,
"count": 67750870.19773784
}
],
"collectCount": -20061995
},
"code": "in enim ea dolore",
"timestamp": -81389889
}
\ No newline at end of file
...@@ -5,6 +5,32 @@ ...@@ -5,6 +5,32 @@
import { ajax, jsonp } from "../../module/web/ajax" import { ajax, jsonp } from "../../module/web/ajax"
import { showToast } from "../../module/ctrls" import { showToast } from "../../module/ctrls"
import { duiba_md5 } from "../../module/tools/security" import { duiba_md5 } from "../../module/tools/security"
import { getUrlParams } from "../../module/web/webTools"
export function getGameIndex():Promise<{ success: boolean, data?: any }> {
return new Promise((r) => {
ajax({
url: "/zy-activity/game/index", //请求地址
type: "POST",//"POST", //请求方式
data: {
activityId: getUrlParams('activityId'),
type: 3
}, //请求参数
dataType: "json", // 返回值类型的设定,暂时只有json
async: true, //是否异步
// headers: headers,
success: function (res) {
if (!res.success) showToast(res.desc || "网络异常,请稍后再试")
r(res)
},
error: function (status) {
showToast("网络异常,请稍后再试")
r({ success: false })
},
})
})
}
//部分情况需要,比如duiba_md5,需跳转下载的 //部分情况需要,比如duiba_md5,需跳转下载的
// <script crossorigin="anonymous" src="//yun.duiba.com.cn/db_games/libs/zepto_security_downloadApp.min.js"></script> // <script crossorigin="anonymous" src="//yun.duiba.com.cn/db_games/libs/zepto_security_downloadApp.min.js"></script>
......
...@@ -48,7 +48,6 @@ export class RulePanel extends Panel { ...@@ -48,7 +48,6 @@ export class RulePanel extends Panel {
var rule = this.addChild(new FYGE.FloatDisplay()); var rule = this.addChild(new FYGE.FloatDisplay());
rule.position.set(this.ruleLab.x,this.ruleLab.y) rule.position.set(this.ruleLab.x,this.ruleLab.y)
rule.init(section); rule.init(section);
} }
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
......
import { Scene } from "../../module/views/Scene"; import { Scene } from "../../module/views/Scene";
import { changeScene, showPanel, showToast } from "../../module/ctrls"; import { changeScene, showPanel, showToast, hideWaiting } from "../../module/ctrls";
import { GameScene } from "./GameScene"; import { GameScene } from "./GameScene";
import { RES } from "../../module/RES"; import { RES } from "../../module/RES";
import { RulePanel } from "../panels/RulePanel"; import { RulePanel } from "../panels/RulePanel";
import { sendWebNet, WebNetName, getPxTokenSave } from "../webNet"; import { sendWebNet, WebNetName, getPxTokenSave } from "../webNet";
import { GDispatcher } from "../Main";
import { getGameIndex } from "../hdTool/Hdtool";
export class StartScene extends Scene { export class StartScene extends Scene {
get groupNames() { return ["StartScene"] }; get groupNames() { return ["StartScene"] };
get skinName() { return "StartScene" }; get skinName() { return "StartScene" };
...@@ -39,19 +41,21 @@ export class StartScene extends Scene { ...@@ -39,19 +41,21 @@ export class StartScene extends Scene {
this.getIndexInfo() this.getIndexInfo()
} }
async getIndexInfo() { async getIndexInfo() {
const { success, data, message } = await sendWebNet(WebNetName.indexInfo) getGameIndex().then((r) => {
if (!success) { hideWaiting()
showToast(message || "网络异常,请重试~") if (r.success) {
return this.indexInfo = r.data;
} this.titlelab.text = "今日收集字数( " + r.data.collectCount + " / 16 )"
}
this.indexInfo = data })
this.titlelab.text = "今日收集字数( " + data.word + " / 17 )"
// this.openGame() // this.openGame()
} }
openRule() { openRule() {
showPanel(RulePanel) // showPanel(RulePanel)
GDispatcher.dispatchEvent("openRule");
} }
isOpen = false isOpen = false
async openGame() { async openGame() {
...@@ -84,10 +88,7 @@ export class StartScene extends Scene { ...@@ -84,10 +88,7 @@ export class StartScene extends Scene {
} }
goback() { goback() {
setTimeout(() => { GDispatcher.dispatchEvent("backIndex");
history.go(-1)
}, 500)
} }
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
......
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