Commit ed56a29d authored by wildfirecode's avatar wildfirecode

1

parent 9682a8b5
./client/pages/index/output.js ./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'; import { getUserAddress, favorShop, getAuthUserInfo, checkShopFavoredStatus } from '../../utils/utils';
const app = getApp() const app = getApp()
...@@ -43,8 +43,11 @@ Page({ ...@@ -43,8 +43,11 @@ Page({
ccc.height = windowHeight * dpr + dpr; ccc.height = windowHeight * dpr + dpr;
console.warn('my.createCanvas on success') console.warn('my.createCanvas on success')
console.log(ccc.width, ccc.height) console.log(ccc.width, ccc.height)
console.log(!!this.main)
if (!this.main) { if (!this.main) {
this.main = new Main(ccc) this.main = new Main(ccc);
console.log(GDispatcher)
//添加事件,为了和main里的通信 //添加事件,为了和main里的通信
this.main.addGlobalEvent("onMessage", self.onMessage, self) this.main.addGlobalEvent("onMessage", self.onMessage, self)
} }
...@@ -164,6 +167,11 @@ Page({ ...@@ -164,6 +167,11 @@ Page({
}, },
//和main通信的方法,接收main的信息 //和main通信的方法,接收main的信息
onMessage(e) { onMessage(e) {
console.log(9999999)
console.log(e)
//接口名字 //接口名字
let netName = e.data.netName; let netName = e.data.netName;
//接口参数 //接口参数
...@@ -222,14 +230,14 @@ Page({ ...@@ -222,14 +230,14 @@ Page({
my.showSharePanel() my.showSharePanel()
break break
} }
console.log(879797897)
// this.webViewContext.postMessage({ netName: netName, data: data }) // this.webViewContext.postMessage({ netName: netName, data: data })
this.postMessage(netName, data) this.postMessage(netName, data)
} else { } else {
var app = getApp();
//获取后端接口 //获取后端接口
const { function: fc } = app.cloud const { function: fc } = app.cloud
//待写, //待写,
fc.invoke(app.cloudName, parameter, netName) fc.invoke(app.cloudName, parameter, netName.spilt(".")[1])
.then(res => { .then(res => {
// console.log("返回数据" + JSON.stringify(res)); // console.log("返回数据" + JSON.stringify(res));
//发送消息 //发送消息
...@@ -239,6 +247,7 @@ Page({ ...@@ -239,6 +247,7 @@ Page({
} }
}, },
postMessage(netName, data) { 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串了,就用这种方式 this.main.dispatchGlobalEvent({ type: netName }, data) //以防复用事件event串了,就用这种方式
}, },
......
...@@ -1280,9 +1280,6 @@ var Main = (function () { ...@@ -1280,9 +1280,6 @@ var Main = (function () {
if (!my) { if (!my) {
} }
else { 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) { if (MConst_1.MConst.o) {
} }
...@@ -1809,7 +1806,7 @@ exports.ResJson = { ...@@ -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) { ...@@ -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); + "%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.addEventListener(netName, fun);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
waitObj = ctrls_1.wait(function () { waitObj = ctrls_1.wait(function () {
if (netName != TbNetName.favorShop && if (netName != TbNetName.favorShop &&
netName != TbNetName.getUserAddress && netName != TbNetName.getUserAddress &&
...@@ -1937,6 +1933,7 @@ function sendTbNet(netName, parameter, callback, hideMsg) { ...@@ -1937,6 +1933,7 @@ function sendTbNet(netName, parameter, callback, hideMsg) {
fun({ type: netName, data: { success: false } }); fun({ type: netName, data: { success: false } });
} }
}, 10000); }, 10000);
Main_1.GDispatcher.dispatchEvent({ type: "onMessage" }, { netName: netName, parameter: parameter });
}); });
} }
exports.sendTbNet = sendTbNet; 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