|  | @@ -42,8 +42,6 @@
 | 
	
		
			
				|  |  |              <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
 | 
	
		
			
				|  |  |              <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
 | 
	
		
			
				|  |  |            </el-form-item>
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |       </el-form>
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -67,6 +65,7 @@
 | 
	
		
			
				|  |  |            @menu-avatar-click="handleMenuAvatarClick"
 | 
	
		
			
				|  |  |            @pick-image="handleImageClick"
 | 
	
		
			
				|  |  |            @pick-msg-records="handleMsgRecordsClick"
 | 
	
		
			
				|  |  | +          @pick-export-msg="handleExportMsgClick"
 | 
	
		
			
				|  |  |            @send="handleSend">
 | 
	
		
			
				|  |  |            <template #cover>
 | 
	
		
			
				|  |  |                  <div class="cover">
 | 
	
	
		
			
				|  | @@ -174,7 +173,7 @@ import store from "@/store";
 | 
	
		
			
				|  |  |  import { getQrCode } from '@/api/qw/login';
 | 
	
		
			
				|  |  |  import { getDeviceId,listAccount,getAccount} from '@/api/qw/account';
 | 
	
		
			
				|  |  |  import LemonMessageVoice from "@/components/LemonUI/components/message/voice";
 | 
	
		
			
				|  |  | -import { getContactsByUser,getConversations,getMessageList,getConversation,sendTextMsg,sendImageMsg,getRoomInfo} from '@/api/qw/im';
 | 
	
		
			
				|  |  | +import { getContactsByUser,getConversations,getMessageList,getConversation,sendTextMsg,sendImageMsg,getRoomInfo,exportMessage} from '@/api/qw/im';
 | 
	
		
			
				|  |  |  import Conversations from "@/components/LemonUI/database/conversations";
 | 
	
		
			
				|  |  |  import EmojiData from "@/components/LemonUI/database/emoji";
 | 
	
		
			
				|  |  |  import '@/components/LemonUI/index.css';
 | 
	
	
		
			
				|  | @@ -384,8 +383,7 @@ export default {
 | 
	
		
			
				|  |  |          this.getContacts();  //获取联系人信息
 | 
	
		
			
				|  |  |          this.getConversation();   //获取会话信息 
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -     qwListAccount(companyUserId) {
 | 
	
		
			
				|  |  | +    qwListAccount(companyUserId) {
 | 
	
		
			
				|  |  |          if(!this.companyUserId){
 | 
	
		
			
				|  |  |               this.msgError("请选择员工");
 | 
	
		
			
				|  |  |               return;
 | 
	
	
		
			
				|  | @@ -411,7 +409,6 @@ export default {
 | 
	
		
			
				|  |  |          this.UserData.displayName=this.qwUser.nickName;
 | 
	
		
			
				|  |  |          this.UserData.avatar=this.qwUser.avatar;
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |       /** 搜索按钮操作 */
 | 
	
		
			
				|  |  |      handleQuery() {
 | 
	
		
			
				|  |  |        this.qwListAccount();
 | 
	
	
		
			
				|  | @@ -421,61 +418,59 @@ export default {
 | 
	
		
			
				|  |  |        this.resetForm("queryForm");
 | 
	
		
			
				|  |  |        //this.handleQuery();
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |      initSocket(userId) {
 | 
	
		
			
				|  |  | -               let that=this;
 | 
	
		
			
				|  |  | -               if(!!this.qwIm.socket){
 | 
	
		
			
				|  |  | -                  this.qwIm.initSocket(userId,true);
 | 
	
		
			
				|  |  | -                  // 监听socket连接
 | 
	
		
			
				|  |  | -                  this.qwIm.socket.onopen = function() {
 | 
	
		
			
				|  |  | -                      console.log("socket 连接成功...");
 | 
	
		
			
				|  |  | -                  };
 | 
	
		
			
				|  |  | -                  this.qwIm.socket.onerror = function() {
 | 
	
		
			
				|  |  | -                      console.log("连接错误")
 | 
	
		
			
				|  |  | -                  };
 | 
	
		
			
				|  |  | -                  // 监听socket消息
 | 
	
		
			
				|  |  | -                  const IMUI = this.$refs.IMUI;
 | 
	
		
			
				|  |  | -                  this.qwIm.socket.onmessage = function(res) {
 | 
	
		
			
				|  |  | -                       var data=JSON.parse(res.data);
 | 
	
		
			
				|  |  | -                       //console.log("收到服务端内容", JSON.stringify(data));
 | 
	
		
			
				|  |  | -                        if(data.cmd=="heartbeat"){ //收到心跳数据不处理
 | 
	
		
			
				|  |  | -                            console.log("heartbeat");
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        if(data.cmd=="offline"){
 | 
	
		
			
				|  |  | -                            that.$message.error('企微号已下线');
 | 
	
		
			
				|  |  | -                            that.$store.dispatch('qwLoginOut').then(() => {
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -                            });
 | 
	
		
			
				|  |  | -                            setTimeout(() => {
 | 
	
		
			
				|  |  | -                               that.$router.push({path:'/qw/qwLogin'});
 | 
	
		
			
				|  |  | -                            }, 2000);
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                        //接收消息
 | 
	
		
			
				|  |  | -                        if(data.cmd=="receiveMsg"){
 | 
	
		
			
				|  |  | -                             var msgData=JSON.parse(data.msg);
 | 
	
		
			
				|  |  | -                             if(!IMUI.hasConversation(msgData.toContactId)){  //收到新消息时是最新的会话,添加该会话
 | 
	
		
			
				|  |  | -                                    let queryParams={conversationId:msgData.toContactId,userId:that.qwUser.userId};
 | 
	
		
			
				|  |  | -                                    getConversation(queryParams).then(response => {
 | 
	
		
			
				|  |  | -                                          if(response.code==200){
 | 
	
		
			
				|  |  | -                                              var conversation=response.data;
 | 
	
		
			
				|  |  | -                                              IMUI.appendConversation(conversation); 
 | 
	
		
			
				|  |  | -                                              that.appendMessageAction(msgData);
 | 
	
		
			
				|  |  | -                                          }
 | 
	
		
			
				|  |  | -                                   });
 | 
	
		
			
				|  |  | -                             }else{
 | 
	
		
			
				|  |  | -                                  that.appendMessageAction(msgData);
 | 
	
		
			
				|  |  | -                                  let conversation=IMUI.findConversation(msgData.toContactId);
 | 
	
		
			
				|  |  | -                                  IMUI.topPopConversations(conversation);
 | 
	
		
			
				|  |  | -                                  
 | 
	
		
			
				|  |  | -                             }
 | 
	
		
			
				|  |  | -                        }
 | 
	
		
			
				|  |  | -                  };
 | 
	
		
			
				|  |  | -                  // 监听socket重连
 | 
	
		
			
				|  |  | -                  this.qwIm.socket.onreconnect = function(res) {
 | 
	
		
			
				|  |  | -                      console.log("socket 断线重连...")
 | 
	
		
			
				|  |  | -                  };
 | 
	
		
			
				|  |  | -              }
 | 
	
		
			
				|  |  | +          let that=this;
 | 
	
		
			
				|  |  | +          if(!!this.qwIm.socket){
 | 
	
		
			
				|  |  | +                this.qwIm.initSocket(userId,true);
 | 
	
		
			
				|  |  | +                // 监听socket连接
 | 
	
		
			
				|  |  | +                this.qwIm.socket.onopen = function() {
 | 
	
		
			
				|  |  | +                    console.log("socket 连接成功...");
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                this.qwIm.socket.onerror = function() {
 | 
	
		
			
				|  |  | +                    console.log("连接错误")
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                // 监听socket消息
 | 
	
		
			
				|  |  | +                const IMUI = this.$refs.IMUI;
 | 
	
		
			
				|  |  | +                this.qwIm.socket.onmessage = function(res) {
 | 
	
		
			
				|  |  | +                    var data=JSON.parse(res.data);
 | 
	
		
			
				|  |  | +                    //console.log("收到服务端内容", JSON.stringify(data));
 | 
	
		
			
				|  |  | +                      if(data.cmd=="heartbeat"){ //收到心跳数据不处理
 | 
	
		
			
				|  |  | +                          console.log("heartbeat");
 | 
	
		
			
				|  |  | +                      }
 | 
	
		
			
				|  |  | +                      if(data.cmd=="offline"){
 | 
	
		
			
				|  |  | +                          that.$message.error('企微号已下线');
 | 
	
		
			
				|  |  | +                          that.$store.dispatch('qwLoginOut').then(() => {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +                          });
 | 
	
		
			
				|  |  | +                          setTimeout(() => {
 | 
	
		
			
				|  |  | +                            that.$router.push({path:'/qw/qwLogin'});
 | 
	
		
			
				|  |  | +                          }, 2000);
 | 
	
		
			
				|  |  | +                      }
 | 
	
		
			
				|  |  | +                      //接收消息
 | 
	
		
			
				|  |  | +                      if(data.cmd=="receiveMsg"){
 | 
	
		
			
				|  |  | +                          var msgData=JSON.parse(data.msg);
 | 
	
		
			
				|  |  | +                          if(!IMUI.hasConversation(msgData.toContactId)){  //收到新消息时是最新的会话,添加该会话
 | 
	
		
			
				|  |  | +                                  let queryParams={conversationId:msgData.toContactId,userId:that.qwUser.userId};
 | 
	
		
			
				|  |  | +                                  getConversation(queryParams).then(response => {
 | 
	
		
			
				|  |  | +                                        if(response.code==200){
 | 
	
		
			
				|  |  | +                                            var conversation=response.data;
 | 
	
		
			
				|  |  | +                                            IMUI.appendConversation(conversation); 
 | 
	
		
			
				|  |  | +                                            that.appendMessageAction(msgData);
 | 
	
		
			
				|  |  | +                                        }
 | 
	
		
			
				|  |  | +                                });
 | 
	
		
			
				|  |  | +                          }else{
 | 
	
		
			
				|  |  | +                                that.appendMessageAction(msgData);
 | 
	
		
			
				|  |  | +                                let conversation=IMUI.findConversation(msgData.toContactId);
 | 
	
		
			
				|  |  | +                                IMUI.topPopConversations(conversation);
 | 
	
		
			
				|  |  | +                                
 | 
	
		
			
				|  |  | +                          }
 | 
	
		
			
				|  |  | +                      }
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +                // 监听socket重连
 | 
	
		
			
				|  |  | +                this.qwIm.socket.onreconnect = function(res) {
 | 
	
		
			
				|  |  | +                    console.log("socket 断线重连...")
 | 
	
		
			
				|  |  | +                };
 | 
	
		
			
				|  |  | +          }
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  |      getRoomInfo(roomId){
 | 
	
		
			
				|  |  |          getRoomInfo(roomId).then(response => {
 | 
	
	
		
			
				|  | @@ -651,6 +646,19 @@ export default {
 | 
	
		
			
				|  |  |        console.log("qxj handleMsgRecordsClick");
 | 
	
		
			
				|  |  |        this.$refs.chatRecords.open(this.qwUser,this.queryParams.conversationId,this.conversationData);
 | 
	
		
			
				|  |  |      },
 | 
	
		
			
				|  |  | +    handleExportMsgClick() { 
 | 
	
		
			
				|  |  | +      let that=this;
 | 
	
		
			
				|  |  | +      this.$confirm('是否确认导出消息记录吗?', "警告", {
 | 
	
		
			
				|  |  | +            confirmButtonText: "确定",
 | 
	
		
			
				|  |  | +            cancelButtonText: "取消",
 | 
	
		
			
				|  |  | +            type: "warning"
 | 
	
		
			
				|  |  | +          }).then(function() {
 | 
	
		
			
				|  |  | +            let queryParams={conversationId:that.queryParams.conversationId}
 | 
	
		
			
				|  |  | +            return exportMessage(queryParams);
 | 
	
		
			
				|  |  | +          }).then(response => {
 | 
	
		
			
				|  |  | +            this.download(response.msg);
 | 
	
		
			
				|  |  | +          }).catch(function() {});
 | 
	
		
			
				|  |  | +    },
 | 
	
		
			
				|  |  |      //选择图片框确定按钮回调
 | 
	
		
			
				|  |  |      handlePickImageDone(data){
 | 
	
		
			
				|  |  |          console.log("handlePickImageDone:"+JSON.stringify(data));
 |