Browse Source

update service

luke 6 years ago
parent
commit
36c84f5a10

+ 1 - 1
service/config/index.js

@@ -22,7 +22,7 @@ module.exports = {
     },
 
     // Various Dev Server settings
-    host: 'localhost', // can be overwritten by process.env.HOST //192.168.2.163 
+    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,

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

@@ -19,7 +19,7 @@
 						</el-dropdown-menu>
 					</el-dropdown>
 				</div>
-				<el-badge :value="12" class="item">
+				<el-badge :value="unreadNum" class="item">
 					<el-button @click="openDrawer" style="margin:0 15px"><i style="font-size:14px; color:#5399F5;"
 																			class="el-icon-chat-dot-square"> </i>消息中心
 					</el-button>
@@ -47,8 +47,21 @@
 				options: ['在线', '隐身', '休息'],
 				value: '隐身',
 				user_info: '',//
+				userID:null,
+				unreadNum:null, // 未读数量
 			}
 		},
+		computed: {
+			get_drawer() {
+				return this.$store.getters.get_drawer;
+			},
+
+		},
+		watch: {
+			get_drawer(data) {
+				this.unreadnotice();
+			},
+		},
 		methods: {
 			openDrawer() {
 				this.$store.dispatch("SET_DRAWER", true);
@@ -85,12 +98,33 @@
 			websocketsend(Data) {
 				this.$websocket.send(Data);
 			},
+			// 未读信息
+			unreadnotice(){
+				let str = "unreadnotice" + "customer-service" + "index" + this.time + "service";
+				let obj = {
+					headers: {
+						"Content-Type": "application/x-www-form-urlencoded",
+						apiToken: this.$md5(str),
+						userToken: this.token
+					},
+					user_id: this.userID
+				};
+				this.post("api/service/index/unreadnotice", obj).then(res => {
+					if(res.data.code === 1){
+						console.log(res.data.data)
+						 this.unreadNum =  res.data.data.length;
+					}
+				});
+			},
 		},
+
 		mounted() {
 			if (this.$store.getters.get_stateValue) {
 				this.value = this.$store.getters.get_stateValue;
 			}
 			this.user_info = this.$store.getters.get_user_info;
+			this.userID = this.$store.getters.get_user_info.id;
+			this.unreadnotice();
 		}
 	}
 </script>

+ 12 - 6
service/src/components/messageCenter.vue

@@ -42,6 +42,7 @@
 
 
 			</el-col>
+
 			<el-col :span="18">
 				<el-row class="title">
 					<strong>客服满意度调查!</strong>
@@ -49,15 +50,15 @@
 				</el-row>
 				<el-row class="messageBox" v-if="nomessage">
 					<ul>
-						<li><p>发件人:管理员</p></li>
-						<li><p>收件人:123</p></li>
-						<li><p>时 间:123</p></li>
+						<li><p>发件人:{{unreadListOne.admin_name}}</p></li>
+						<li><p>收件人:{{userName}}</p></li>
+						<li><p>时 间:{{unreadListOne.sendtime}}</p></li>
 					</ul>
-					<div class="message-content">123</div>
+					<div class="message-content">{{unreadListOne.atext}}</div>
 				</el-row>
 				<el-row class="messageBox" v-if="nomessage == false">
 					<ul>
-						<li><p>发件人:管理员</p></li>
+						<li><p>发件人:{{messageBox.admin_name}}</p></li>
 						<li><p>收件人:{{userName}}</p></li>
 						<li><p>时 间:{{messageBox.sendtime}}</p></li>
 					</ul>
@@ -85,6 +86,8 @@
 				readList:[],
 				//未读列表
 				unreadList:[],
+				//未读第一个
+				unreadListOne:[],
 				//未读数量
 				unreadNum:null,
 				// 详情
@@ -149,8 +152,11 @@
 					console.log(res)
 					if(res.data.code === 1){
 						console.log("未读",res.data.data)
-						this.unreadList =  res.data.data;
+						this.unreadList = res.data.data;
+						this.unreadListOne = res.data.data[0];
+						console.log(this.unreadListOne,'第一个')
 						this.unreadNum =  res.data.data.length;
+
 					}
 				});
 			},