Bladeren bron

实时转义代码,功能隐藏

miaofuhao 3 jaren geleden
bovenliggende
commit
c17a8407b6

+ 43 - 2
WebUI/CallCenterWeb.UI/home.html

@@ -22,7 +22,7 @@
22 22
 		<link rel="stylesheet" href="./css/bootstrap-select.css" />
23 23
 		<link rel="stylesheet" href="./js/layui/css/layui.css">
24 24
 		<link rel="stylesheet" type="text/css" href="./css/home.css" />
25
-
25
+		<link rel="stylesheet" type="text/css" href="./js/voiceToText.css"/>
26 26
 	</head>
27 27
 
28 28
 	<body class="fixed-sidebar full-height-layout gray-bg" style="overflow: hidden">
@@ -1229,7 +1229,44 @@
1229 1229
 				</li>
1230 1230
 			</ul>
1231 1231
 		</div>
1232
-
1232
+		<div id="clickElementVoice" style="display: none;">展开</div>
1233
+		<div class="voiceToText" style="display: none;">
1234
+			<div class="voiceToTextTitle">坐席辅助</div>
1235
+			<div class="voiceToTextContext" id="scrollVoice">
1236
+				<div class="clientChat">
1237
+					<img src="img/youkeTx.png">
1238
+					<div class="clientChatText">你好</div>
1239
+				</div>
1240
+				<div class="serviceChat">
1241
+					<img src="img/kefuTx.png">
1242
+					<div class="serviceChatText">你好,有什么要咨询的吗</div>
1243
+				</div>
1244
+				<div class="clientChat">
1245
+					<img src="img/youkeTx.png">
1246
+					<div class="clientChatText">你好</div>
1247
+				</div>
1248
+				<div class="serviceChat">
1249
+					<img src="img/kefuTx.png">
1250
+					<div class="serviceChatText">你好,有什么要咨询的吗</div>
1251
+				</div>
1252
+				<div class="clientChat">
1253
+					<img src="img/youkeTx.png">
1254
+					<div class="clientChatText">你好</div>
1255
+				</div>
1256
+				<div class="serviceChat">
1257
+					<img src="img/kefuTx.png">
1258
+					<div class="serviceChatText">你好,有什么要咨询的吗</div>
1259
+				</div>
1260
+				<div class="clientChat">
1261
+					<img src="img/youkeTx.png">
1262
+					<div class="clientChatText">你好</div>
1263
+				</div>
1264
+				<div class="serviceChat">
1265
+					<img src="img/kefuTx.png">
1266
+					<div class="serviceChatText">你好,有什么要咨询的吗</div>
1267
+				</div>
1268
+			</div>
1269
+		</div>
1233 1270
 		<script src="https://api.map.baidu.com/api?v=2.0&ak=ZG4gLQZUD6Eq1K11cqlYAR4by8CKgLyu&callback=mapinit"></script>
1234 1271
 		<script src="./js/layui/layui.js"></script>
1235 1272
 		<script src="./js/plugins/cropper/cropper.min.js"></script>
@@ -1240,6 +1277,7 @@
1240 1277
 		<script src="./js/websocket/swfobject.js?v=2.0"></script>
1241 1278
 		<script src="./js/websocket/web_socket.js?v=2.0"></script>
1242 1279
 		<script src="./js/main.js?v=2.1"></script>
1280
+		<!--<script src="./js/vc_agent_api.js"></script>-->
1243 1281
 		<script src="./js/chat.js"></script>
1244 1282
 		<script src="./js/index.js?v=2.0"></script>
1245 1283
 		<script src="./js/appeal/mapIndex.js"></script>
@@ -1249,6 +1287,9 @@
1249 1287
 		<script src="./js/contabs.min.js"></script>
1250 1288
 		<script src="./js/zTree/jquery.ztree.core.js"></script>
1251 1289
 		<script src="./js/ztreeSelect.js"></script>
1290
+		<script src="js/voiceToText.js"></script>
1291
+		
1292
+		<!--<script  src="./js/voiceToTextSocket/socket.js"></script>-->
1252 1293
 		<script>
1253 1294
 			var logpas = localStorage.getItem('loginPassword')
1254 1295
 			var userphone = $.cookie('userMobile')

+ 88 - 0
WebUI/CallCenterWeb.UI/js/voiceToText.css

