1
This commit is contained in:
parent
3fe3869361
commit
fe3816839d
@ -75,7 +75,6 @@ public class WebSocketServer {
|
||||
}else{
|
||||
GroupSending(message);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,16 +2,19 @@
|
||||
<div id="app">
|
||||
<router-view />
|
||||
<theme-picker />
|
||||
<!-- 聊天记录弹出框-->
|
||||
<chat-form ref="chatFrom"></chat-form>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import ThemePicker from "@/components/ThemePicker";
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
import { EventBus } from '@/utils/eventBus';
|
||||
import chatForm from "@/views/busi/chatMain/chatForm";
|
||||
export default {
|
||||
name: "App",
|
||||
components: { ThemePicker },
|
||||
components: { ThemePicker,chatForm },
|
||||
data(){
|
||||
return{
|
||||
b:false,
|
||||
@ -24,6 +27,11 @@ export default {
|
||||
const username = Cookies.get('username')
|
||||
this.$store.dispatch('websocket_init', process.env.VUE_APP_WEBSOCKET+username)
|
||||
},
|
||||
mounted(){
|
||||
EventBus.$on('newMessage', (message) => {
|
||||
this.$refs.chatFrom.openForm()
|
||||
});
|
||||
},
|
||||
metaInfo() {
|
||||
return {
|
||||
title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
|
||||
@ -31,7 +39,8 @@ export default {
|
||||
return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<!-- 选择产品对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
|
||||
<div class="dl-chat-box" >
|
||||
<template v-for="(item,index) in chatItemList">
|
||||
<div v-if="item.dataFrom==' '" class="dl-customer-dom">
|
||||
<template v-for="(item,index) in messages">
|
||||
<div v-if="item.dataFrom=='customer'" class="dl-customer-dom">
|
||||
<div class="dl-customer-photo">
|
||||
<img src="@/assets/images/customer.jpg" >
|
||||
</div>
|
||||
@ -25,7 +25,12 @@
|
||||
|
||||
</div>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="cancelSelect">关 闭</el-button>
|
||||
<el-input type="textarea"
|
||||
class="inputT"
|
||||
placeholder="按 Enter 发送" v-model="text"
|
||||
@keyup.enter.native="sendToServer"
|
||||
></el-input>
|
||||
<el-button type="primary" icon="el-icon-s-promotion" @click="sendToServer"></el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</template>
|
||||
@ -42,9 +47,11 @@ export default {
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 在线聊天记录表格数据
|
||||
chatItemList: [],
|
||||
messages: [],
|
||||
//所有页数
|
||||
pages:0,
|
||||
//发送的消息
|
||||
text:'',
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
mainId: null,
|
||||
@ -65,6 +72,7 @@ export default {
|
||||
|
||||
openForm(){
|
||||
this.open = true
|
||||
this.messages = this.$store._modules.root.state.websocket.message
|
||||
},
|
||||
|
||||
reset(){
|
||||
@ -81,6 +89,13 @@ export default {
|
||||
this.chatItemList = response.data;
|
||||
});
|
||||
},
|
||||
|
||||
/**发送消息*/
|
||||
sendToServer() {
|
||||
this.$store.dispatch('websocket_send',"platform," + this.text);
|
||||
this.messages = this.$store._modules.root.state.websocket.message
|
||||
this.text=''
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user