Commit ed56a29d authored by wildfirecode's avatar wildfirecode

1

parent 9682a8b5
./client/pages/index/output.js
server
\ No newline at end of file
import { Main } from './output';
import { Main, GDispatcher } from './output';
import { getUserAddress, favorShop, getAuthUserInfo, checkShopFavoredStatus } from '../../utils/utils';
const app = getApp()
......@@ -43,8 +43,11 @@ Page({
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)
this.main = new Main(ccc);
console.log(GDispatcher)
//添加事件,为了和main里的通信
this.main.addGlobalEvent("onMessage", self.onMessage, self)
}
......@@ -164,6 +167,11 @@ Page({
},
//和main通信的方法,接收main的信息
onMessage(e) {
console.log(9999999)
console.log(e)
//接口名字
let netName = e.data.netName;
//接口参数
......@@ -222,14 +230,14 @@ Page({
my.showSharePanel()
break
}
console.log(879797897)
// this.webViewContext.postMessage({ netName: netName, data: data })
this.postMessage(netName, data)
} else {
var app = getApp();
//获取后端接口
const { function: fc } = app.cloud
//待写,
fc.invoke(app.cloudName, parameter, netName)
fc.invoke(app.cloudName, parameter, netName.spilt(".")[1])
.then(res => {
// console.log("返回数据" + JSON.stringify(res));
//发送消息
......@@ -239,6 +247,7 @@ Page({
}
},
postMessage(netName, data) {
console.warn('postMessage(netName, data) {', netName, data)
// this.main.dispatchGlobalEvent(netName, data)
this.main.dispatchGlobalEvent({ type: netName }, data) //以防复用事件event串了,就用这种方式
},
......
......@@ -1280,9 +1280,6 @@ var Main = (function () {
if (!my) {
}
else {
MConst_1.MConst.activityId = getApp().query.activityOutId;
MConst_1.MConst.o = getApp().query.o || null;
MConst_1.MConst.groupId = getApp().query.groupId;
}
if (MConst_1.MConst.o) {
}
......@@ -1809,7 +1806,7 @@ exports.ResJson = {
}
}
],
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1592905106/resource/"
"path": "https://yun.duiba.com.cn/db_games/activity/kickball-feile/1592908129/resource/"
};
......@@ -1929,7 +1926,6 @@ function sendTbNet(netName, parameter, callback, hideMsg) {
+ "%cDATA : %o \n", "" + (d.success ? 'color:green' : 'color:red'), d.success, parameter, "" + (d.success ? 'color:green' : 'color:red'), d);
};
Main_1.GDispatcher.addEventListener(netName, fun);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
waitObj = ctrls_1.wait(function () {
if (netName != TbNetName.favorShop &&
netName != TbNetName.getUserAddress &&
......@@ -1937,6 +1933,7 @@ function sendTbNet(netName, parameter, callback, hideMsg) {
fun({ type: netName, data: { success: false } });
}
}, 10000);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
});
}
exports.sendTbNet = sendTbNet;
......
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