@@ -0,0 +1,88 @@
1
+.voiceToText{
2
+	width: 350px;
3
+	height: 100%;
4
+	position: fixed;
5
+	border: 1px solid #CCCCCC;
6
+	background: #FFFFFF;
7
+	bottom: 0;
8
+	right: 0;
9
+	z-index: 1111;
10
+}
11
+#clickElementVoice{
12
+	border: 1px solid #CCCCCC;
13
+	
14
+	background: #048aad;
15
+	color: #FFFFFF;
16
+	width: 30px;
17
+	text-align: center;
18
+	font-size: 16px;
19
+	position: fixed;
20
+	top: 70%;
21
+	right: 0px;
22
+	line-height: 30px;
23
+	margin-top: -30px;
24
+	border-radius: 6px 0px 0px 6px;
25
+	z-index: 1112;
26
+	padding: 7px;
27
+	
28
+}
29
+.voiceToTextTitle{
30
+	width: 100%;
31
+	position: absolute;
32
+	top: 0;
33
+	height: 60px;
34
+	line-height: 60px;
35
+	border-bottom: 1px solid #CCCCCC;
36
+	text-align: center;
37
+	font-size: 18px;
38
+}
39
+.voiceToTextContext{
40
+	margin-top: 80px;
41
+	scrollbar-width: none;
42
+	overflow-y:scroll;
43
+	/*flex-direction: column-reverse;*/
44
+	height:  calc(100% - 80px);
45
+}
46
+.voiceToTextContext::-webkit-scrollbar {
47
+  display: none; /* Chrome Safari */
48
+}
49
+.clientChat{
50
+	width: 100%;
51
+	margin-top: 8px;
52
+	overflow: hidden;
53
+}
54
+.clientChat img{
55
+	width: 40px;
56
+	border-radius: 20px;
57
+	float: left;
58
+}
59
+.clientChat .clientChatText{
60
+	float: left;
61
+	display: inline-block;
62
+	margin-left: 15px;
63
+	background: #bde0ff;
64
+	border-radius: 0px 5px 5px 5px ;
65
+	padding: 8px;
66
+}
67
+.serviceChat{
68
+	width: 100%;
69
+	margin-top: 8px;
70
+	overflow: hidden;
71
+}
72
+.serviceChat img{
73
+	width: 40px;
74
+	border-radius: 20px;
75
+	float: right;
76
+}
77
+.serviceChat .serviceChatText{
78
+	float: right;
79
+	margin-right: 15px;
80
+	display: inline-block;
81
+	border: 1px solid #CCCCCC;
82
+	border-radius: 5px 0px 5px 5px ;
83
+	padding: 8px;
84
+}
85
+
86
+
87
+
88
+

+ 162 - 0
WebUI/CallCenterWeb.UI/js/voiceToText.js

@@ -0,0 +1,162 @@
1
+
2
+var clientChatHtml = ''
3
+var serviceChatHtml = ''
4
+var objVoice ={
5
+	agent_id:'8000',
6
+	timestamp:new Date().getTime(),
7
+	data:''
8
+}
9
+//VoiceCommAPI.setConfigureServer("http://配置服务器 URL");
10
+//var agent = VoiceCommAPI.createAgentControl();
11
+//agent.login(objVoice);
12
+//agent.setDetectSpeechEventListener(objVoice,function(data){})
13
+//agent.on('setDetectSpeechEventListener',function(data){})
14
+
15
+setTimeout(function(){
16
+	
17
+	for(var i = 0; i < voiceToTextContextAway.length; i++) {
18
+		if (voiceToTextContextAway[i].type=="clientChat") {
19
+			$('<div class="clientChat"><img src="img/youkeTx.png"><div class="clientChatText">'+
20
+			voiceToTextContextAway[i].clientChat+'</div></div>').appendTo($(".voiceToTextContext"));
21
+		} else if(voiceToTextContextAway[i].type=="serviceChat"){
22
+			$('<div class="serviceChat"><img src="img/kefuTx.png"><div class="serviceChatText">'+
23
+			voiceToTextContextAway[i].serviceChat+'</div></div>').appendTo($(".voiceToTextContext"));
24
+		}
25
+	}
26
+	
27
+	scrollTopFn("scrollVoice")
28
+},2000)
29
+$("#clickElementVoice").click(function(){
30
+	var elThis = $(this)
31
+	voiceTextToggle(elThis,1000)
32
+	$(".voiceToText").toggle(1000)
33
+})
34
+function voiceTextToggle(elThis,timeToggle){
35
+	if (elThis.text() === '隐藏') {
36
+		elThis.text( '展开')
37
+		elThis.css({
38
+			"right":"0px",
39
+			"top":"70%"
40
+		})
41
+	}else if(elThis.text() === '展开'){
42
+		elThis.text( '隐藏')
43
+		elThis.css({
44
+			"right":"348px",
45
+			"top":"50%"
46
+		})
47
+		
48
+	}
49
+	showFn(elThis,timeToggle)
50
+}
51
+function scrollTopFn(el){
52
+	scrollVoice = document.getElementById(el)
53
+	scrollVoice.scrollTop  = scrollVoice.scrollHeight
54
+}
55
+function showFn(el,timeToggle){
56
+	var timeoutShow= null
57
+	el.hide()
58
+	 clearTimeout(timeoutShow)
59
+	 timeoutShow = setTimeout(function(){
60
+		el.show()
61
+		scrollTopFn("scrollVoice")
62
+		timeoutShow= null
63
+	},timeToggle)
64
+}
65
+var voiceToTextContextAway = [
66
+	{
67
+		type:"clientChat",
68
+		clientChat:'你知道2020年我最宝贵的是什么吗'
69
+	},
70
+	{
71
+		type:"serviceChat",
72
+		serviceChat:'什么哟'
73
+	},
74
+	{
75
+		type:"clientChat",
76
+		clientChat:'我刚说的那句话的第一个字'
77
+	},
78
+	{
79
+		type:"clientChat",
80
+		clientChat:'啊 我的心好痛'
81
+	},
82
+	{
83
+		type:"serviceChat",
84
+		serviceChat:'怎么了'
85
+	},
86
+	{
87
+		type:"clientChat",
88
+		clientChat:'你卡在我心上了'
89
+	},
90
+	{
91
+		type:"clientChat",
92
+		clientChat:'我第一次见到你我就发烧了'
93
+	},
94
+	{
95
+		type:"serviceChat",
96
+		serviceChat:'为什么'
97
+	},
98
+	{
99
+		type:"clientChat",
100
+		clientChat:'因为一见钟情的体温是38°6啊'
101
+	},
102
+	{
103
+		type:"clientChat",
104
+		clientChat:'你知道我现在最想喝什么吗?'
105
+	},
106
+	{
107
+		type:"serviceChat",
108
+		serviceChat:'喝什么?'
109
+	},
110
+	{
111
+		type:"clientChat",
112
+		clientChat:'呵护你。'
113
+	},
114
+	{
115
+		type:"clientChat",
116
+		clientChat:'我觉得我好像见过你'
117
+	},
118
+	{
119
+		type:"serviceChat",
120
+		serviceChat:'在哪?'
121
+	},
122
+	{
123
+		type:"clientChat",
124
+		clientChat:'在我的结婚证上'
125
+	},
126
+	{
127
+		type:"clientChat",
128
+		clientChat:'你喜欢吃糖吗'
129
+	},
130
+	{
131
+		type:"serviceChat",
132
+		serviceChat:'不喜欢'
133
+	},
134
+	{
135
+		type:"clientChat",
136
+		clientChat:'那为什么你还这么甜'
137
+	},
138
+	{
139
+		type:"clientChat",
140
+		clientChat:'你跑的快吗?'
141
+	},
142
+	{
143
+		type:"serviceChat",
144
+		serviceChat:'不太快。'
145
+	},
146
+	{
147
+		type:"clientChat",
148
+		clientChat:'那太好了,我一定能追到你。'
149
+	},
150
+	{
151
+		type:"clientChat",
152
+		clientChat:'有一个很美的故事'
153
+	},
154
+	{
155
+		type:"serviceChat",
156
+		serviceChat:'什么故事'
157
+	},
158
+	{
159
+		type:"clientChat",
160
+		clientChat:'就是你遇见我的事'
161
+	},
162
+]

