xiang hace 6 años
padre
commit
d00479c1ad

+ 1 - 1
chat/config/index.js

@@ -21,7 +21,7 @@ module.exports = {
     // },
 
     // Various Dev Server settings
-    host: '192.168.2.190', // can be overwritten by process.env.HOST  localhost 192.168.2.195
+    host: 'localhost', // can be overwritten by process.env.HOST  localhost 192.168.2.195
     port: 8006, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
     autoOpenBrowser: false,
     errorOverlay: true,

+ 2 - 2
pc_chat/src/components/chat.vue

@@ -1576,6 +1576,7 @@
 				this.lockReconnect = true;
 				this.reconnectData && clearTimeout(this.reconnectData);
 				this.reconnectData = setTimeout(() => {
+					this.websocketclose();
 					this.initWebSocket();
 					console.log('-----socket重连-----');
 					this.lockReconnect = false;
@@ -1601,8 +1602,7 @@
 
 			/******************消息发送数据处理********************/
 			sendMessage() {
-				console.log(this.sensitiveNumber,'客服端信息')
-
+			
 				let str = this.information;
 				let formatStr = str.replace(/\n/g, '<br/>');
 				if (str.length > 450) {

+ 1 - 1
service/config/index.js

@@ -52,7 +52,7 @@ module.exports = {
     // Paths
     assetsRoot: path.resolve(__dirname, '../dist'),
     assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
+    assetsPublicPath: './',
 
     /**
      * Source Maps

+ 28 - 7
service/src/App.vue

@@ -19,7 +19,8 @@
 				serverTimeoutObj:null,
 				apiToken:'',
 				linkfailure:true,
-				Messagenum:0
+				Messagenum:0,
+				kfuser_info:{}
 			}
 		},
 		methods:{
@@ -37,6 +38,17 @@
 				this.$websocket.onerror = this.websocketonerror;//链接错误提示
 				this.$websocket.onclose = this.socket_close;//链接断开提示
 			},
+			// 得到保存好的当前客服信息
+			getCustomerUserInfo()
+			{
+
+				if(typeof this.$store.getters.get_user_info  != 'string'){
+					this.kfuser_info = this.$store.getters.get_user_info;
+				}else if(this.$store.getters.get_user_info!= ""){
+					this.kfuser_info =  JSON.parse(this.$store.getters.get_user_info);
+				}
+				return this.kfuser_info;
+			},
 
 			/**************************************/
 			//连接成功
@@ -44,11 +56,7 @@
 				console.log('已经链接');
 				let user_info = '';
 				// console.log(this.$store.getters.get_user_info != "");
-				if(typeof this.$store.getters.get_user_info  != 'string'){
-					user_info = this.$store.getters.get_user_info;
-				}else if(this.$store.getters.get_user_info!= ""){
-					user_info =  JSON.parse(this.$store.getters.get_user_info);
-				}
+				user_info=this.getCustomerUserInfo();
 
 				if(user_info){
 					this.$websocket.send(JSON.stringify({
@@ -75,6 +83,15 @@
 				//this.init()
 				this.reconnect();
 			},
+			getVisitorList(){
+				this.kfuser_info=this.getCustomerUserInfo();
+				this.$websocket.send(JSON.stringify({
+						type: 'kfusersmaps',
+						data: {
+							kfuid:  this.kfuser_info.id
+						}
+					}));
+			},
 
 			/******************************************/
 			//数据接收
@@ -92,12 +109,15 @@
 
 				if(redata.type == "pong") return false;
 				if(redata.type != "pong" || redata.message_type != "ping"){
-					console.log(redata);
+		
 					if(redata.message_type === 'connct') {
 						this.$store.dispatch("SET_SESSSION_USER", redata.data.user_info);
 					}
 				}
+				this.getVisitorList();
+				console.log(redata);
 				let getters = this.$store.getters;
+				console.log({'getters':this.$store})
 				//获取vuex数据
 				let session = getters.get_session;//会话列表
 				let offline  = getters.get_offline;//离线列表
@@ -275,6 +295,7 @@
 				this.$token = '';
 				this.$router.push('/login')
 				this.linkfailure = true;
+				
 				//this.reconnect();
 			},
 

+ 1 - 1
service/src/pages/TheCurrentSession.vue

@@ -700,7 +700,7 @@
 			/***************关闭当前和用户聊天对话***************/
 			open() {
 				let _this = this;
-				console.log(this.sessionList)
+				// console.log(this.sessionList)
 				if (this.sessionType == 1) {
 					if (this.sessionList.length < 1) return
 				} else {

+ 5 - 0
service/static/publicMethods.js

@@ -429,6 +429,9 @@ export default {
 	 */
 	receivesMessage(redata, sessionList, frce, callback) {
 		let dataIndex = 0;
+		if(sessionList.length<1){
+			return -2001;
+		}
 		//匹配是那个用户回的消息
 		for (let i = 0; i < sessionList.length; i++) {
 			if (sessionList[i].id == redata.id) {
@@ -437,8 +440,10 @@ export default {
 			}
 		}
 
+
 		//获取当前回复消息对象
 		let chatList = sessionList[dataIndex]
+
 		redata.type = 'user';
 		redata.content = JSON.parse(redata.content);
 		//这个地方转

+ 3 - 3
service_exe/package.json

@@ -1,7 +1,7 @@
 {
-  "name": "my-project",
+  "name": "kefu",
   "version": "0.0.1",
-  "author": "luke <123456485@qq.com>",
+  "author": "blade <1797929547@qq.com>",
   "description": "An electron-vue project",
   "license": null,
   "main": "./dist/electron/main.js",
@@ -17,7 +17,7 @@
     "postinstall": ""
   },
   "build": {
-    "productName": "my-project",
+    "productName": "智能客服",
     "appId": "com.example.yourapp",
     "directories": {
       "output": "build"

+ 1 - 1
service_exe/src/index.ejs

@@ -2,7 +2,7 @@
 <html>
   <head>
     <meta charset="utf-8">
-    <title>大博客服系统</title>
+    <title>智能客服系统</title>
     <% if (htmlWebpackPlugin.options.nodeModules) { %>
       <!-- Add `node_modules/` to global paths so `require` works properly in development -->
       <script>

+ 2 - 2
service_exe/src/main/index.js

@@ -18,7 +18,7 @@ if (process.env.NODE_ENV !== 'development') {
 
 let mainWindow
 const winURL = process.env.NODE_ENV === 'development'
-	? `http://localhost:9080`
+	? `http://localhost:8000`
 	: `file://${__dirname}/index.html`
 
 function createWindow() {
@@ -40,7 +40,7 @@ function createWindow() {
 	// 图标的上下文菜单
 	const contextMenu = Menu.buildFromTemplate(trayMenuTemplate)
 	// 设置此托盘图标的悬停提示内容
-	tray.setToolTip('欢迎使大博客服系统')
+	tray.setToolTip('欢迎使智能客服系统')
 	// 设置此图标的上下文菜单
 	if (process.platform === 'win32' || process.platform === 'win64') {
 		tray.setContextMenu(contextMenu)