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