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

接口接入活动页

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