chatbotwidget.js 994 Bytes
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
//index.js
//获取应用实例
const app = getApp()
var plugin = requirePlugin("myPlugin");
var chat = plugin.getChatComponent();

Page({
data: {
},
onLoad: function () {

wx.getSystemInfo({
success: (res) => {
let isIOS = res.system.indexOf('iOS') > -1
let navHeight = 0
if (!isIOS) {
navHeight = 48
} else {
navHeight = 44
}
this.setData({
status: res.statusBarHeight,
navHeight: navHeight,
statusBarHeight: res.statusBarHeight + navHeight
})
}
})
},
getQueryCallback: function (e) {
},
goBackHome: function () {
wx.navigateBack({
delta: 1
})
},
back:function(e) {
this.goBackHome()
},
chatOnFinish:function(e){
var plugin = requirePlugin("myPlugin");
var chat = plugin.getChatComponent();
chat.clearChatRecord();
chat.scrollToBottom();
},
onShareAppMessage:function(e) {
console.log(e,'2')
}
})