chatbot.js
1.3 KB
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
50
51
52
53
54
55
// components/userinfo/chatbot.js
var plugin = requirePlugin("chatbot");
import util from '../../utils/util'
Component({
/**
* 组件的属性列表
*/
properties: {
params:Object,
},
/**
* 组件的初始数据
*/
data: {
},
/**
* 组件的方法列表
*/
methods: {
userinfo(e){
if(this.hasToChat) return;
this.hasToChat=true
let wechat=e.detail
wechat.openid=wechat.openid||getApp().openid
console.log('userinfo',wechat)
plugin.init({
appid: "sjAZRgrwD86PlVtpMnW16LR1TYy9hi",
openid: wechat.openid, // 小程序的openid,必填项
success: () => {
wx.navigateTo({
url: util.http_build_query(this.data.params,'/pages/me/chat'),
success:()=>{
this.hasToChat=false
},
});
},
fail: (error) => {this.hasToChat=false},
guideList: [],
textToSpeech: false, //默认为ture打开状态
background: "rgba(247,251,252,1)",
guideCardHeight: 40,
operateCardHeight: 60,
history: true,
navHeight: 64,
//robotHeader:"http://nosqn.colorcun.com/logo.png",
userHeader: wechat.avatarUrl,
userName: wechat.nickName,
hideMovableButton: false,
});
}
}
})