Commit 39ac0990 authored by 王勇霞's avatar 王勇霞

接口接入活动页

parent 5bd7925a
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>畅玩欢乐城</title> <title>21天"云"健身</title>
<meta name="viewport" <meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" /> content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" /> <meta name="apple-mobile-web-app-capable" content="yes" />
......
{
"success": true,
"message": "",
"code": "",
"data": {
"ruleIdList": [
"ru_1",
"ru_2",
"ru_3",
"ru_4"
],
"drawStatus": 12,
"prizeId": "aa",
"gameCounts": 1
}
}
\ No newline at end of file
{
"success": true,
"desc": "labore amet laboris sit",
"data": {
"dataInfo": [
{
"num": 1,
"context": "闲看云",
"ifComplete": false,
"count": 74413176.81524068
},
{
"num": 2,
"context": "卷",
"ifComplete": false,
"count": 10
},
{
"num": 3,
"context": null,
"ifComplete": false,
"count": 10
},
{
"num": 5,
"context": "自在休闲",
"ifComplete": true,
"count": 10
},
{
"num": 4,
"context": "自在休闲",
"ifComplete": false,
"count": 10
}
],
"collectCount": 1,
"ifFirstPlay": true
},
"code": "ipsum est tempor qui",
"timestamp": 3627649.9094133973
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": 1234
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": {
"type": 1,
"status": 1,
"prize": {
"prizeId": "sp_1",
"prizeType": 1,
"optionId": "sdhjfhjhjjj",
"optionName": "10元话费",
"optionImg": "https://www.baidu.com/xxoo2.png",
"userRecordId": 1235,
"url": "https://www.baidu.com/order/1235"
}
}
}
\ No newline at end of file
{
"success": true,
"desc": "tempor et pariatur id",
"data": {
"startId": 72322899
},
"code": "ipsum quis nulla",
"timestamp": 29586841
}
\ No newline at end of file
{
"success": true,
"desc": "elit ipsum magna est",
"data": {
"point": -34090916
},
"code": "ut",
"timestamp": 1032620
}
\ No newline at end of file
...@@ -509,45 +509,23 @@ ...@@ -509,45 +509,23 @@
} }
}, },
{ {
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png", "keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,titile.png",
"name": "StartScene", "name": "StartScene",
"atlas": { "atlas": {
"midbuild.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 493,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 493,
"ro": false
},
"mifcloud.png": {
"x": 2,
"y": 497,
"w": 750,
"h": 412,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 412,
"ro": false
},
"titile.png": { "titile.png": {
"x": 754, "x": 2,
"y": 2, "y": 2,
"w": 574, "w": 574,
"h": 177, "h": 126,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 574, "sw": 574,
"sh": 177, "sh": 177,
"ro": true "ro": false
}, },
"startbtn.png": { "startbtn.png": {
"x": 2, "x": 2,
"y": 911, "y": 130,
"w": 350, "w": 350,
"h": 99, "h": 99,
"ox": 0, "ox": 0,
...@@ -556,31 +534,31 @@ ...@@ -556,31 +534,31 @@
"sh": 99, "sh": 99,
"ro": false "ro": false
}, },
"startop.png": { "collect.png": {
"x": 754, "x": 2,
"y": 578, "y": 231,
"w": 117, "w": 308,
"h": 196, "h": 50,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 117, "sw": 308,
"sh": 196, "sh": 50,
"ro": false "ro": false
}, },
"backbtn.png": { "backbtn.png": {
"x": 754, "x": 354,
"y": 776, "y": 130,
"w": 145, "w": 145,
"h": 62, "h": 62,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 145, "sw": 145,
"sh": 62, "sh": 62,
"ro": false "ro": true
}, },
"rulebtn.png": { "rulebtn.png": {
"x": 754, "x": 418,
"y": 840, "y": 130,
"w": 138, "w": 138,
"h": 62, "h": 62,
"ox": 0, "ox": 0,
......
resource/StartScene/titile.png

90.9 KB | W: | H:

resource/StartScene/titile.png

83.9 KB | W: | H:

resource/StartScene/titile.png
resource/StartScene/titile.png
resource/StartScene/titile.png
resource/StartScene/titile.png
  • 2-up
  • Swipe
  • Onion skin
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
"name": "RulePanel" "name": "RulePanel"
}, },
{ {
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png", "keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,titile.png",
"name": "StartScene" "name": "StartScene"
}, },
{ {
......
...@@ -24,7 +24,12 @@ export class Main { ...@@ -24,7 +24,12 @@ export class Main {
private requestID; private requestID;
private _pause: boolean; private _pause: boolean;
private canvas: HTMLCanvasElement private canvas: HTMLCanvasElement
constructor(canvas: HTMLCanvasElement) { constructor(canvas: HTMLCanvasElement, data = {
time: 60,
longitude: "",
latitude: ""
}) {
Tools.configInfo = data;
var sysInfo; var sysInfo;
//淘宝小程序环境就用canvas初始化 //淘宝小程序环境就用canvas初始化
if (!window) {//自行处理吧,这么判断也不保险,万一淘宝小程序加进了window if (!window) {//自行处理吧,这么判断也不保险,万一淘宝小程序加进了window
......
...@@ -509,45 +509,23 @@ export const ResJson = { ...@@ -509,45 +509,23 @@ export const ResJson = {
} }
}, },
{ {
"keys": "backbtn.png,midbuild.png,mifcloud.png,rulebtn.png,startbg.jpg,startbtn.png,startop.png,titile.png", "keys": "backbtn.png,collect.png,rulebtn.png,startbg.jpg,startbtn.png,titile.png",
"name": "StartScene", "name": "StartScene",
"atlas": { "atlas": {
"midbuild.png": {
"x": 2,
"y": 2,
"w": 750,
"h": 493,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 493,
"ro": false
},
"mifcloud.png": {
"x": 2,
"y": 497,
"w": 750,
"h": 412,
"ox": 0,
"oy": 0,
"sw": 750,
"sh": 412,
"ro": false
},
"titile.png": { "titile.png": {
"x": 754, "x": 2,
"y": 2, "y": 2,
"w": 574, "w": 574,
"h": 177, "h": 126,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 574, "sw": 574,
"sh": 177, "sh": 177,
"ro": true "ro": false
}, },
"startbtn.png": { "startbtn.png": {
"x": 2, "x": 2,
"y": 911, "y": 130,
"w": 350, "w": 350,
"h": 99, "h": 99,
"ox": 0, "ox": 0,
...@@ -556,31 +534,31 @@ export const ResJson = { ...@@ -556,31 +534,31 @@ export const ResJson = {
"sh": 99, "sh": 99,
"ro": false "ro": false
}, },
"startop.png": { "collect.png": {
"x": 754, "x": 2,
"y": 578, "y": 231,
"w": 117, "w": 308,
"h": 196, "h": 50,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 117, "sw": 308,
"sh": 196, "sh": 50,
"ro": false "ro": false
}, },
"backbtn.png": { "backbtn.png": {
"x": 754, "x": 354,
"y": 776, "y": 130,
"w": 145, "w": 145,
"h": 62, "h": 62,
"ox": 0, "ox": 0,
"oy": 0, "oy": 0,
"sw": 145, "sw": 145,
"sh": 62, "sh": 62,
"ro": false "ro": true
}, },
"rulebtn.png": { "rulebtn.png": {
"x": 754, "x": 418,
"y": 840, "y": 130,
"w": 138, "w": 138,
"h": 62, "h": 62,
"ox": 0, "ox": 0,
...@@ -755,5 +733,5 @@ export const ResJson = { ...@@ -755,5 +733,5 @@ export const ResJson = {
"name": "svga" "name": "svga"
} }
], ],
"path": "https://yun.duiba.com.cn/db_games/activity/template/1678380297/resource/" "path": "https://yun.duiba.com.cn/db_games/activity/template/1678450122/resource/"
} }
\ No newline at end of file
...@@ -403,6 +403,16 @@ export const SkinJson = { ...@@ -403,6 +403,16 @@ export const SkinJson = {
}, },
"id": "title" "id": "title"
}, },
{
"name": "collect",
"x": 224,
"y": 236,
"type": "sprite",
"props": {
"source": "collect.png"
},
"id": "collect"
},
{ {
"name": "titlelab", "name": "titlelab",
"x": 0, "x": 0,
...@@ -413,7 +423,9 @@ export const SkinJson = { ...@@ -413,7 +423,9 @@ export const SkinJson = {
"size": 20, "size": 20,
"fillColor": "#ab4a17", "fillColor": "#ab4a17",
"textAlpha": 1, "textAlpha": 1,
"lineHeight": 20 "lineHeight": 20,
"textWidth": 750,
"textAlign": "center"
}, },
"id": "titlelab" "id": "titlelab"
}, },
......
...@@ -7,6 +7,13 @@ import Ease = FYGE.Ease; ...@@ -7,6 +7,13 @@ import Ease = FYGE.Ease;
* 定制,记录一些全局量和通用方法 * 定制,记录一些全局量和通用方法
*/ */
export class Tools { export class Tools {
// public static indexInfo;
// public static startId;
public static configInfo: {
longitude: string,
latitude: string,
time: number
}
/** /**
* 缓存key * 缓存key
......
...@@ -14,39 +14,39 @@ let mergeData = { ...@@ -14,39 +14,39 @@ let mergeData = {
* web接口枚举,mock 文件名类似aaa/homeInfo.do * web接口枚举,mock 文件名类似aaa/homeInfo.do
*/ */
export enum WebNetName { export enum WebNetName {
/** // /**
* 首页 // * 首页
* 参数a 参数b // * 参数a 参数b
*/ // */
index = "/projectx/{projectId}/game/index.do", // index = "/projectx/{projectId}/game/index.do",
/** // /**
* 参与 // * 参与
*/ // */
join = "/projectx/{projectId}/game/join.do", // join = "/projectx/{projectId}/game/join.do",
/** // /**
* 获取结果 // * 获取结果
*/ // */
queryResult = "/projectx/{projectId}/game/queryResult.do", // queryResult = "/projectx/{projectId}/game/queryResult.do",
/** // /**
* 获取规则 // * 获取规则
*/ // */
projectRule = "/projectx/{projectId}/projectRule.query", // projectRule = "/projectx/{projectId}/projectRule.query",
/**
* 开始游戏
*/
startGame = "/projectx/{projectId}/happyCityScore/start.do",
/** /**
* 游戏首页 * 游戏首页
*/ */
indexInfo = "/projectx/{projectId}/happyCityScore/gameIndex.do", indexInfo = "/zy-activity/game/index",
/** /**
* 提交游戏 * 开始游戏
*/ */
submitGame = "/projectx/{projectId}/happyCityScore/submit.do", startGame = "/zy-activity/game/start",
/** /**
* 通用埋点 * 提交游戏
*/ */
buriedPoint = "/projectx/{projectId}/buriedPoint" submitGame = "/zy-activity/game/submit",
// /**
// * 通用埋点
// */
// buriedPoint = "/projectx/{projectId}/buriedPoint"
} }
//返回数据类型 //返回数据类型
...@@ -54,7 +54,8 @@ interface dataOut { ...@@ -54,7 +54,8 @@ interface dataOut {
success: boolean, success: boolean,
data?: any data?: any
code?: string, code?: string,
message?: string message?: string,
desc?: string,
} }
//记录数据 //记录数据
...@@ -74,7 +75,7 @@ export function sendWebNet( ...@@ -74,7 +75,7 @@ export function sendWebNet(
parameter?: any, parameter?: any,
callback?: (success: boolean, res?: dataOut) => void, callback?: (success: boolean, res?: dataOut) => void,
hideMsg: boolean = false, hideMsg: boolean = false,
isGet: boolean = true,//这两个参数基本不设置,放后面吧 isGet: boolean = false,//这两个参数基本不设置,放后面吧
headers?: any, headers?: any,
): Promise<dataOut> { ): Promise<dataOut> {
//处理下参数 //处理下参数
...@@ -85,8 +86,8 @@ export function sendWebNet( ...@@ -85,8 +86,8 @@ export function sendWebNet(
if (/*window["development"]*/window.location.port == "8080") {//window.location.port == "8080";考虑按端口判断TODO if (/*window["development"]*/window.location.port == "8080") {//window.location.port == "8080";考虑按端口判断TODO
// var jname = netName.substring(netName.lastIndexOf("/") + 1);//待修改,TODO,部分接口后缀名字一致 // var jname = netName.substring(netName.lastIndexOf("/") + 1);//待修改,TODO,部分接口后缀名字一致
// var url = "../../mock/miniTb/" + jname + ".json"; // var url = "../../mock/miniTb/" + jname + ".json";
let path = netName.split('{projectId}/')[1];//后缀名字之前的是文件夹,mock里结构 let path = netName.split('zy-activity/')[1];//后缀名字之前的是文件夹,mock里结构
if (path.indexOf('/') <= -1) path = `projectX/${path}`; if (path.indexOf('/') <= -1) path = `zy-activity/${path}`;
const url = "../../mock/webNet/" + path + ".json"; const url = "../../mock/webNet/" + path + ".json";
fetchAsync(url) fetchAsync(url)
.then((data) => { .then((data) => {
......
...@@ -43,7 +43,7 @@ export class FailPanel extends Panel { ...@@ -43,7 +43,7 @@ export class FailPanel extends Panel {
const { success, data, message } = await sendWebNet(WebNetName.startGame, { token: token }) const { success, data, message } = await sendWebNet(WebNetName.startGame, { token: token })
if (!success) { if (!success) {
this.isOpen = false this.isOpen = false
showToast(message || "网络异常,请重试~") showToast(message || "网络开小差了,稍后再试~")
return return
} }
this.isOpen = false this.isOpen = false
......
...@@ -35,11 +35,12 @@ export class GuidePanel extends Panel { ...@@ -35,11 +35,12 @@ export class GuidePanel extends Panel {
if (this.guideStep < 4) { if (this.guideStep < 4) {
this.guideStep++ this.guideStep++
this.guideUI(); this.guideUI();
} else { } else if((this.guideStep == 4)) {
this.guideStep++
this.showCount(); this.showCount();
} }
}, this) }, this)
if(getWebData(WebNetName.startGame).data.firstGame){ if(getWebData(WebNetName.indexInfo).data.ifFirstPlay){
this.guideUI(); this.guideUI();
} else { } else {
this.showCount(); this.showCount();
......
This diff is collapsed.
import { Scene } from "../../module/views/Scene"; import { Scene } from "../../module/views/Scene";
import { changeScene, showPanel, showToast, hideWaiting } from "../../module/ctrls"; import { changeScene, showPanel, showToast } 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, getWebData } from "../webNet";
import { GDispatcher } from "../Main"; import { GDispatcher } from "../Main";
import { getGameIndex } from "../hdTool/Hdtool"; import { getUrlParams } from "../../module/web/webTools";
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" };
startbtn; startbtn;
startbg: FYGE.Sprite; startbg: FYGE.Sprite;
collect: FYGE.Sprite;
titlelab: FYGE.TextField; titlelab: FYGE.TextField;
backbrn: FYGE.Sprite; backbrn: FYGE.Sprite;
rulebtn: FYGE.Sprite; rulebtn: FYGE.Sprite;
indexInfo;
gameInfo;
public static instance: StartScene public static instance: StartScene
indexInfo;
initUi() { initUi() {
} }
async start(data) { async start(data) {
...@@ -41,59 +38,52 @@ export class StartScene extends Scene { ...@@ -41,59 +38,52 @@ export class StartScene extends Scene {
this.getIndexInfo() this.getIndexInfo()
} }
async getIndexInfo() { async getIndexInfo() {
getGameIndex().then((r) => { const { success, data, desc } = await sendWebNet(WebNetName.indexInfo, {
hideWaiting() activityId: getUrlParams('activityId'),
if (r.success) { type: 3
this.indexInfo = r.data;
this.titlelab.text = "今日收集字数( " + r.data.collectCount + " / 16 )"
}
}) })
if (!success) {
showToast(desc || "网络开小差了,稍后再试")
return
}
this.indexInfo = data
this.titlelab.text = "今日收集字数( " + data.collectCount + " / 16 )"
// this.openGame() // this.openGame()
} }
openRule() { openRule() {
// showPanel(RulePanel)
GDispatcher.dispatchEvent("openRule"); GDispatcher.dispatchEvent("openRule");
} }
isOpen = false startId;
async openGame() { async openGame() {
this.btnDelay(this.startbtn) this.btnDelay(this.startbtn)
if (this.indexInfo) { const { success, code, data, desc } = await sendWebNet(WebNetName.startGame, {
if (!this.indexInfo.dailyPass) { activityId: getUrlParams('activityId'),
if (!this.isOpen) { type: 3
this.isOpen = true })
let token = await getPxTokenSave() if (success) {
const { success, code, data, message } = await sendWebNet(WebNetName.startGame, { token: token }) this.startId = data.startId;
if (!success) { changeScene(GameScene)
this.isOpen = false } else {
if (code == "20004") { showToast(desc || "网络开小差了,稍后再试")
showToast("今日已过关,明日再来~")
} else {
showToast(message || "网络异常,请重试~")
}
return
}
this.isOpen = false
// changeScene(GameScene)
}
} else {
showToast("今日已过关,明日再来~")
}
}else{
showToast( "网络异常,请重试~")
} }
} }
goback() { goback() {
GDispatcher.dispatchEvent("backIndex"); GDispatcher.dispatchEvent("backIndex");
} }
async openCollect() {
let dataInfo = getWebData(WebNetName.indexInfo).data.dataInfo;
if (!dataInfo) {
await this.getIndexInfo()
}
GDispatcher.dispatchEvent("openCollect", getWebData(WebNetName.indexInfo).data.dataInfo);
}
initEvents() { initEvents() {
super.initEvents(); super.initEvents();
this.rulebtn.addEventListener(FYGE.MouseEvent.CLICK, this.openRule, this) this.rulebtn.addEventListener(FYGE.MouseEvent.CLICK, this.openRule, this)
this.backbrn.addEventListener(FYGE.MouseEvent.CLICK, this.goback, this) this.backbrn.addEventListener(FYGE.MouseEvent.CLICK, this.goback, this)
this.collect.addEventListener(FYGE.MouseEvent.CLICK, this.openCollect, this)
} }
removeEvents() { removeEvents() {
...@@ -101,6 +91,7 @@ export class StartScene extends Scene { ...@@ -101,6 +91,7 @@ export class StartScene extends Scene {
this.startbtn.removeEventListener(FYGE.MouseEvent.CLICK, this.openGame, this) this.startbtn.removeEventListener(FYGE.MouseEvent.CLICK, this.openGame, this)
this.rulebtn.removeEventListener(FYGE.MouseEvent.CLICK, this.openRule, this) this.rulebtn.removeEventListener(FYGE.MouseEvent.CLICK, this.openRule, this)
this.backbrn.removeEventListener(FYGE.MouseEvent.CLICK, this.goback, this) this.backbrn.removeEventListener(FYGE.MouseEvent.CLICK, this.goback, this)
this.collect.removeEventListener(FYGE.MouseEvent.CLICK, this.openCollect, this)
} }
} }
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