Commit 0352d7fa authored by wildfirecode's avatar wildfirecode

1

parent ed56a29d
......@@ -31,7 +31,6 @@ Page({
},
createMain() {
console.warn('do my.createCanvas')
var self = this;
my.createCanvas({
id: 'canvas',
......@@ -41,14 +40,10 @@ Page({
const windowHeight = my.getSystemInfoSync().windowHeight;
ccc.width = windowWidth * dpr + dpr; //重新修改会有误差
ccc.height = windowHeight * dpr + dpr;
console.warn('my.createCanvas on success')
console.log(ccc.width, ccc.height)
console.log(!!this.main)
if (!this.main) {
this.main = new Main(ccc);
console.log(GDispatcher)
//添加事件,为了和main里的通信
//添加事件,为了和main里的通信
this.main.addGlobalEvent("onMessage", self.onMessage, self)
}
// console.log(this.main)
......@@ -167,12 +162,8 @@ Page({
},
//和main通信的方法,接收main的信息
onMessage(e) {
console.log(9999999)
console.log(e)
//接口名字
//接口名字
let netName = e.data.netName;
//接口参数
let parameter = e.data.parameter;
......@@ -200,7 +191,7 @@ Page({
activityId: app.activityId, //|| "5e7c40e98564b57d7fb95812",
nickName: app.nickName,
avatar: app.avatar,
openId: app.openId,
inviteId: app.inviteId,
isFocusShop: app.isFollow || false,
shareCode: this.shareCode, //判断是否要发助力用
}
......@@ -236,7 +227,8 @@ Page({
} else {
//获取后端接口
const { function: fc } = app.cloud
//待写,
console.log('app.cloudName, parameter, netName.spilt(".")[1]', app.cloudName, parameter, netName.spilt(".")[1])
fc.invoke(app.cloudName, parameter, netName.spilt(".")[1])
.then(res => {
// console.log("返回数据" + JSON.stringify(res));
......@@ -247,8 +239,7 @@ Page({
}
},
postMessage(netName, data) {
console.warn('postMessage(netName, data) {', netName, data)
// this.main.dispatchGlobalEvent(netName, data)
// this.main.dispatchGlobalEvent(netName, data)
this.main.dispatchGlobalEvent({ type: netName }, data) //以防复用事件event串了,就用这种方式
},
onShow() {
......
......@@ -1256,6 +1256,7 @@ var MConst_1 = __webpack_require__(/*! ./Global/MConst */ "./src/Global/MConst.t
var ResJson_1 = __webpack_require__(/*! ./ResJson */ "./src/ResJson.ts");
var LoadingScene_1 = __webpack_require__(/*! ./scenes/LoadingScene */ "./src/scenes/LoadingScene.ts");
var TaoBaoNet_1 = __webpack_require__(/*! ./TaoBaoNet */ "./src/TaoBaoNet.ts");
var global_1 = __webpack_require__(/*! ./datas/global */ "./src/datas/global.ts");
exports.GDispatcher = new FYGE.EventDispatcher();
var Main = (function () {
function Main(canvas) {
......@@ -1307,10 +1308,10 @@ var Main = (function () {
case 3:
_a.sent();
console.log("loading资源加载完成");
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getAppData, null)];
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.getAppData)];
case 4:
_a.sent();
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.filaStarGetActivityBaseInfoById)];
return [4, TaoBaoNet_1.sendTbNet(TaoBaoNet_1.TbNetName.filaStarGetActivityBaseInfoById, { activityId: global_1.getActivityId() })];
case 5:
_a.sent();
ctrls_1.changeScene(LoadingScene_1.LoadingScene);
......@@ -1806,7 +1807,7 @@ exports.ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1592908129/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1592908948/resource/"
};
......@@ -1891,6 +1892,7 @@ var fc;
function sendTbNet(netName, parameter, callback, hideMsg) {
if (hideMsg === void 0) { hideMsg = false; }
return new Promise(function (resolve, reject) {
console.warn('接口发送', netName, JSON.stringify(parameter));
var waitObj;
if (!my) {
var url = "../../mock/miniTb/" + netName + ".json";
......@@ -1923,7 +1925,7 @@ function sendTbNet(netName, parameter, callback, hideMsg) {
+ ("NAME : " + netName + " \n")
+ "STATE : %o \n"
+ "PARAM : %o \n"
+ "%cDATA : %o \n", "" + (d.success ? 'color:green' : 'color:red'), d.success, parameter, "" + (d.success ? 'color:green' : 'color:red'), d);
+ "%cDATA : %o \n", "" + (d.success ? 'color:green' : 'color:red'), d.success, parameter, "" + (d.success ? 'color:green' : 'color:red'), d, JSON.stringify(d));
};
Main_1.GDispatcher.addEventListener(netName, fun);
waitObj = ctrls_1.wait(function () {
......@@ -2612,7 +2614,7 @@ exports.getIsFocusShop = function () {
return exports.getAppData().data.isFocusShop;
};
exports.getInviteId = function () {
return exports.getAppData().data.openId;
return exports.getAppData().data.inviteId;
};
exports.getBeforeStartTime = function () {
var _a = TaoBaoNet_1.getTbData(TaoBaoNet_1.TbNetName.filaStarGetActivityBaseInfoById).data, startTime = _a.startTime, endTime = _a.endTime;
......
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