李昌恒 6 жил өмнө
parent
commit
513bf1b021

+ 13 - 3
service/src/App.vue

@@ -30,7 +30,7 @@ export default {
     initWebSocket(apiToken) {
       // 书写接口信息
       const wsuri = "ws://103.108.43.176:9101?apiToken=" + apiToken;//www.service.com 线上
-      //const wsuri = "ws://192.168.2.186:9101?apiToken=" + apiToken;//www.service.com //192.168.2.186 本地
+      //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; //连接成功
@@ -158,6 +158,8 @@ export default {
 
 				//接收用户消息数据
 				if(redata.message_type == "chatMessage"){
+
+          this.receiveAudio();
 					let _this =this;
 					this.$public.receivesMessage(redata.data,session,this.$frce,function(data,chatList,index){
 						//判断是否是当前对话信息
@@ -220,6 +222,14 @@ export default {
       //this.reconnect();
     },
 
+    /*******************************************/
+    // 接收消息音频提示
+    receiveAudio() {
+     let receive = new Audio()
+				receive.src = "../static/audio/receive.wav";
+        receive.play();
+    },
+
     /***************************************/
     //socket重连
     reconnect(){
@@ -254,8 +264,8 @@ export default {
   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 => {
+    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;

+ 2 - 1
service/src/api/ports.js

@@ -28,7 +28,8 @@ export default {
   //用户信息 
   userInfo:{
     updateinfo:'/service/Services/updateinfo',
-    updatepwd:'/service/Services/updatepwd'
+    updatepwd:'/service/Services/updatepwd',
+    update:'/service/services/update',//客服编辑用户信息
   }
   
 }

+ 1 - 0
service/src/components/hader.vue

@@ -94,6 +94,7 @@
       			this.$store.dispatch("SET_SESSION_NAME",'');//当前会话对象名
       			this.$store.dispatch("SET_SESSION_MESSAGE",{});
 				this.$websocket.close();
+				this.$socket_open = false;
 				this.$token = '';
 				this.$router.push('/login')
 			},

+ 1 - 3
service/src/css/index.css

@@ -217,6 +217,4 @@ body {
   font-size: 14px !important;
   font-weight: 400!important;
 }
-.allAlignment .el-button--text {
-  color: #606266!important;
-}
+

+ 101 - 17
service/src/pages/TheCurrentSession.vue

@@ -149,6 +149,8 @@
 							</div>
 						</div>
 					</div>
+					<!-- 发送消息音频提示 -->
+    				<!-- <audio id="send" src="@/assets/audio/send.wav"></audio> -->
 				</div>
 
 				<!-- 快捷回复模块 -->
@@ -211,35 +213,56 @@
 
 				<!-- 用户信息模块 -->
 				<div class="userinfo">
-					<div style="color:#666;font-weight:bold;font-size:14px;">用户信息</div>
+					<div style="color:#666;font-weight:bold;font-size:14px;">访问信息</div>
 					<div style="margin-top:10px;color:#999;font-size:14px;" class="userData wrap">
+						<!-- <p>来源:{{session_user_info.website}}</p>  -->
+						<p>IP地址:{{session_user_info.ip}}</p>
+						<p>来源终端:{{session_user_info.system}}-{{session_user_info.browse}}</p>
+					</div>
+
+
+
+					<div style="color:#666;font-weight:bold;font-size:14px; margin-top:30px;">用户信息</div>
+					<div style="margin-top:10px;color:#999;font-size:14px;" class="userData wrap">
+						<div class="user_info_box">
+							<span>账号:</span>
+							<input class="user_text" style="background: #ECF4FF;" v-model="session_user_info.name"  readonly type="text">
+						</div>
+						<div class="user_info_box">
+							<span>级别:</span>
+							<el-select v-model="value" placeholder="请选择">
+								<el-option
+								v-for="item in options"
+								:key="item.value"
+								:label="item.label"
+								:value="item.value">
+								</el-option>
+							</el-select>
+						</div>
 						<div class="user_info_box">
 							<span>昵称:</span>
-							<input class="user_text" v-model="session_user_info.nick_name"  readonly type="text">
+							<el-input style="width:80%" v-model="session_user_info.nick_name" placeholder="请输入内容"></el-input>
 						</div>
 						<div class="user_info_box">
 							<span>手机:</span>
-							<input class="user_text" v-model="session_user_info.account_phone" type="text">
+							<el-input style="width:80%" v-model="session_user_info.account_phone" placeholder="请输入内容"></el-input>
 						</div>
 						<div class="user_info_box">
 							<span>邮箱:</span>
-							<input class="user_text" v-model="session_user_info.account_email" type="text">
+							<el-input style="width:80%" v-model="session_user_info.account_email" placeholder="请输入内容"></el-input>
 						</div>
 						<div class="user_info_box">
 							<span>地址:</span>
-							<input class="user_text" v-model="session_user_info.address" type="text">
+							<el-input style="width:80%" v-model="session_user_info.address" placeholder="请输入内容"></el-input>
 						</div>
 						<p>访客备注:</p>
 					</div>
 					<textarea draggable="false"  class="userDataInput"  v-model="session_user_info.remark"  style="margin-top:10px;color:#999;" ></textarea>
-					<div class="userBtn row center">保存</div>
-
-					<div style="color:#666;font-weight:bold;font-size:14px;margin-top:30px;">访问信息</div>
-					<div style="margin-top:10px;color:#999;font-size:14px;" class="userData wrap">
-						<p>来源渠道:{{session_user_info.website}}</p>
-						<p>IP地址:{{session_user_info.ip}}</p>
-						<p>来源终端:{{session_user_info.browse}}</p>
+					<div class=" row rightAlignment">
+						<div class="userBtn row center" @click="bt_update()">保存</div>
 					</div>
+
+			
 				</div>
 			</div>
 		</div>
@@ -277,7 +300,7 @@
 				// sessionName:'',//当前会话用户名字
 				session_user_info:{},//当前会话用户信息
 				img_http:'http://kfadmin.bocai186.com',//图片路径域
-				//img_http:'http://192.168.2.186:8090',//图片路径域
+				//img_http:'http://192.168.2.187:8090',//图片路径域
 				fit:'scale-down',//图片渲染样式
 				is_eva_btn:true,//
 				trigger_condition:0,//评价触发条件
@@ -286,7 +309,22 @@
 				sensitive:[],//客服敏感词数据
 				userSensitiveWords:[],//用户敏感词
 				sensitiveNumber:0,//关键词次数
-			};
+				isTrue:'',//编辑用户信息按钮开关
+				options: [{
+					value: '选项1',
+					label: '普通会员'
+					}, {
+					value: '选项2',
+					label: '高级会员'
+					}, {
+					value: '选项3',
+					label: 'VIP会员'
+					}, {
+					value: '选项4',
+					label: '贵宾会员'
+					}],
+				value: '普通会员'
+			}	
 		},
 		/**
 		 *
@@ -446,7 +484,7 @@
 						message: '转接用户成功...',
 						type: 'success'
 					});
-					if(this.sessionList.length >1 ){
+					if(this.sessionList.length > 1 ){
 						this.dataIndex =0;
 						this.$store.dispatch("SET_NUM",0);
 						// this.data = []
@@ -634,6 +672,13 @@
 				this.automaticRolling();
 			},
 
+			// 消息发送声音提示
+			sendAudio() {
+				let send = new Audio()
+				send.src = "../../static/audio/send.wav"
+				send.play()
+			},
+
 			/*********************发送消息*********************/
 			sendMessage(){
 				if(!this.inputValue) return
@@ -683,13 +728,13 @@
 						text:this.$public.turnFace(this.inputValue,this.$frce),
 						img:'',
 					} ,time:this.time[1]});
-
 					//this.data = [];
 					//标记当前会话位置
 					this.session_marked = chatList.data.length -1;
 					//this.data = chatList.data;
 					this.$store.dispatch("SET_CURRENT",chatList.data);//当前会话数据
 					this.websocketsend(JSON.stringify({type:'chatMessage',data}))
+					this.sendAudio();
 					this.inputValue = '';
 					this.sensitiveNumber = 0;
 				}else{
@@ -769,6 +814,8 @@
 					this. session_user_info  = {};
 					if(this.dataIndex <= type.length){
 						this.session_user_info = type[this.dataIndex];
+						console.log(this.session_user_info);
+					
 					}
 				}else{
 					this.session_user_info = {};
@@ -831,6 +878,37 @@
 				// this.data = getters.get_current;//当前会话数据
 				// this.sessionName = getters.get_session_name;//会话对象名字
 				this.time =JSON.parse(sessionStorage.getItem("time"));
+			},
+
+			/**********************编辑用户信息**********************/
+			bt_update(){
+				
+				if(!this.isTrue) return false;
+				let obj = {
+					headers: {
+						"apiToken": this.$md5('update' + "customer-service"+'service'+this.time[0]+'service'),
+						'userToken': this.token
+					},
+					account_id:this.session_user_info.id,
+					nick_name:this.session_user_info.nick_name,
+					account_email:this.session_user_info.account_email,
+					phone:this.session_user_info.account_phone,
+					address:this.session_user_info.address,
+					remark:this.session_user_info.remark,
+
+				};
+
+				this.post('api'+this.$ports.userInfo.update,obj).then(res => {
+					if(res.data.code == 1){
+						this.$message({
+						showClose: true,
+						message: `恭喜你,${res.data.msg}`,
+						type: 'success'
+						});
+					}
+					this.isTrue = true;
+				})
+		
 			}
 		},
 		/**
@@ -1194,7 +1272,7 @@
 	.userDataInput {
 		width: 80%;
 		padding: 10px;
-		height: 50px;
+		height: 80px;
 		resize: none;
 		border: 1px solid #d5e5ff;
 		background: #fff;
@@ -1215,6 +1293,12 @@
 		color: #888;
 		font-size: 14px;
 		margin-top: 10px;
+
+	}
+	.userBtn:hover{
+		background: #5399f5;
+		color:#f0f0f0;
+		cursor:pointer;
 	}
 	.chatmin {
 		height: 46.5vh;

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

@@ -50,7 +50,7 @@
 		methods:{
 			loginBtn(){
 				this.time = sessionStorage.getItem('time');
-				if(this.$socket_open != undefined ){
+				if(this.$socket_open){
 					let apiToken = this.$md5('customer-service'+this.time[0]+window.location.origin)
 					if(this.account && this.password){