|
@@ -11,8 +11,8 @@
|
|
|
|
|
|
<div class="imui-center qq-lemon-imui" v-show="showQW">
|
|
|
<lemon-imui class="lemon-slot"
|
|
|
- :width="windowWidth"
|
|
|
- :height="windowHeight"
|
|
|
+ :width="isMaximized ? '100vw' : windowWidth"
|
|
|
+ :height="isMaximized ? '90vh' : windowHeight"
|
|
|
:user="userData"
|
|
|
ref="IMUI"
|
|
|
:contact-contextmenu="contactContextmenu"
|
|
@@ -93,6 +93,7 @@ import VideoPlayer from '@/components/VideoPlayer/VueAliplayer.vue'
|
|
|
import UserDetail from "@/views/qw/qwChat/userDetail/index.vue";
|
|
|
import {ImSocket} from "@/utils/ImSocket";
|
|
|
import {getToken} from '@/utils/auth'
|
|
|
+import {uploadOss} from "@/api/common";
|
|
|
|
|
|
let pages = {};
|
|
|
export default {
|
|
@@ -102,7 +103,8 @@ export default {
|
|
|
UserDetail
|
|
|
},
|
|
|
props: {
|
|
|
- showQw: Boolean
|
|
|
+ showQw: Boolean,
|
|
|
+ isMaximized: Boolean
|
|
|
},
|
|
|
data() {
|
|
|
return {
|
|
@@ -155,6 +157,7 @@ export default {
|
|
|
open: false
|
|
|
},
|
|
|
imSocket: null,
|
|
|
+ imUrl: process.env.VUE_APP_IM_WS_URL
|
|
|
};
|
|
|
},
|
|
|
created(){
|
|
@@ -196,6 +199,10 @@ export default {
|
|
|
}
|
|
|
]);
|
|
|
IMUI.initEmoji(EmojiData);
|
|
|
+ IMUI.initEditorTools([
|
|
|
+ { name: "emoji" },
|
|
|
+ { name: "uploadImage" }
|
|
|
+ ])
|
|
|
},
|
|
|
beforeDestroy() {
|
|
|
if (this.imSocket) {
|
|
@@ -204,7 +211,7 @@ export default {
|
|
|
},
|
|
|
methods: {
|
|
|
initImSocket(companyId) {
|
|
|
- this.imSocket = new ImSocket(`ws://127.0.0.1:8667/qwImSocket/${companyId}?token=${getToken()}`);
|
|
|
+ this.imSocket = new ImSocket(`${this.imUrl}/${companyId}?token=${getToken()}`);
|
|
|
this.imSocket.onMessage(data => {
|
|
|
const { IMUI } = this.$refs;
|
|
|
let message = JSON.parse(data);
|
|
@@ -338,7 +345,7 @@ export default {
|
|
|
const IMUI = this.$refs.IMUI;
|
|
|
let params = {};
|
|
|
if(message.type === "text"){ //text image voice video
|
|
|
- params = {"sessionId":message.toContactId,"appKey":this.qwUser.appKey,"content":message.content};
|
|
|
+ params = {"sessionId":message.toContactId,"appKey":this.qwUser.appKey,"content":message.content, "msgType": 1};
|
|
|
sendMsg(params).then(response => {
|
|
|
const {code, data} = response
|
|
|
if(code === 200){
|
|
@@ -354,6 +361,24 @@ export default {
|
|
|
// image
|
|
|
else if(message.type === "image"){
|
|
|
console.log("Event:image-click", message, next, file)
|
|
|
+ const formData = new FormData();
|
|
|
+ formData.append("file", file);
|
|
|
+ uploadOss(formData).then(response => {
|
|
|
+ const {code, url} = response
|
|
|
+ if (code === 200) {
|
|
|
+ params = {"sessionId":message.toContactId,"appKey":this.qwUser.appKey,"content":url, "msgType": 2};
|
|
|
+ sendMsg(params).then(response => {
|
|
|
+ const {code} = response
|
|
|
+ if(code === 200){
|
|
|
+ let conversation = IMUI.findConversation(message.toContactId);
|
|
|
+ conversation.lastSendTime = message.sendTime;
|
|
|
+ conversation.lastContent = message.content;
|
|
|
+ IMUI.topPopConversations(conversation);
|
|
|
+ next();
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
// file
|
|
|
else if(message.type === "file"){
|