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

接入接口

parent 2cb2b413
......@@ -19,6 +19,10 @@ const config = {
'/hdtool/recon/ngame/getNgameStartStatus': {
data: './json/getNgameStartStatus.json'
},
// 本次内容
'/zy-activity/game/index': {
data: './json/gameIndex.json'
}
}
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 @@
import { ajax, jsonp } from "../../module/web/ajax"
import { showToast } from "../../module/ctrls"
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,需跳转下载的
// <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 {
var rule = this.addChild(new FYGE.FloatDisplay());
rule.position.set(this.ruleLab.x,this.ruleLab.y)
rule.init(section);
}
initEvents() {
super.initEvents();
......
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 { RES } from "../../module/RES";
import { RulePanel } from "../panels/RulePanel";
import { sendWebNet, WebNetName, getPxTokenSave } from "../webNet";
import { GDispatcher } from "../Main";
import { getGameIndex } from "../hdTool/Hdtool";
export class StartScene extends Scene {
get groupNames() { return ["StartScene"] };
get skinName() { return "StartScene" };
......@@ -39,19 +41,21 @@ export class StartScene extends Scene {
this.getIndexInfo()
}
async getIndexInfo() {
const { success, data, message } = await sendWebNet(WebNetName.indexInfo)
if (!success) {
showToast(message || "网络异常,请重试~")
return
getGameIndex().then((r) => {
hideWaiting()
if (r.success) {
this.indexInfo = r.data;
this.titlelab.text = "今日收集字数( " + r.data.collectCount + " / 16 )"
}
})
this.indexInfo = data
this.titlelab.text = "今日收集字数( " + data.word + " / 17 )"
// this.openGame()
}
openRule() {
showPanel(RulePanel)
// showPanel(RulePanel)
GDispatcher.dispatchEvent("openRule");
}
isOpen = false
async openGame() {
......@@ -84,10 +88,7 @@ export class StartScene extends Scene {
}
goback() {
setTimeout(() => {
history.go(-1)
}, 500)
GDispatcher.dispatchEvent("backIndex");
}
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