浏览代码

update server

luke 6 年之前
父节点
当前提交
1556e93751
共有 4 个文件被更改,包括 298 次插入269 次删除
  1. 57 57
      service/config/index.js
  2. 41 16
      service/package-lock.json
  3. 193 193
      service/src/App.vue
  4. 7 3
      service/src/pages/login.vue

+ 57 - 57
service/config/index.js

@@ -5,74 +5,74 @@
 const path = require('path')
 
 module.exports = {
-  dev: {
+	dev: {
 
-    // Paths
-    assetsSubDirectory: 'static',
-    assetsPublicPath: '/',
-    proxyTable: {
-      '/api': {
-        target: 'http://103.108.43.176:8080', // 后台访问地址 http://kfadmin.bocai186.com
-        //target:'http://192.168.2.186:8090', // 后台访问地址http://192.168.2.186:8090
-        // changeOrigin: true,
-        pathRewrite: {
-          '^/api': ''
-        }
-      }
-    },
+		// Paths
+		assetsSubDirectory: 'static',
+		assetsPublicPath: '/',
+		proxyTable: {
+			'/api': {
+				target: 'http://103.108.43.176:8080', // 后台访问地址 http://kfadmin.bocai186.com
+				// target:'http://192.168.2.187:8090', // 后台访问地址http://192.168.2.186:8090
+				// changeOrigin: true,
+				pathRewrite: {
+					'^/api': ''
+				}
+			}
+		},
 
-    // Various Dev Server settings
-    host: '192.168.2.161', // can be overwritten by process.env.HOST //192.168.2.163
-    port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
-    autoOpenBrowser: false,
-    errorOverlay: true,
-    notifyOnErrors: true,
-    poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
+		// Various Dev Server settings
+		host: 'localhost', // can be overwritten by process.env.HOST //192.168.2.163
+		port: 8000, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
+		autoOpenBrowser: false,
+		errorOverlay: true,
+		notifyOnErrors: true,
+		poll: false, // https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
 
 
-    /**
-     * Source Maps
-     */
+		/**
+		 * Source Maps
+		 */
 
-    // https://webpack.js.org/configuration/devtool/#development
-    devtool: 'cheap-module-eval-source-map',
+		// https://webpack.js.org/configuration/devtool/#development
+		devtool: 'cheap-module-eval-source-map',
 
-    // If you have problems debugging vue-files in devtools,
-    // set this to false - it *may* help
-    // https://vue-loader.vuejs.org/en/options.html#cachebusting
-    cacheBusting: true,
+		// If you have problems debugging vue-files in devtools,
+		// set this to false - it *may* help
+		// https://vue-loader.vuejs.org/en/options.html#cachebusting
+		cacheBusting: true,
 
-    cssSourceMap: true
-  },
+		cssSourceMap: true
+	},
 
-  build: {
-    // Template for index.html
-    index: path.resolve(__dirname, '../dist/index.html'),
+	build: {
+		// Template for index.html
+		index: path.resolve(__dirname, '../dist/index.html'),
 
-    // Paths
-    assetsRoot: path.resolve(__dirname, '../dist'),
-    assetsSubDirectory: 'static',
-    assetsPublicPath: './',
+		// Paths
+		assetsRoot: path.resolve(__dirname, '../dist'),
+		assetsSubDirectory: 'static',
+		assetsPublicPath: './',
 
-    /**
-     * Source Maps
-     */
+		/**
+		 * Source Maps
+		 */
 
-    productionSourceMap: true,
-    // https://webpack.js.org/configuration/devtool/#production
-    devtool: '#source-map',
+		productionSourceMap: true,
+		// https://webpack.js.org/configuration/devtool/#production
+		devtool: '#source-map',
 
-    // Gzip off by default as many popular static hosts such as
-    // Surge or Netlify already gzip all static assets for you.
-    // Before setting to `true`, make sure to:
-    // npm install --save-dev compression-webpack-plugin
-    productionGzip: false,
-    productionGzipExtensions: ['js', 'css'],
+		// Gzip off by default as many popular static hosts such as
+		// Surge or Netlify already gzip all static assets for you.
+		// Before setting to `true`, make sure to:
+		// npm install --save-dev compression-webpack-plugin
+		productionGzip: false,
+		productionGzipExtensions: ['js', 'css'],
 
-    // Run the build command with an extra argument to
-    // View the bundle analyzer report after build finishes:
-    // `npm run build --report`
-    // Set to `true` or `false` to always turn it on or off
-    bundleAnalyzerReport: process.env.npm_config_report
-  }
+		// Run the build command with an extra argument to
+		// View the bundle analyzer report after build finishes:
+		// `npm run build --report`
+		// Set to `true` or `false` to always turn it on or off
+		bundleAnalyzerReport: process.env.npm_config_report
+	}
 }

