ソースを参照

update pc_chat

luke 6 年 前
コミット
dd53f7520f
2 ファイル変更77 行追加44 行削除
  1. 9 8
      pc_chat/src/components/chat.vue
  2. 68 36
      pc_chat/src/components/ledgeBase.vue

+ 9 - 8
pc_chat/src/components/chat.vue

@@ -340,7 +340,7 @@
 								<span class="btn seek">评价</span>
 							</div>
 
-							<div class="promptBox " v-if="comtSuccess">
+							<div class="promptBox" v-if="comtSuccess">
 								<div class="prompt help">
 									<span>您对我们的服务评价为: {{comtCount}}。非常感谢!</span>
 								</div>
@@ -454,20 +454,20 @@
 								<div class="infor">
 									<div>
 										<span>姓名:</span>
-										<span v-if="service.serverInfo">{{ service.serverInfo.name ? service.serverInfo.name : '001客服' }}</span>
+										<span v-if="service.serverInfo" :title="service.serverInfo.name ? service.serverInfo.name : '001客服' ">{{ service.serverInfo.name ? service.serverInfo.name : '001客服' }}</span>
 									</div>
 
 									<div>
 										<span>工号:</span>
-										<span>{{service.serverInfo ? service.serverInfo.job_name : '001'}}</span>
+										<span :title="service.serverInfo ? service.serverInfo.job_name : '001'">{{service.serverInfo ? service.serverInfo.job_name : '001'}}</span>
 									</div>
 									<div>
 										<span>性别:</span>
-										<span>保密</span>
+										<span title="保密">保密</span>
 									</div>
 									<div>
 										<span>职务:</span>
-										<span class="duty">{{service.serverInfo ? service.serverInfo.groupname : '咨询客服'}}</span>
+										<span class="duty" :title="service.serverInfo ? service.serverInfo.groupname : '咨询客服'">{{service.serverInfo ? service.serverInfo.groupname : '咨询客服'}}</span>
 									</div>
 								</div>
 								<div class="headPortrait">
@@ -478,7 +478,7 @@
 							<el-col class="autograph pd20">
 								<div>
 									<span>个性签名:</span>
-									<span>{{service.serverInfo ? service.serverInfo.signature :'' }}</span>
+									<span :title="service.serverInfo ? service.serverInfo.signature :'' ">{{service.serverInfo ? service.serverInfo.signature :'' }}</span>
 								</div>
 							</el-col>
 						</div>
@@ -1381,11 +1381,13 @@
 				}
 				// 客服关闭会话.
 				if (redata.message_type == 'closeBysever') {
-					//this.goBack(1);
 					this.machineAndAtl = 10;
 					this.selNum = 0;
 					this.showleaveIcon = true;
 					this.resigtermsg = true;
+					// 关闭清除历史信息
+					this.hisSviceChat = [];
+					this.customerSviceChat = [];
 				}
 				// 客服掉线.
 				if (redata.message_type == 'serviceoffline') {
@@ -1434,7 +1436,6 @@
 						this.hisSviceChat.push(res)
 					})
 					this.customerSviceChat.push({type: 'system', str: 'historyMsg'})
