Harley há 6 anos atrás
pai
commit
d27340bc89
5 ficheiros alterados com 38 adições e 22 exclusões
  1. BIN
      .DS_Store
  2. 1 1
      chat/src/api/https.js
  3. 15 1
      chat/src/components/index.vue
  4. 19 15
      pc_chat/src/components/chat.vue
  5. 3 5
      service/src/App.vue

BIN
.DS_Store


+ 1 - 1
chat/src/api/https.js

@@ -5,7 +5,7 @@ axios.defaults.timeout = 10000
 // 线上
 let Base = 'https://manage.281570.com'
 // 开发
-//let Base = 'http://sports.5gogo.com'
+//let Base = 'https://sports.5gogo.com'
 function headerUrl (url) {
     url = Base +  url
     return url

+ 15 - 1
chat/src/components/index.vue

@@ -608,7 +608,7 @@
 			//初始化Websocket链接
 			initWebSocket(apiToken) {
 				let sock_ip = ''; // 线上
-				this.websock = new WebSocket("wss://ky.281570.com?apiToken=" + apiToken);
+				this.websock = new WebSocket("wss://link.281570.com?apiToken=" + apiToken);
 				//数据返回
 				this.websock.onmessage = this.socket_message;
 				//数据发送
@@ -623,6 +623,7 @@
 			//连接建立之后执行send方法发送数据
 			socket_open() {
 				console.log('我链接了');
+				this.$dialog.loading.close();
 			},
 
 			/*******************************************/
@@ -839,6 +840,7 @@
 
 				//系统消息通转人工
 				if (redata.message_type == 'notice') {
+					console.log('人工');
 					this.$dialog.loading.close();
 					this.isTurnArtifcial = true;
 					let _this = this;
@@ -958,6 +960,7 @@
 			//关闭
 			socket_close(e) {
 				console.log('断开连接', e);
+				this.nloding('网络接中...');
 				this.initData = 100;
 				this.link_success = false;
 				this.setInit();
@@ -1084,7 +1087,10 @@
 				this.group = id;
 				// this.$dialog.loading.open('转接中...')
 				this.nloding('人工客服转接中');
+				
+			
 				if (this.isTurnArtifcial) {
+
 					let data = {
 						'type': 'userInit',
 						data: {
@@ -1097,6 +1103,14 @@
 					}
 					this.socket_send(JSON.stringify(data));
 					this.isTurnArtifcial = false
+					// if(){
+					// }else{
+					// 	setTimeout(()=>{
+					// 		this.socket_send(JSON.stringify(data));
+					// 		this.isTurnArtifcial = false
+					// 	})
+					// }
+
 				}
 			},
 

+ 19 - 15
pc_chat/src/components/chat.vue

@@ -648,10 +648,8 @@
 				jumpName: '', // 根据类型提示售后服务名称
 				waitingMsg: false, // 是否显示等待排队
 				waitingText: "", // 等待内容
-
 				service_on: true, // 现在状态
 				avatarImg: fk,
-
 				dialogPaste: false,
 				pasteUrl: '',//截屏图片
 				fit: 'contain', // 图片样式
@@ -1112,9 +1110,9 @@
 				this.loadingobj.close();
 			},
 
-			/***************转人工客服列表*************** */
+			/***************获取转人工客服列表*************** */
 			changeService() {
-				this.nloding("转人工客服中请等待");
+				this.nloding("加载人工客服列表请等待");
 				// if(!this.isConnection) return
 				this.$axios.post('/api/index/groups/index', {}, {
 					headers: {
@@ -1210,7 +1208,7 @@
 			initWebSocket() {
 				let _this = this;
 				let apiToken = this.$md5.hex_md5('customer-service' + window.location.origin);
-				this.websock = new WebSocket('wss://ky.281570.com?apiToken=' + apiToken);
+				this.websock = new WebSocket('wss://link.281570.com?apiToken=' + apiToken);
 				// console.log(this.websock)
 				this.websock.debug = true;
 				// 数据接收
@@ -1226,6 +1224,7 @@
 			/****************连接建立成功***************/
 			websocketonopen() {
 				console.log('链接成功');
+				this.closeNloading();
 				// 如果有传 group_id 直接跳转人工客服
 				let group_id = this.$public.getQueryString("group_id");
 				if (group_id) {
@@ -1460,17 +1459,21 @@
 					this.automaticRolling();
 					this.machineAndAtl = 10;
 					this.jumpArtl = false;
-					
 					this.Onlinemsg = redata.content;
 
-					this.$alert(this.jumpName + this.Onlinemsg, '系统提示', {
-						confirmButtonText: '确定',
-						dangerouslyUseHTMLString: true
-					}).then(() => {
-						this.closeNloading();
-					}).catch((err) => {
-						this.closeNloading();
-					});
+					if(this.group == 99999){
+						this.$alert(this.jumpName + this.Onlinemsg, '系统提示', {
+							confirmButtonText: '确定',
+							dangerouslyUseHTMLString: true
+						}).then(() => {
+							this.closeNloading();
+						}).catch((err) => {
+							this.closeNloading();
+						});
+					}else{
+						this.jumpService(99999,this.jumpName); 
+					}
+
 				}
 				// 客服关闭会话.
 				if (redata.message_type == 'closeBysever') {
@@ -1572,7 +1575,8 @@
 
 			/************关闭会话*******************/
 			websocketclose(e) {
-				console.log('websocket 关闭会话: ' + e.code, e)
+				console.log('hahahahahah');
+				this.nloding('网路链接中....');
 				this.goBack();
 			},
 

+ 3 - 5
service/src/App.vue

@@ -28,7 +28,7 @@
 			//初始化weosocket
 			initWebSocket(apiToken) {
 				// 书写接口信息
-				const wsuri = "wss://ky.281570.com?apiToken=" + apiToken;//www.service.com 线上
+				const wsuri = "wss://link.281570.com?apiToken=" + apiToken;//www.service.com 线上
 				// 创建websocket实例
 				Vue.prototype.$websocket = new WebSocket(wsuri);
 				this.$websocket.onopen = this.websocketonopen; //连接成功
@@ -52,10 +52,8 @@
 			websocketonopen() {
 				console.log('已经链接');
 				let user_info = '';
-				// console.log(this.$store.getters.get_user_info != "");
 				user_info=this.getCustomerUserInfo();
-
-				if(user_info){
+				if(user_info.token){
 					this.$websocket.send(JSON.stringify({
 						type: 'init',
 						data: {
@@ -94,6 +92,7 @@
 			//数据接收
 			websocketonmessage(e){
 				this.heatBeat();//收到消息会刷新心跳检测,如果一直收到消息,就推迟心跳发送
+				if(typeof e.data != 'string' ||  e.data=='') return
 				const redata = JSON.parse(e.data);//接收数据源
 				if(!redata) {
 					return
@@ -203,7 +202,6 @@
 						message: '访客已退出会话',
 						type: 'warning'
 					});
-
 					let _this =this;
 					let	arr= [
 						redata.data,