39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
const app = getApp()
|
|
Page({
|
|
data: {
|
|
patient_account: "10000",
|
|
title: '患者姓名',
|
|
height: app.globalData.height,
|
|
order_inquiry_id: ""
|
|
},
|
|
onLoad(option) {
|
|
console.log("chat onload");
|
|
let from_account = option.from_account;
|
|
let order_inquiry_id = option.order_inquiry_id;
|
|
this.setData({
|
|
patient_account: from_account,
|
|
order_inquiry_id: order_inquiry_id,
|
|
})
|
|
},
|
|
onUnload() {
|
|
console.log("chat onUnload");
|
|
},
|
|
onShow(){
|
|
let _this = this;
|
|
let interval = setInterval(() => {
|
|
console.log("chat init ,");
|
|
console.log("app.globalData.chat_sdk_ready: ", app.globalData.chat_sdk_ready);
|
|
if(app.globalData.chat_sdk_ready){
|
|
const TUIChat = _this.selectComponent('#TUIChat');
|
|
TUIChat.init();
|
|
wx.$TUIKit.on(wx.$TUIKitTIM.EVENT.MESSAGE_RECEIVED, _this.$onMessageReceived, _this);
|
|
clearInterval(interval);
|
|
}
|
|
}, 1000);
|
|
},
|
|
$onMessageReceived(value) {
|
|
const message = value.data[0];
|
|
console.log("message from chat: ",message)
|
|
}
|
|
})
|