+ 41 - 16
service/package-lock.json

@@ -256,7 +256,8 @@
     "assert-plus": {
       "version": "1.0.0",
       "resolved": "https://registry.npm.taobao.org/assert-plus/download/assert-plus-1.0.0.tgz",
-      "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
+      "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
+      "optional": true
     },
     "assign-symbols": {
       "version": "1.0.0",
@@ -1917,6 +1918,7 @@
       "version": "1.0.8",
       "resolved": "https://registry.npm.taobao.org/combined-stream/download/combined-stream-1.0.8.tgz",
       "integrity": "sha1-w9RaizT9cwYxoRCoolIGgrMdWn8=",
+      "optional": true,
       "requires": {
         "delayed-stream": "~1.0.0"
       }
@@ -3266,7 +3268,8 @@
     "delayed-stream": {
       "version": "1.0.0",
       "resolved": "https://registry.npm.taobao.org/delayed-stream/download/delayed-stream-1.0.0.tgz",
-      "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+      "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
+      "optional": true
     },
     "depd": {
       "version": "1.1.2",
@@ -3942,7 +3945,8 @@
     "extsprintf": {
       "version": "1.3.0",
       "resolved": "https://registry.npm.taobao.org/extsprintf/download/extsprintf-1.3.0.tgz",
-      "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
+      "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
+      "optional": true
     },
     "fast-deep-equal": {
       "version": "1.1.0",
@@ -4252,7 +4256,8 @@
         "ansi-regex": {
           "version": "2.1.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "aproba": {
           "version": "1.2.0",
@@ -4273,12 +4278,14 @@
         "balanced-match": {
           "version": "1.0.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "brace-expansion": {
           "version": "1.1.11",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "balanced-match": "^1.0.0",
             "concat-map": "0.0.1"
@@ -4293,17 +4300,20 @@
         "code-point-at": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "concat-map": {
           "version": "0.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "console-control-strings": {
           "version": "1.1.0",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "core-util-is": {
           "version": "1.0.2",
@@ -4420,7 +4430,8 @@
         "inherits": {
           "version": "2.0.3",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "ini": {
           "version": "1.3.5",
@@ -4432,6 +4443,7 @@
           "version": "1.0.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "number-is-nan": "^1.0.0"
           }
@@ -4446,6 +4458,7 @@
           "version": "3.0.4",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "brace-expansion": "^1.1.7"
           }
@@ -4453,12 +4466,14 @@
         "minimist": {
           "version": "0.0.8",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "minipass": {
           "version": "2.3.5",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "safe-buffer": "^5.1.2",
             "yallist": "^3.0.0"
@@ -4477,6 +4492,7 @@
           "version": "0.5.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "minimist": "0.0.8"
           }
@@ -4557,7 +4573,8 @@
         "number-is-nan": {
           "version": "1.0.1",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "object-assign": {
           "version": "4.1.1",
@@ -4569,6 +4586,7 @@
           "version": "1.4.0",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "wrappy": "1"
           }
@@ -4654,7 +4672,8 @@
         "safe-buffer": {
           "version": "5.1.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "safer-buffer": {
           "version": "2.1.2",
@@ -4690,6 +4709,7 @@
           "version": "1.0.2",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "code-point-at": "^1.0.0",
             "is-fullwidth-code-point": "^1.0.0",
@@ -4709,6 +4729,7 @@
           "version": "3.0.1",
           "bundled": true,
           "dev": true,
+          "optional": true,
           "requires": {
             "ansi-regex": "^2.0.0"
           }
@@ -4752,12 +4773,14 @@
         "wrappy": {
           "version": "1.0.2",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         },
         "yallist": {
           "version": "3.0.3",
           "bundled": true,
-          "dev": true
+          "dev": true,
+          "optional": true
         }
       }
     },
@@ -5704,7 +5727,8 @@
     "jsbn": {
       "version": "0.1.1",
       "resolved": "https://registry.npm.taobao.org/jsbn/download/jsbn-0.1.1.tgz",
-      "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM="
+      "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+      "optional": true
     },
     "jsesc": {
       "version": "1.3.0",
@@ -10969,7 +10993,8 @@
     "tweetnacl": {
       "version": "0.14.5",
       "resolved": "https://registry.npm.taobao.org/tweetnacl/download/tweetnacl-0.14.5.tgz",
-      "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q="
+      "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+      "optional": true
     },
     "type": {
       "version": "1.0.1",

+ 193 - 193
service/src/App.vue

@@ -1,82 +1,82 @@
 <template>
-  <div id="app">
-    <transition name='fade' mode="out-in">
-      <router-view/>
-    </transition>
-  </div>
+	<div id="app">
+		<transition name='fade' mode="out-in">
+			<router-view/>
+		</transition>
+	</div>
 </template>
 
 <script>
-import Vue from 'vue';
-export default {
-  name: 'App',
-  // apiToken:'',//WebSocket链接凭证
-  // time:'',
-  data(){
-    return{
-      reconnectData:null,
-      lockReconnect:false,    //避免重复连接,因为onerror之后会立即触发 onclose
-      timeout:10000,          //10s一次心跳检测
-      timeoutObj:null,
-      serverTimeoutObj:null,
-      apiToken:'',
-      linkfailure:true,
+	import Vue from 'vue';
+	export default {
+		name: 'App',
+		// apiToken:'',//WebSocket链接凭证
+		// time:'',
+		data(){
+			return{
+				reconnectData:null,
+				lockReconnect:false,    //避免重复连接,因为onerror之后会立即触发 onclose
+				timeout:10000,          //10s一次心跳检测
+				timeoutObj:null,
+				serverTimeoutObj:null,
+				apiToken:'',
+				linkfailure:true,
 
-    }
-  },
-  methods:{
-    /**************************************/
-    //初始化weosocket
-    initWebSocket(apiToken) {
-      // 书写接口信息
-      const wsuri = "ws://103.108.43.176:9101?apiToken=" + apiToken;//www.service.com 线上
-      //const wsuri = "ws://192.168.2.187:9101?apiToken=" + apiToken;//www.service.com //192.168.2.186 本地
-      // 创建websocket实例
-      Vue.prototype.$websocket = new WebSocket(wsuri);
-      this.$websocket.onopen = this.websocketonopen; //连接成功
-      this.$websocket.onmessage = this.websocketonmessage; //接收消息
-      this.$websocket.onerror = this.websocketonerror;//链接错误提示
-      this.$websocket.onclose = this.socket_close;//链接断开提示
-    },
+			}
+		},
+		methods:{
+			/**************************************/
+			//初始化weosocket
+			initWebSocket(apiToken) {
+				// 书写接口信息
+				const wsuri = "ws://103.108.43.176:9101?apiToken=" + apiToken;//www.service.com 线上
+				// const wsuri = "ws://192.168.2.187:9101?apiToken=" + apiToken;//www.service.com //192.168.2.186 本地
+				// 创建websocket实例
+				Vue.prototype.$websocket = new WebSocket(wsuri);
+				this.$websocket.onopen = this.websocketonopen; //连接成功
+				this.$websocket.onmessage = this.websocketonmessage; //接收消息
+				this.$websocket.onerror = this.websocketonerror;//链接错误提示
+				this.$websocket.onclose = this.socket_close;//链接断开提示
+			},
 
-    
-    /**************************************/
-    //连接成功
-    websocketonopen() {
-      console.log('已经链接');
-      Vue.prototype.$socket_open = true;
-      this.heatBeat();
-    },
 
-    /*******************************************/  
-    //连接关闭触发
-    socket_close(e){  
-      console.log('断开连接',e);
-      //this.init()
-      this.reconnect();
-    },
+			/**************************************/
+			//连接成功
+			websocketonopen() {
+				console.log('已经链接');
+				Vue.prototype.$socket_open = true;
+				this.heatBeat();
+			},
 
-    /******************************************/
-    //数据接收
-    websocketonmessage(e){
-      this.heatBeat();//收到消息会刷新心跳检测,如果一直收到消息,就推迟心跳发送
-      const redata = JSON.parse(e.data);//接收数据源
-      if(redata.type != "pong"){
-        console.log(redata);
-      }
-      let  getters = this.$store.getters;
-      //获取vuex数据
-      let session = getters.get_session;//会话列表
-      let offline  = getters.get_offline;//离线列表
-      let sessionType  = getters.get_type;//选择状态(会话/离线)
-      let dataIndex  = getters.get_num;//列表下标
-      let current_session  = getters.get_current;//当前会话
-      let session_name  = getters.get_session_name;//当前用户名
-      
-      if(e.data.type == "pong" ) return
-      this.$store.dispatch("SET_SESSION_MESSAGE",JSON.parse(e.data));
+			/*******************************************/
+			//连接关闭触发
+			socket_close(e){
+				console.log('断开连接',e);
+				//this.init()
+				this.reconnect();
+			},
 
-      	// 用户接入数据
+			/******************************************/
+			//数据接收
+			websocketonmessage(e){
+				this.heatBeat();//收到消息会刷新心跳检测,如果一直收到消息,就推迟心跳发送
+				const redata = JSON.parse(e.data);//接收数据源
+				if(redata.type != "pong"){
+					console.log(redata);
+				}
+				let  getters = this.$store.getters;
+				//获取vuex数据
+				let session = getters.get_session;//会话列表
+				let offline  = getters.get_offline;//离线列表
+				let sessionType  = getters.get_type;//选择状态(会话/离线)
+				let dataIndex  = getters.get_num;//列表下标
+				let current_session  = getters.get_current;//当前会话
+				let session_name  = getters.get_session_name;//当前用户名
+
+				if(e.data.type == "pong" ) return
+				this.$store.dispatch("SET_SESSION_MESSAGE",JSON.parse(e.data));
+
+				// 用户接入数据
 				if(redata.message_type == "connect"){
 					let _this  = this;
 					let arr =[
@@ -90,8 +90,8 @@ export default {
 					]
 					_this.$public.visitorsConnect(arr,function(data){
 						//离线匹配列表访客链接回调
-            _this.$store.dispatch("SET_OFFLINE",data);
-            
+						_this.$store.dispatch("SET_OFFLINE",data);
+
 					},function(data,session,offline,type,num,dataList,name){
 						//将用户添加到会话列表中
 						session.push(data.user_info);
@@ -104,10 +104,10 @@ export default {
 						_this.$store.dispatch("SET_NUM",num);//列表下标
 						_this.$store.dispatch("SET_CURRENT",dataList);//当前会话数据
 						_this.$store.dispatch("SET_SESSION_NAME",name);//当前会话对象名
-						
+
 					})
 				}
-				
+
 
 				//用户离线后会话窗口切换
 				if(redata.message_type == "userClose"){
@@ -115,14 +115,14 @@ export default {
 					let	arr= [
 						redata.data,
 						session,
-            offline,
+						offline,
 						sessionType,
 						dataIndex,
 						session_name,
 						current_session,
 					]
 					_this.$public.userOffline(arr,function(session,offline,type,index,name,list,userInfo){
-            _this.$store.dispatch("SET_CURRENT",list);//当前会话数据
+						_this.$store.dispatch("SET_CURRENT",list);//当前会话数据
 						_this.$store.dispatch("SET_SESSION_NAME",name);//当前会话对象名
 						_this.$store.dispatch("SET_NUM",index);
 						_this.$store.dispatch("SET_TYPE",type);
@@ -139,159 +139,159 @@ export default {
 					let	arr= [
 						redata.data,
 						session,
-            offline,
+						offline,
 						sessionType,
 						dataIndex,
 						session_name,
 						current_session,
 					]
 					_this.$public.sessionEnd(arr,function(session,offline,type,index,name,list,userInfo){
-            _this.$store.dispatch("SET_CURRENT",list);//当前会话数据
+						_this.$store.dispatch("SET_CURRENT",list);//当前会话数据
 						_this.$store.dispatch("SET_SESSION_NAME",name);//当前会话对象名
 						_this.$store.dispatch("SET_NUM",index);
 						_this.$store.dispatch("SET_TYPE",type);
 						_this.$store.dispatch("SET_SESSION",session);
 						_this.$store.dispatch("SET_OFFLINE",offline);
-					//	_this.get_user_info(userInfo);
+						//	_this.get_user_info(userInfo);
 					})
 				}
 
 				//接收用户消息数据
 				if(redata.message_type == "chatMessage"){
 
-          this.receiveAudio();
+					this.receiveAudio();
 					let _this =this;
 					this.$public.receivesMessage(redata.data,session,this.$frce,function(data,chatList,index){
 						//判断是否是当前对话信息
 						if(dataIndex == index){
-						    // _this.data =[];
-                // _this.data = chatList.data;
-                _this.$store.dispatch("SET_CURRENT",chatList.data);//当前会话数据
+							// _this.data =[];
+							// _this.data = chatList.data;
+							_this.$store.dispatch("SET_CURRENT",chatList.data);//当前会话数据
 						}else{
-						    let num = Number.isInteger(chatList.num) ? chatList.num : 0;
-                // _this.$set(chatList,'num',num+1)
-                session[index].num = num+1
+							let num = Number.isInteger(chatList.num) ? chatList.num : 0;
+							// _this.$set(chatList,'num',num+1)
+							session[index].num = num+1
 						}
 						//更新会话时间
-            // _this.$set(chatList,'intime',data.time);
-            session[index].intime =data.time
-				
+						// _this.$set(chatList,'intime',data.time);
+						session[index].intime =data.time
+
 						//更新会话列表中最新回复消息
 						if(data.content.text){
-              // _this.$set(chatList,'text',data.content.text)
-              session[index].text =data.content.text
-            }
-             _this.$store.dispatch("SET_SESSION",session);
+							// _this.$set(chatList,'text',data.content.text)
+							session[index].text =data.content.text
+						}
+						_this.$store.dispatch("SET_SESSION",session);
 					})
 				}
-      
-        //reLoginErr
-        if(redata.message_type == "reLoginErr"){
-          console.log('haha');
-          this.init()
-        }
 
-    },   
+				//reLoginErr
+				if(redata.message_type == "reLoginErr"){
+					console.log('haha');
+					this.init()
+				}
 
-    /**************************************/
-    //连接断开,失败
-    websocketonerror(e) {
-      console.log('失败',e);
-      if(this.linkfailure){
-        this.init()
-      }
-    },
+			},
 
-    /******************************************/
-    //断开链接数据初始化
-    init(){
-      this.$store.dispatch("SET_STATEVALUE",'隐身');
-      this.$store.dispatch("SET_SESSION",[]);
-      this.$store.dispatch("SET_OFFLINE",[]);
-      this.$store.dispatch("SET_SESSION",[]);//会话列表
-			this.$store.dispatch("SET_OFFLINE",[]);//离线列表
-		  this.$store.dispatch("SET_TYPE",1);//选择类型(会话/离线)
-			this.$store.dispatch("SET_NUM",0);//列表下标
-			this.$store.dispatch("SET_CURRENT",[]);//当前会话数据
-      this.$store.dispatch("SET_SESSION_NAME",'');//当前会话对象名
-      this.$store.dispatch("SET_SESSION_MESSAGE",{});
-      this.$store.dispatch("SET_IS_INIT",false);
-      this.$token = '';
-      this.$router.push('/login')
-      this.linkfailure = true;
-      //this.reconnect();
-    },
+			/**************************************/
+			//连接断开,失败
+			websocketonerror(e) {
+				console.log('失败',e);
+				if(this.linkfailure){
+					this.init()
+				}
+			},
 
-    /*******************************************/
-    // 接收消息音频提示
-    receiveAudio() {
-     let receive = new Audio()
+			/******************************************/
+			//断开链接数据初始化
+			init(){
+				this.$store.dispatch("SET_STATEVALUE",'隐身');
+				this.$store.dispatch("SET_SESSION",[]);
+				this.$store.dispatch("SET_OFFLINE",[]);
+				this.$store.dispatch("SET_SESSION",[]);//会话列表
+				this.$store.dispatch("SET_OFFLINE",[]);//离线列表
+				this.$store.dispatch("SET_TYPE",1);//选择类型(会话/离线)
+				this.$store.dispatch("SET_NUM",0);//列表下标
+				this.$store.dispatch("SET_CURRENT",[]);//当前会话数据
+				this.$store.dispatch("SET_SESSION_NAME",'');//当前会话对象名
+				this.$store.dispatch("SET_SESSION_MESSAGE",{});
+				this.$store.dispatch("SET_IS_INIT",false);
+				this.$token = '';
+				this.$router.push('/login')
+				this.linkfailure = true;
+				//this.reconnect();
+			},
+
+			/*******************************************/
+			// 接收消息音频提示
+			receiveAudio() {
+				let receive = new Audio()
 				receive.src = "../static/audio/receive.wav";
-        receive.play();
-    },
+				receive.play();
+			},
 
-    /***************************************/
-    //socket重连
-    reconnect(){
-      if(this.lockReconnect){   //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
-          return
-      }
-      this.lockReconnect = true;
-      this.reconnectData && clearTimeout(this.reconnectData);
-      this.reconnectData = setTimeout(()=>{
-          this.initWebSocket(this.apiToken);
-          this.lockReconnect = false;
-      },3000)
-    },  
+			/***************************************/
+			//socket重连
+			reconnect(){
+				if(this.lockReconnect){   //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
+					return
+				}
+				this.lockReconnect = true;
+				this.reconnectData && clearTimeout(this.reconnectData);
+				this.reconnectData = setTimeout(()=>{
+					this.initWebSocket(this.apiToken);
+					this.lockReconnect = false;
+				},3000)
+			},
 
-    /*************************************/
-    //心跳检测
-    heatBeat(){
-      this.timeoutObj && clearTimeout(this.timeoutObj);
-      this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
-      this.timeoutObj = setTimeout(()=>{
-        // console.log('发送',{type:'ping'});
-        this.$websocket.send(JSON.stringify({type:'ping'}))   //根据后台要求发送
-        this.serverTimeoutObj = setTimeout(()=> {
-            this.$websocket.close(); //如果  5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
-        }, 5000);
-      }, this.timeout)
-    }, 
-    
-    /******************************/
-    
-  },
-  mounted() {
-    // 获取系统时间
-    let t = new Date().getTime();
-    this.get('api'+this.$ports.TIME+'?t='+t).then(res => {
-    //this.get('http://kfadmin.bocai186.com'+this.$ports.TIME+'?t='+t).then(res => {
-      if (res.data.code == 1) {
-        let time = res.data.data.time.split(' ');
-        time[0] =(new Date( time[0].replace(/-/g,'/')).getTime()) /1000;
-        sessionStorage.setItem("time",JSON.stringify(time));
-        sessionStorage.setItem("logo",res.data.data.logo);
-        this.apiToken = this.$md5('customer-service'+time[0]+window.location.origin)
-        this.initWebSocket(this.apiToken);
-      }
-    });
-  },
-  destroyed() {
-    this.lockReconnect = true;
-    this.websock.close()                   //离开路由之后断开websocket连接
-    clearTimeout(this.reconnectData);      //离开清除 timeout
-    clearTimeout(this.timeoutObj);         //离开清除 timeout
-    clearTimeout(this.serverTimeoutObj);   //离开清除 timeout
-  }
-}
+			/*************************************/
+			//心跳检测
+			heatBeat(){
+				this.timeoutObj && clearTimeout(this.timeoutObj);
+				this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
+				this.timeoutObj = setTimeout(()=>{
+					// console.log('发送',{type:'ping'});
+					this.$websocket.send(JSON.stringify({type:'ping'}))   //根据后台要求发送
+					this.serverTimeoutObj = setTimeout(()=> {
+						this.$websocket.close(); //如果  5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
+					}, 5000);
+				}, this.timeout)
+			},
+
+			/******************************/
+
+		},
+		mounted() {
+			// 获取系统时间
+			let t = new Date().getTime();
+			//this.get('api'+this.$ports.TIME+'?t='+t).then(res => {
+			this.get('http://kfadmin.bocai186.com'+this.$ports.TIME+'?t='+t).then(res => {
+				if (res.data.code == 1) {
+					let time = res.data.data.time.split(' ');
+					time[0] =(new Date( time[0].replace(/-/g,'/')).getTime()) /1000;
+					sessionStorage.setItem("time",JSON.stringify(time));
+					sessionStorage.setItem("logo",res.data.data.logo);
+					this.apiToken = this.$md5('customer-service'+time[0]+window.location.origin)
+					this.initWebSocket(this.apiToken);
+				}
+			});
+		},
+		destroyed() {
+			this.lockReconnect = true;
+			this.websock.close()                   //离开路由之后断开websocket连接
+			clearTimeout(this.reconnectData);      //离开清除 timeout
+			clearTimeout(this.timeoutObj);         //离开清除 timeout
+			clearTimeout(this.serverTimeoutObj);   //离开清除 timeout
+		}
+	}
 </script>
 
 <style>
-  .fade-enter-active, .fade-leave-active {
-      transition: opacity .5s;
-  }
-     
-  .fade-enter, .fade-leave-to {
-    opacity: 0;
-  }
+	.fade-enter-active, .fade-leave-active {
+		transition: opacity .5s;
+	}
+
+	.fade-enter, .fade-leave-to {
+		opacity: 0;
+	}
 </style>

+ 7 - 3
service/src/pages/login.vue

@@ -6,8 +6,8 @@
 					<img src="@/assets/img/loginBg.png" />
 				</div>
 				<div class="loginBox">
-					<div class="row center" style="height:48px;margin-top:40px;">
-						<p style="font-size:48px;font-weight:bold;"><span style="color:#F60">HX<b style="color:#666;">668</b></span></p>
+					<div class="row center" style="height:48px;margin:30px 0 10px 0;">
+						<img :src="img_http + logo" alt="" style="width: 60px; height: 60px;">
 					</div>
 					<div class="row center"><span style="font-size:16px;color:#666;">客服系统客服登录</span></div>
 					<div class="box row center">
@@ -45,6 +45,9 @@
 				password:'',//密码
 				time:'',
 				loading:false,
+				logo: '',
+				img_http:'http://kfadmin.bocai186.com',//图片路径域
+				// img_http: 'http://192.168.2.187:8090',//图片路径域
 			}
 		},
 		methods:{
@@ -105,7 +108,8 @@
 			},
 		},
 		mounted(){
-			
+			this.logo = sessionStorage.getItem('logo');
+			console.log(this.logo, '========logo')
 		}
 	};
 </script>