service.html
7.2 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
<title></title>
<script src="../../assets/js/fontsize.js"></script>
<!--<link rel="stylesheet" href="../../assets/css/api.css"/>-->
<!--<link rel="stylesheet" href="http://at.alicdn.com/t/font_641470_jg64l6ijsg4lsor.css">-->
<link rel="stylesheet" href="../../assets/icon/iconfont.css">
<style>
body, html {
background-color: transparent !important;
height: 100%;
color: #dbb25f;
}
.send_box {
position: fixed;
width: 100%;
bottom: 0;
left: 0;
background-color: #fff;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0.13rem 0 0.13rem 0.31rem;
font-size: 10px;
color: #424242;
}
.send_box input {
border: 1px solid #DEDEDE;
padding: 0.1rem;
flex: 1;
}
.msg {
font-size: 12px;
color: #fff;
background-color: #D8B25F;
padding: 0.1rem 0.3rem;
margin-left: 0.5rem;
}
</style>
</head>
<body>
<div id="app">
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/swiper-3.4.2.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script src="http(s)://cdn.ronghub.com/RongIMLib-2.3.3.min.js"></script>
<!--<script type="text/javascript" src="http://at.alicdn.com/t/font_641470_jg64l6ijsg4lsor.js"></script>-->
<script>
var app = new Vue({
el: '#app',
data: {
rongYunToken: '',
textContent: '',
userId: '',
user_info: []
},
created: function () {
apiready = function () {
app.getUserIndexInfo();
app.getRongYunToken();
app.openSever();
}
},
methods: {
close: function () {
api.closeFrame();
},
getRongYunToken: function () {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'portal/RongYun/index', null, header).then(function (res) {
if (res.data.code == 1) {
app.rongYunToken = res.data.data.token;
app.userId = res.data.data.userId;
app.rongyunInit();
} else {
toastMsg(res.data.msg)
}
})
},
getUserIndexInfo: function () {
var header = {
"XX-Device-Type": getDevice(),
'XX-Token': getToken()
};
getRequest('post', 'user/index/getUserIndexInfo', null, header).then(function (res) {
if (res.data.code == 1) {
app.user_info = res.data.data;
// alert(JSON.stringify(app.user_info))
} else {
toastMsg(res.data.msg)
}
})
},
openSever: function () {
var app = this;
app.img_active = false;
app.getRongYunToken();
function callBack(ret, err) {
// alert("ret.type="+ret.type+"value="+ret.value+"ret.desc="+ret.desc);
if (ret.type == 1) {
api.closeWin();
}
}
var param = {
appkey: "1da38c74bc3746cea6b767727683ca83",
titleImgId: '#dbb25f',
themeColor: '#dbb25f',
backgroundColor: '#f8f9f8',
userId: app.userId,
customBannerColor: '#dbb25f',
nickName: "",
phone: "",
email: "",
customInfo: {"uname": app.user_info.name, 'avatarUrl': app.user_info.avatar},
transferKeyWord: '人工服务,人工,电话',
isShowEvaluate: true,
isSettingSkillSet: false,
skillSetId: "",
customUserOutWord: '欢迎再次咨询',
customAdminTipWord: '请稍等... 正在查询资料',
customAdminNonelineTitle: '人工客服忙~',
isShowTansfer: true,
titleFont: 18.0,
bottomLineColor: '#dbb25f',
goodsTitle: '56870',
goodsLabel: '123456',
goodsImage: '../../assets/image/head.png',
goodsFromUrl: 'http://www.baidu.com',
isDebugMode: 'YES'
};
var zhichi = api.require('zhiChiSobot');
zhichi.startZhiChiSobot(param, callBack);
},
rongyunInit: function () {
rong.init(function (ret, err) {
if (ret.status == 'error') {
} else {
rong.connect({
token: app.rongYunToken
}, function (ret_connect, err_connect) {
if (ret_connect.status == 'success') {
// app.userId = ret_connect.result.userId
}
else {
}
});
}
});
},
// sendMsg: function () {
// var rong = api.require('rongCloud2');
//
// // 之前调用 init 和 connect 的代码省略
// rong.sendTextMessage({
// conversationType: 'CUSTOMER_SERVICE',
// targetId: app.userId,
// text: app.textContent,
// extra: ''
// }, function (ret, err) {
// if (ret.status == 'prepare')
// api.toast({msg: JSON.stringify(ret.result.message)});
// else if (ret.status == 'success')
// api.toast({msg: ret.result.message.messageId});
// else if (ret.status == 'error')
// api.toast({msg: err.code});
// });
// }
}
})
</script>