-					// console.log(obj.data.chatLog.length,"历史信息数量");
 					if(obj.data.chatLog.length >= 3){
 						this.selNum = 3;
 						this.tokNum = 3;

+ 68 - 36
pc_chat/src/components/ledgeBase.vue

@@ -70,6 +70,15 @@
 							<span>暂无数据</span>
 						</div>
 					</div>
+					<!-- 分页 -->
+					<el-pagination
+							style="text-align: center"
+							background
+							layout="prev, pager, next"
+							:total="pages" @prev-click='upData'
+							@next-click="downData" @current-change="current_page">
+					</el-pagination>
+
 				</div>
 				<div class="launch">
 					<el-button type="primary" @click="launchLeave">发起留言</el-button>
@@ -92,25 +101,44 @@
 				activeNames: '', //折叠面板选中效果
 				activity: '1', //活动列表选中状态
 				options: [{
-						value: 'week',
-						label: '最近一周'
-					}, {
-						value: 'oneMonth',
-						label: '最近一个月'
-					}, {
-						value: 'threeMonth',
-						label: '最近三个月'
+					value: 'week',
+					label: '最近一周'
+				}, {
+					value: 'oneMonth',
+					label: '最近一个月'
+				}, {
+					value: 'threeMonth',
+					label: '最近三个月'
 				}],
 				problemType: '', //类
 				knowLedgeBase: '', //知识库问答数据
 				problemName: '账号',//类名
-				noBase: true , //无数据状态
-				imgs:[],
+				noBase: true, //无数据状态
+				imgs: [],
 				url: 'http://kfadmin.bocai186.com', // 域名地址
 				// url: 'http://192.168.2.187:8090', // 域名地址
+				pages: 0,
+				optionCont: "",
+				ledgedata: {}
 			}
 		},
 		methods: {
+			/******************上一页*****************/
+			upData(e) {
+				this.getLeave(e)
+			},
+
+			/*********************下一页******************/
+			downData(e) {
+				this.getLeave(e)
+			},
+
+			/*******************选择页数******************/
+			current_page(e) {
+				this.getLeave(e)
+
+			},
+
 			// 返回传值到父组件
 			back() {
 				this.$emit('value', 10)
@@ -130,42 +158,47 @@
 				this.seltValue = value;
 			},
 			// 获取数据
-			getLeave(data) {
-				this.$axios.post('/api/index/Message/index', data).then(res => {
+			getLeave(page, size = 5) {
+				this.ledgedata = {
+					time: this.optionCont,
+					key: this.crux,
+					type: this.problemName,
+					pageSize: size,
+					pageNumber: page,
+				}
+
+				this.$axios.post('/api/index/Message/index', this.ledgedata).then(res => {
 					if (res.data.status === 1) {
-						// console.log('======获取数据=========', res.data.data);
+						console.log('======获取数据=========', res.data.data);
 						let _img;
 						for (let i = 0; i < res.data.data.length; i++) {
 							_img = res.data.data[i].images.split(",");
 							this.imgs.push(_img)
 						}
-						// console.log(this.imgs,'123123');
 
-						this.knowLedgeBase = res.data.data;
+						this.knowLedgeBase = res.data.data.list;
+						this.pages = res.data.data.total;
+
+						this.knowLedgeBase.length > 0 ? this.noBase = true : this.noBase = false;
 
-						if(this.knowLedgeBase.length > 0) {
-							this.noBase = true;
-						} else {
-							this.noBase = false;
-						}
 					}
 
 				})
 			},
 			// 查询数据
 			search() {
-				let optionCont = '';
+				this.optionCont = '';
 				if (this.seltValue == '') {
-					optionCont = this.selt.value;
+					this.optionCont = this.selt.value;
 				} else {
-					optionCont = this.seltValue;
+					this.optionCont = this.seltValue;
 				}
 				let data = {
-					time: optionCont,
+					time: this.optionCont,
 					key: this.crux,
 					type: this.problemName
 				}
-				this.getLeave(data)
+				this.getLeave()
 			}
 		},
 		mounted() {
@@ -179,14 +212,8 @@
 					} else {
 						optionCont = this.seltValue;
 					}
-					let data = {
-						time: optionCont,
-						key: this.crux,
-						type: this.problemName
-					}
-					// console.log('1213',this.problemType)
-					// 获取留言数据
-					this.getLeave(data)
+
+					this.getLeave(1)
 				}
 			})
 		}
@@ -194,12 +221,14 @@
 </script>
 <style scoped>
 	.title {
-		float: left; width: 300px;
+		float: left;
+		width: 300px;
 		overflow-y: hidden;
 		word-break: keep-all;
-		white-space:nowrap;
-		text-overflow:ellipsis;
+		white-space: nowrap;
+		text-overflow: ellipsis;
 	}
+
 	.imgs {
 		margin: 20px 0;
 		display: flex;
@@ -211,10 +240,12 @@
 		width: 100px;
 		height: 100px;
 	}
+
 	.imgs li img {
 		width: 100px;
 		height: 100px;
 	}
+
 	.text {
 		background: #f5f5f5;
 		border: 1px solid #eee;
@@ -225,6 +256,7 @@
 		margin-right: 15px;
 		margin-top: 15px;
 	}
+
 	.chatBox {
 		width: 700px;
 	}