+ 55 - 0
WebUI/CallCenterWeb.UI/js/voiceToTextSocket/socket.js

@@ -0,0 +1,55 @@
1
+var socketVoice = []; //websocket对象数组
2
+var getTimeStringVoice = new Date().getTime().toString();
3
+var objNew ={}
4
+//connectVoice(); //创建连接 
5
+//创建socket连接功能函数  
6
+function connectVoice(wsobj) {
7
+	//浏览器支持?
8
+	if("WebSocket" in window) {
9
+		var host = "ws://218.29.229.185:8081/"
10
+		socketVoice = new WebSocket(host);
11
+		try {
12
+			//连接事件
13
+			socketVoice.onopen = function(msg) {
14
+				console.log(wsobj + ":连接已建立!")
15
+				videoReqExten()
16
+			};
17
+			//错误事件	
18
+			socketVoice.onerror = function(msg) {
19
+				console.log("错误:" + msg.data)
20
+			}
21
+			//消息事件
22
+			socketVoice.onmessage = function(msg) {
23
+				console.log(wsobj+"消息接收:"+msg.data)
24
+			};
25
+			//关闭事件
26
+			socketVoice.onclose = function(msg) {
27
+				console.log(wsobj + ":socket closed!")
28
+			};
29
+		} catch(ex) {
30
+			log(ex);
31
+		}
32
+	} else {
33
+		// 浏览器不支持 WebSocket
34
+		alert("您的浏览器不支持 WebSocket!");
35
+	}
36
+
37
+}
38
+//申请注册的分机
39
+ function videoReqExten() {
40
+ 	objNew.Type = "VideoReqExten";
41
+ 	objNew.AgentID = getTimeStringVoice.substring(getTimeStringVoice.length-9);
42
+	objNew.AgentExten = "111";
43
+ 	SendVoice()
44
+ }
45
+ //发送
46
+function SendVoice() {
47
+    if (socketVoice.readyState != socketVoice.OPEN) {
48
+        reconnect();
49
+    }
50
+    if (socketVoice.readyState ==socketVoice.OPEN) {
51
+        console.log(new Date() + "  send  " + JSON.stringify(objNew));
52
+        socketVoice.send(JSON.stringify(objNew));
53
+        objNew.Type = "";
54
+    }
55
+}

+ 0 - 1
WebUI/CallCenterWeb.UI/login.html

@@ -324,7 +324,6 @@
324 324
 					$('.tab_content').children('div').eq(index).show().siblings().hide();
325 325
 
326 326
 				})
327
-
328 327
 				/*cook存储数据*/
329 328
 				if($.cookie("username")) {
330 329
 					//取值如果存在则赋值