wansfa 1 anno fa
parent
commit
cf59416298

+ 3 - 1
src/api/login.js

@@ -37,4 +37,6 @@ export function getCodeImg() {
     url: '/captchaImage',
     method: 'get'
   })
-}
+}
+
+

+ 16 - 0
src/api/qw/im.js

@@ -0,0 +1,16 @@
+import request from '@/utils/request'
+
+export function getContacts(deviceId) {
+  return request({
+    url: '/qw/contact/list/'+deviceId,
+    method: 'get'
+  })
+}
+
+
+export function getContactsByUser(userId) {
+  return request({
+    url: '/qw/contact/listByUser/'+userId,
+    method: 'get'
+  })
+}

+ 15 - 2
src/api/qw/login.js

@@ -20,11 +20,24 @@ export function verify(data) {
 }
 
 
-export function userDetail(deviceId) {
+export function getQwUser(deviceId) {
   return request({
-    url: '/qw/login/userDetail/' + deviceId,
+    url: '/qw/login/getQwUserInfo/' + deviceId,
     method: 'get'
   })
 }
 
 
+//企微退出登录
+export function qwLoginOut(deviceId) {
+  let data={deviceId:deviceId};
+  return request({
+    url: '/qw/login/ban',
+    method: 'post',
+    data:data 
+  })
+}
+
+
+
+

+ 8 - 10
src/components/LemonUI/components/index.vue

@@ -703,14 +703,12 @@ export default {
 
       this.currentContactId = contactId;
       if (!this.currentContactId) return false;
-
       this.$emit("change-contact", this.currentContact, this);
-      if (
-        isFunction(this.currentContact.renderContainer) ||
-        this.activeSidebar == DEFAULT_MENU_CONTACTS
-      ) {
+
+      if (isFunction(this.currentContact.renderContainer) || this.activeSidebar == DEFAULT_MENU_CONTACTS) {
         return;
       }
+      
       //填充草稿内容
       const draft = this.CacheDraft.get(contactId);
       if (draft) this.setEditorValue(draft.editorValue);
@@ -724,13 +722,13 @@ export default {
       if (!allMessages[contactId]) {
         this.updateCurrentMessages();
         this._emitPullMessages(isEnd => {
-          this.messageViewToBottom();
+             this.messageViewToBottom();
         });
       } else {
-        setTimeout(() => {
-          this.updateCurrentMessages();
-          this.messageViewToBottom();
-        }, 0);
+          setTimeout(() => {
+              this.updateCurrentMessages();
+              this.messageViewToBottom();
+          }, 0);
       }
     },
     /**

+ 148 - 173
src/components/LemonUI/database/contacts.js

@@ -1,173 +1,148 @@
-import request from '@/utils/request'
-export function getContacts(deviceId) {
-  return request({
-    url: '/qw/contact/list/'+deviceId,
-    method: 'get'
-  })
-}
-// export default [
-//   {
-//     id: 1,
-//     displayName: "像梦一样自由",
-//     avatar: "https://p.qqan.com/up/2020-2/2020022821001845128.jpg",
-//     index: "X",
-//     unread: 5,
-//     lastSendTime: 1566047865417,
-//     lastContent: "你开心吗",
-//   },
-//   {
-//     id: 2,
-//     displayName: "zyp",
-//     avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
-//     index: "Z",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "不错哟",
-//   },
-//   {
-//     id: 3,
-//     displayName: "凌云",
-//     avatar: "https://p.qqan.com/up/2021-1/2021129102387841.jpg",
-//     index: "L",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     id: 4,
-//     displayName: "小郭",
-//     avatar: "https://p.qqan.com/up/2021-1/2021122135507881.jpg",
-//     index: "X",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     id: 5,
-//     displayName: "杨玉泉",
-//     avatar: "https://p.qqan.com/up/2021-1/20211211131598147.jpg",
-//     index: "Y",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     id: 6,
-//     displayName: "森系Style",
-//     avatar: "https://p.qqan.com/up/2021-1/2021113104111220.jpg",
-//     index: "S",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     id: 7,
-//     displayName: "霸王花",
-//     avatar: "https://p.qqan.com/up/2021-1/20211411391666.jpg",
-//     index: "B",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "你怎么还不睡呀?",
-//   },
-//   {
-//     id: 8,
-//     displayName: "曾平",
-//     avatar: "https://p.qqan.com/up/2020-12/202012291044425822.jpg",
-//     index: "Z",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     id: 9,
-//     displayName: "淡然",
-//     avatar: "https://p.qqan.com/up/2020-12/202012141813343503.jpg",
-//     index: "D",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-//   {
-//     "id": 7881300287915556,
-//     "displayName": "RつE",
-//     "avatar": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4qCB1MNA6PTO8MDXiavEEklbYx0BlX1uRP7KbleAg1rmw/0",
-//     "index": "R",
-//     "unread": 0,
-//     "lastSendTime": 1697678814,
-//     "lastContent": "[视频]"
-//   },
-//   {
-//     "id": 7881301063988639,
-//     "displayName": "初衷",
-//     "avatar": "http://wx.qlogo.cn/mmhead/AVK3Oz5sfA6fLpRL1OrA42xflZXL6zY56I7joCVoX2pXP0ABs28QySOdria474v2grXSHibHShRP8/0",
-//     "index": "C",
-//     "unread": 0,
-//     "lastSendTime": 0,
-//     "lastContent": ""
-// },
-// {
-//     "id": 7881303019934662,
-//     "displayName": "AllMight",
-//     "avatar": "http://wx.qlogo.cn/mmhead/oYwP0cFmRU1Zd0HX9qibZiaIy78ibQDz3H7hlyicAFhUQGfldYYXfdoTeA/0",
-//     "index": "A",
-//     "unread": 0,
-//     "lastSendTime": 1697678592,
-//     "lastContent": "[视频]"
-// },
-// {
-//     "id": 7881303630026525,
-//     "displayName": "咕咕咕",
-//     "avatar": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4RPPP6vuW2YyHnmJZOkEZMCNYdcMhkFu4q9MGz6iaul4g/0",
-//     "index": "G",
-//     "unread": 0,
-//     "lastSendTime": 0,
-//     "lastContent": ""
-// },
-// {
-//     "id": 7881301068952363,
-//     "displayName": "Ximi",
-//     "avatar": "http://wx.qlogo.cn/mmhead/icYBDgv87Hlam1ib5FZ9LurxDoCtBCevQHGo1Gugg0Cz4/0",
-//     "index": "X",
-//     "unread": 0,
-//     "lastSendTime": 1697621742,
-//     "lastContent": "[视频]"
-// },
-//   {
-//     id: 13,
-//     displayName: "Lemon-imui交流群",
-//     avatar: "https://p.qqan.com/up/2020-11/20201127157109035.jpg",
-//     index: "L",
-//     isGroup: true,
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "这个咋处理啊?",
-//   },
-//   {
-//     id: 14,
-//     displayName: "系统通知",
-//     avatar: "https://p.qqan.com/up/2020-6/2020061117234279854.jpg",
-//     index: "[1]系統通知",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "宁静致远通过了你的好友请求",
-//     renderContainer() {
-//       return (
-//         ""
-//         // <div style="padding:15px;">
-//         //   <div>宁静致远通过了你的好友请求</div>
-//         //   <div>宁静致远通过了你的好友请求</div>
-//         //   <div>宁静致远通过了你的好友请求</div>
-//         // </div>
-//       );
-//     },
-//   },
-//   {
-//     id: 15,
-//     displayName: "宁静致远。",
-//     avatar: "https://p.qqan.com/up/2020-6/2020060308522797777.jpg",
-//     index: "N",
-//     unread: 0,
-//     lastSendTime: 1566047865417,
-//     lastContent: "",
-//   },
-// ];
+export default [
+  {
+    id: 1,
+    displayName: "像梦一样自由",
+    avatar: "https://p.qqan.com/up/2020-2/2020022821001845128.jpg",
+    index: "X",
+    unread: 0,
+    lastSendTime: 1698150575000,
+    lastContent: "你开心吗",
+  },
+  {
+    id: 2,
+    displayName: "梦醒时分、",
+    avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
+    index: "M",
+    unread: 0,
+    lastSendTime: 1698146315000,
+    lastContent: "不错哟",
+  },
+  {
+    id: 3,
+    displayName: "凌云",
+    avatar: "https://p.qqan.com/up/2021-1/2021129102387841.jpg",
+    index: "L",
+    unread: 0,
+    lastSendTime: 1698146242000,
+    lastContent: "",
+  },
+  {
+    id: 4,
+    displayName: "小郭",
+    avatar: "https://p.qqan.com/up/2021-1/2021122135507881.jpg",
+    index: "X",
+    unread: 0,
+    lastSendTime: 1698146170000,
+    lastContent: "",
+  },
+  {
+    id: 5,
+    displayName: "杨玉泉",
+    avatar: "https://p.qqan.com/up/2021-1/20211211131598147.jpg",
+    index: "Y",
+    unread: 0,
+    lastSendTime: 1698145150000,
+    lastContent: "",
+  },
+  {
+    id: 6,
+    displayName: "森系Style",
+    avatar: "https://p.qqan.com/up/2021-1/2021113104111220.jpg",
+    index: "S",
+    unread: 0,
+    lastSendTime: 1698141142000,
+    lastContent: "",
+  },
+  {
+    id: 7,
+    displayName: "霸王花",
+    avatar: "https://p.qqan.com/up/2021-1/20211411391666.jpg",
+    index: "B",
+    unread: 0,
+    lastSendTime: 1697968342000,
+    lastContent: "你怎么还不睡呀?",
+  },
+  {
+    id: 8,
+    displayName: "曾平",
+    avatar: "https://p.qqan.com/up/2020-12/202012291044425822.jpg",
+    index: "Z",
+    unread: 0,
+    lastSendTime: 1697967982000,
+    lastContent: "",
+  },
+  {
+    id: 9,
+    displayName: "淡然",
+    avatar: "https://p.qqan.com/up/2020-12/202012141813343503.jpg",
+    index: "D",
+    unread: 0,
+    lastSendTime: 1697967202000,
+    lastContent: "",
+  },
+  {
+    id: 10,
+    displayName: "叶子。",
+    avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
+    index: "Y",
+    unread: 0,
+    lastSendTime: 1697966602000,
+    lastContent: "",
+  },
+  {
+    id: 11,
+    displayName: "土豆",
+    avatar: "https://p.qqan.com/up/2020-12/202012111157268739.jpg",
+    index: "T",
+    unread: 0,
+    lastSendTime: 1697966302000,
+    lastContent: "",
+  },
+  {
+    id: 12,
+    displayName: "清沫",
+    avatar: "https://p.qqan.com/up/2020-12/202012415467996.jpg",
+    index: "Q",
+    unread: 0,
+    lastSendTime: 1697966139000,
+    lastContent: "",
+  },
+  {
+    id: 13,
+    displayName: "Lemon-imui交流群",
+    avatar: "https://p.qqan.com/up/2020-11/20201127157109035.jpg",
+    index: "L",
+    isGroup: true,
+    unread: 0,
+    lastSendTime: 1697966079000,
+    lastContent: "你很开心吗",
+  },
+  {
+    id: 14,
+    displayName: "系统通知",
+    avatar: "https://p.qqan.com/up/2020-6/2020061117234279854.jpg",
+    index: "[1]系統通知",
+    unread: 0,
+    lastSendTime: 1697879439000,
+    lastContent: "宁静致远通过了你的好友请求",
+    renderContainer() {
+      return (
+        ""
+        // <div style="padding:15px;">
+        //   <div>宁静致远通过了你的好友请求</div>
+        //   <div>宁静致远通过了你的好友请求</div>
+        //   <div>宁静致远通过了你的好友请求</div>
+        // </div>
+      );
+    },
+  },
+  {
+    id: 15,
+    displayName: "宁静致远。",
+    avatar: "https://p.qqan.com/up/2020-6/2020060308522797777.jpg",
+    index: "N",
+    unread: 0,
+    lastSendTime: 1697811039000,
+    lastContent: "",
+  },
+];

+ 167 - 0
src/components/LemonUI/database/contacts1.js

@@ -0,0 +1,167 @@
+
+export default [
+  {
+    id: 1,
+    displayName: "像梦一样自由",
+    avatar: "https://p.qqan.com/up/2020-2/2020022821001845128.jpg",
+    index: "X",
+    unread: 5,
+    lastSendTime: 1566047865417,
+    lastContent: "你开心吗",
+  },
+  {
+    id: 2,
+    displayName: "zyp",
+    avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
+    index: "Z",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "不错哟",
+  },
+  {
+    id: 3,
+    displayName: "凌云",
+    avatar: "https://p.qqan.com/up/2021-1/2021129102387841.jpg",
+    index: "L",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    id: 4,
+    displayName: "小郭",
+    avatar: "https://p.qqan.com/up/2021-1/2021122135507881.jpg",
+    index: "X",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    id: 5,
+    displayName: "杨玉泉",
+    avatar: "https://p.qqan.com/up/2021-1/20211211131598147.jpg",
+    index: "Y",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    id: 6,
+    displayName: "森系Style",
+    avatar: "https://p.qqan.com/up/2021-1/2021113104111220.jpg",
+    index: "S",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    id: 7,
+    displayName: "霸王花",
+    avatar: "https://p.qqan.com/up/2021-1/20211411391666.jpg",
+    index: "B",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "你怎么还不睡呀?",
+  },
+  {
+    id: 8,
+    displayName: "曾平",
+    avatar: "https://p.qqan.com/up/2020-12/202012291044425822.jpg",
+    index: "Z",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    id: 9,
+    displayName: "淡然",
+    avatar: "https://p.qqan.com/up/2020-12/202012141813343503.jpg",
+    index: "D",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+  {
+    "id": 7881300287915556,
+    "displayName": "RつE",
+    "avatar": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4qCB1MNA6PTO8MDXiavEEklbYx0BlX1uRP7KbleAg1rmw/0",
+    "index": "R",
+    "unread": 0,
+    "lastSendTime": 1697678814,
+    "lastContent": "[视频]"
+  },
+  {
+    "id": 7881301063988639,
+    "displayName": "初衷",
+    "avatar": "http://wx.qlogo.cn/mmhead/AVK3Oz5sfA6fLpRL1OrA42xflZXL6zY56I7joCVoX2pXP0ABs28QySOdria474v2grXSHibHShRP8/0",
+    "index": "C",
+    "unread": 0,
+    "lastSendTime": 0,
+    "lastContent": ""
+},
+{
+    "id": 7881303019934662,
+    "displayName": "AllMight",
+    "avatar": "http://wx.qlogo.cn/mmhead/oYwP0cFmRU1Zd0HX9qibZiaIy78ibQDz3H7hlyicAFhUQGfldYYXfdoTeA/0",
+    "index": "A",
+    "unread": 0,
+    "lastSendTime": 1697678592,
+    "lastContent": "[视频]"
+},
+{
+    "id": 7881303630026525,
+    "displayName": "咕咕咕",
+    "avatar": "http://wx.qlogo.cn/mmhead/Q3auHgzwzM4RPPP6vuW2YyHnmJZOkEZMCNYdcMhkFu4q9MGz6iaul4g/0",
+    "index": "G",
+    "unread": 0,
+    "lastSendTime": 0,
+    "lastContent": ""
+},
+{
+    "id": 7881301068952363,
+    "displayName": "Ximi",
+    "avatar": "http://wx.qlogo.cn/mmhead/icYBDgv87Hlam1ib5FZ9LurxDoCtBCevQHGo1Gugg0Cz4/0",
+    "index": "X",
+    "unread": 0,
+    "lastSendTime": 1697621742,
+    "lastContent": "[视频]"
+},
+  {
+    id: 13,
+    displayName: "Lemon-imui交流群",
+    avatar: "https://p.qqan.com/up/2020-11/20201127157109035.jpg",
+    index: "L",
+    isGroup: true,
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "这个咋处理啊?",
+  },
+  {
+    id: 14,
+    displayName: "系统通知",
+    avatar: "https://p.qqan.com/up/2020-6/2020061117234279854.jpg",
+    index: "[1]系統通知",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "宁静致远通过了你的好友请求",
+    renderContainer() {
+      return (
+        ""
+        // <div style="padding:15px;">
+        //   <div>宁静致远通过了你的好友请求</div>
+        //   <div>宁静致远通过了你的好友请求</div>
+        //   <div>宁静致远通过了你的好友请求</div>
+        // </div>
+      );
+    },
+  },
+  {
+    id: 15,
+    displayName: "宁静致远。",
+    avatar: "https://p.qqan.com/up/2020-6/2020060308522797777.jpg",
+    index: "N",
+    unread: 0,
+    lastSendTime: 1566047865417,
+    lastContent: "",
+  },
+];

+ 153 - 153
src/components/LemonUI/database/messages.js

@@ -28,7 +28,7 @@ export default {
       sendTime: 1566047865417,
       content: "啥子。",
       toContactId: 1,
-      fromUser: getContact(7881300287915556),
+      fromUser: getContact(1),
     },
     {
       id: generateRandId(),
@@ -55,7 +55,7 @@ export default {
       sendTime: 1566047865417,
       content: "因为我矮啊。[!1f600][!1f600][!1f600]",
       toContactId: 1,
-      fromUser: getContact(7881300287915556),
+      fromUser: getContact(1),
     },
     {
       id: generateRandId(),
@@ -64,157 +64,157 @@ export default {
       sendTime: 1566047865417,
       content: "你开心吗",
       toContactId: 1,
-      fromUser: getContact(7881300287915556),
+      fromUser: getContact(1),
     },
   ],
-  // 2: [],
-  // 3: [],
-  // 4: [],
-  // 5: [],
-  // 6: [],
-  // 7: [],
-  // 8: [],
-  // 9: [],
-  // 10: [],
-  // 11: [],
-  // 12: [],
-  // 13: [
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670481209000,
-  //     content: "我是测试时候看到的",
-  //     toContactId: 1,
-  //     fromUser: getContact(4),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670541395000,
-  //     content: "上新版本了,玩玩",
-  //     toContactId: 1,
-  //     fromUser: getContact(4),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670544995000,
-  //     content: "项目内没有搞这个",
-  //     toContactId: 1,
-  //     fromUser: getContact(4),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670545175000,
-  //     content: "@awesome 最新的,不然哪有这功能",
-  //     toContactId: 1,
-  //     fromUser: getContact(5),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670631575000,
-  //     content: "其实是跟你的遮罩层有冲突",
-  //     toContactId: 1,
-  //     fromUser: getContact(4),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670804375000,
-  //     content: "自己修改index哈",
-  //     toContactId: 1,
-  //     fromUser: UserData,
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670977175000,
-  //     content: "你们升级到最近版了吗?",
-  //     toContactId: 1,
-  //     fromUser: getContact(6),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1670980775000,
-  //     content: "wo 现在用的142",
-  //     toContactId: 1,
-  //     fromUser: getContact(7),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1671247175000,
-  //     content: "问你件事",
-  //     toContactId: 1,
-  //     fromUser: UserData,
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "failed",
-  //     type: "text",
-  //     sendTime: 1671340182000,
-  //     content: "啥子。",
-  //     toContactId: 1,
-  //     fromUser: getContact(1),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1696907382000,
-  //     content: "为什么",
-  //     toContactId: 1,
-  //     fromUser: UserData,
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1696920042000,
-  //     content: "你穿了高跟鞋还这么矮[!1f62c][!1f601][!1f602]",
-  //     toContactId: 1,
-  //     fromUser: UserData,
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1696995642000,
-  //     content: "因为我矮啊。[!1f600][!1f600][!1f600]",
-  //     toContactId: 1,
-  //     fromUser: getContact(1),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1696995642000,
-  //     content: "你有意见吗。[!1f643][!1f643][!1f643]",
-  //     toContactId: 1,
-  //     fromUser: getContact(1),
-  //   },
-  //   {
-  //     id: generateRandId(),
-  //     status: "succeed",
-  //     type: "text",
-  //     sendTime: 1696995942000,
-  //     content: "你开心吗",
-  //     toContactId: 1,
-  //     fromUser: getContact(1),
-  //   },
-  // ],
-  // 14: [],
-  // 15: [],
+  2: [],
+  3: [],
+  4: [],
+  5: [],
+  6: [],
+  7: [],
+  8: [],
+  9: [],
+  10: [],
+  11: [],
+  12: [],
+  13: [
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670481209000,
+      content: "我是测试时候看到的",
+      toContactId: 1,
+      fromUser: getContact(4),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670541395000,
+      content: "上新版本了,玩玩",
+      toContactId: 1,
+      fromUser: getContact(4),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670544995000,
+      content: "项目内没有搞这个",
+      toContactId: 1,
+      fromUser: getContact(4),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670545175000,
+      content: "@awesome 最新的,不然哪有这功能",
+      toContactId: 1,
+      fromUser: getContact(5),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670631575000,
+      content: "其实是跟你的遮罩层有冲突",
+      toContactId: 1,
+      fromUser: getContact(4),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670804375000,
+      content: "自己修改index哈",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670977175000,
+      content: "你们升级到最近版了吗?",
+      toContactId: 1,
+      fromUser: getContact(6),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1670980775000,
+      content: "wo 现在用的142",
+      toContactId: 1,
+      fromUser: getContact(7),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1671247175000,
+      content: "问你件事",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "failed",
+      type: "text",
+      sendTime: 1671340182000,
+      content: "啥子。",
+      toContactId: 1,
+      fromUser: getContact(1),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1696907382000,
+      content: "为什么",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1696920042000,
+      content: "你穿了高跟鞋还这么矮[!1f62c][!1f601][!1f602]",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1696995642000,
+      content: "因为我矮啊。[!1f600][!1f600][!1f600]",
+      toContactId: 1,
+      fromUser: getContact(1),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1696995642000,
+      content: "你有意见吗。[!1f643][!1f643][!1f643]",
+      toContactId: 1,
+      fromUser: getContact(1),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1696995942000,
+      content: "你开心吗",
+      toContactId: 1,
+      fromUser: getContact(1),
+    },
+  ],
+  14: [],
+  15: [],
 };

+ 220 - 0
src/components/LemonUI/database/messages1.js

@@ -0,0 +1,220 @@
+
+import ContactsData from "./contacts";
+import UserData from "./user";
+const generateRandId = () => {
+  return Math.random()
+    .toString(36)
+    .substr(-8);
+};
+const getContact = id => {
+  const data = ContactsData.find(contact => contact.id == id);
+  return { id: data.id, avatar: data.avatar, displayName: data.displayName };
+};
+export default {
+  1: [
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "问你件事",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "啥子。",
+      toContactId: 1,
+      fromUser: getContact(7881300287915556),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "为什么",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "你穿了高跟鞋还这么矮",
+      toContactId: 1,
+      fromUser: UserData,
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "因为我矮啊。[!1f600][!1f600][!1f600]",
+      toContactId: 1,
+      fromUser: getContact(7881300287915556),
+    },
+    {
+      id: generateRandId(),
+      status: "succeed",
+      type: "text",
+      sendTime: 1566047865417,
+      content: "你开心吗",
+      toContactId: 1,
+      fromUser: getContact(7881300287915556),
+    },
+  ],
+  // 2: [],
+  // 3: [],
+  // 4: [],
+  // 5: [],
+  // 6: [],
+  // 7: [],
+  // 8: [],
+  // 9: [],
+  // 10: [],
+  // 11: [],
+  // 12: [],
+  // 13: [
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670481209000,
+  //     content: "我是测试时候看到的",
+  //     toContactId: 1,
+  //     fromUser: getContact(4),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670541395000,
+  //     content: "上新版本了,玩玩",
+  //     toContactId: 1,
+  //     fromUser: getContact(4),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670544995000,
+  //     content: "项目内没有搞这个",
+  //     toContactId: 1,
+  //     fromUser: getContact(4),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670545175000,
+  //     content: "@awesome 最新的,不然哪有这功能",
+  //     toContactId: 1,
+  //     fromUser: getContact(5),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670631575000,
+  //     content: "其实是跟你的遮罩层有冲突",
+  //     toContactId: 1,
+  //     fromUser: getContact(4),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670804375000,
+  //     content: "自己修改index哈",
+  //     toContactId: 1,
+  //     fromUser: UserData,
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670977175000,
+  //     content: "你们升级到最近版了吗?",
+  //     toContactId: 1,
+  //     fromUser: getContact(6),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1670980775000,
+  //     content: "wo 现在用的142",
+  //     toContactId: 1,
+  //     fromUser: getContact(7),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1671247175000,
+  //     content: "问你件事",
+  //     toContactId: 1,
+  //     fromUser: UserData,
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "failed",
+  //     type: "text",
+  //     sendTime: 1671340182000,
+  //     content: "啥子。",
+  //     toContactId: 1,
+  //     fromUser: getContact(1),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1696907382000,
+  //     content: "为什么",
+  //     toContactId: 1,
+  //     fromUser: UserData,
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1696920042000,
+  //     content: "你穿了高跟鞋还这么矮[!1f62c][!1f601][!1f602]",
+  //     toContactId: 1,
+  //     fromUser: UserData,
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1696995642000,
+  //     content: "因为我矮啊。[!1f600][!1f600][!1f600]",
+  //     toContactId: 1,
+  //     fromUser: getContact(1),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1696995642000,
+  //     content: "你有意见吗。[!1f643][!1f643][!1f643]",
+  //     toContactId: 1,
+  //     fromUser: getContact(1),
+  //   },
+  //   {
+  //     id: generateRandId(),
+  //     status: "succeed",
+  //     type: "text",
+  //     sendTime: 1696995942000,
+  //     content: "你开心吗",
+  //     toContactId: 1,
+  //     fromUser: getContact(1),
+  //   },
+  // ],
+  // 14: [],
+  // 15: [],
+};

+ 11 - 1
src/permission.js

@@ -31,9 +31,19 @@ router.beforeEach((to, from, next) => {
               next({ path: '/' })
             })
         })
+
         store.dispatch('GetSipAccount').then(() => {
+
         }).catch(err => {
-        })
+          
+        });
+
+        store.dispatch('getQwUserInfo').then(() => {
+
+        }).catch(err => {
+
+        });
+
       } else {
         next()
       }

+ 45 - 5
src/store/modules/user.js

@@ -1,6 +1,7 @@
 import { login, logout, getInfo } from '@/api/login'
 import { callMobile,callOffMobile,getSipAccount } from "@/api/company/companyVoiceApi"
-import { getToken, setToken, removeToken } from '@/utils/auth'
+import { getToken, setToken, removeToken,getDeviceId, setDeviceId,removeDeviceId } from '@/utils/auth'
+import { getQwUser,qwLoginOut } from "@/api/qw/login"
 
 const user = {
   state: {
@@ -15,6 +16,7 @@ const user = {
     callHa1:null,
     isCall:false,
     callTitle:null,
+    deviceId:getDeviceId(),
     qwUser:null,
   },
 
@@ -75,7 +77,9 @@ const user = {
     },
 
     qwUser({ commit }, qwUser){
-      commit('SET_QW_USER', qwUser)
+      console.log("qxj qwUser:"+JSON.stringify(qwUser));
+      setDeviceId(qwUser.deviceId);
+      commit('SET_QW_USER', qwUser);
     },
     // 登录
     Login({ commit }, userInfo) {
@@ -101,7 +105,6 @@ const user = {
             commit('SET_CALL_USER', res.data.data.response.data.user)
             commit('SET_CALL_REALM', res.data.data.response.data.realm)
             commit('SET_CALL_HA1', res.data.data.response.data.ha1)
-
           }
           resolve(res)
         }).catch(error => {
@@ -109,6 +112,7 @@ const user = {
         })
       })
     },
+
     // 获取用户信息
     GetInfo({ commit, state }) {
       return new Promise((resolve, reject) => {
@@ -131,7 +135,8 @@ const user = {
         })
       })
     },
-    
+
+
     // 退出系统
     LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {
@@ -154,7 +159,42 @@ const user = {
         removeToken()
         resolve()
       })
-    }
+    },
+
+
+    //获取企微用户信息
+    getQwUserInfo({ commit, state }) {
+      return new Promise((resolve, reject) => {
+        if(!state.deviceId){
+           resolve("");
+           return;
+        }
+        getQwUser(state.deviceId).then(res => {
+          if(res.code==200){
+            const qwUser = res.data
+            commit('SET_QW_USER', qwUser);
+          }else{
+            commit('SET_QW_USER', "");
+          }
+          resolve(res)
+        }).catch(error => {
+          reject(error)
+        })
+      })
+    },
+    
+     //企微退出系统
+     qwLoginOut({ commit, state }) {
+          return new Promise((resolve, reject) => {
+            qwLoginOut(state.deviceId).then(() => {
+              commit('SET_QW_USER', "");
+              removeDeviceId()
+              resolve()
+            }).catch(error => {
+              reject(error)
+            })
+          })
+      }
   }
 }
 

+ 15 - 0
src/utils/auth.js

@@ -13,3 +13,18 @@ export function setToken(token) {
 export function removeToken() {
   return Cookies.remove(TokenKey)
 }
+
+
+const DeviceKey = 'Device-Token'
+export function getDeviceId() {
+  return Cookies.get(DeviceKey)
+}
+
+export function setDeviceId(deviceId) {
+  return Cookies.set(DeviceKey, deviceId)
+}
+
+export function removeDeviceId() {
+  return Cookies.remove(DeviceKey)
+}
+

+ 2 - 2
src/views/qw/qwAccounts/index.vue

@@ -14,7 +14,7 @@
     </el-row>
     <el-table border v-loading="loading" :data="accountList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="序号"  width="55" type="index" align="center" />
+      <!-- <el-table-column label="序号"  type="index" align="center" /> -->
       <el-table-column label="账号id" align="center" prop="id" />
       <el-table-column label="企微账号" align="center" prop="account" />
       <el-table-column label="头像" align="center" width="120">
@@ -36,7 +36,7 @@
               <el-tag prop="isAudit" v-for="(item, index) in isAuditOptions"  :type="scope.row.isAudit==-1?'danger':'success'"  v-if="scope.row.isAudit==item.dictValue">{{item.dictLabel}}</el-tag>
           </template>
       </el-table-column>
-      <el-table-column width="500" label="关联设备id" align="center" prop="deviceId" />
+      <el-table-column label="关联设备id" align="center" prop="deviceId" />
       <el-table-column label="创建时间" align="center" prop="createTime" />
       <el-table-column label="设备是否可用" align="center" prop="availableDevice" >
           <template slot-scope="scope">

+ 61 - 13
src/views/qw/qwChat/qq.vue

@@ -102,8 +102,8 @@ import store from "@/store";
 import { getQrCode } from '@/api/qw/login';
 import { getDeviceId} from '@/api/qw/account';
 import LemonMessageVoice from "@/components/LemonUI/components/lemon-message-voice";
-// import ContactsData from "@/components/LemonUI/database/contacts";
-import {getContacts} from "@/components/LemonUI/database/contacts";
+import { getContacts,getContactsByUser} from '@/api/qw/im';
+import ContactsData from "@/components/LemonUI/database/contacts";
 import MessagesData from "@/components/LemonUI/database/messages";
 import EmojiData from "@/components/LemonUI/database/emoji";
 import '@/components/LemonUI/index.css';
@@ -114,8 +114,7 @@ export default {
   data() {
     return {
       theme: "default",
-      contactData:[],
-      deviceId:'4eea1292408044beb49c02d3197871b0',
+      IMUI:null,
       contactContextmenu: [
         {
           text: "删除该聊天",
@@ -242,7 +241,7 @@ export default {
       hideMenu: false,
       hideMessageName: false,
       hideMessageTime: true,
-      qwUser:store.getters.qwUser,
+      qwUser:null,
       showQW:false,
       UserData: {
         id: "1000",
@@ -254,9 +253,12 @@ export default {
     };
   },
   created(){
-    this.getContacts();
+     this.initSocket();
+     this.$store.dispatch('qwLoginOut').then(() => {
+     });
   },
   mounted() {
+    this.qwUser=store.getters.qwUser;
     if(!this.qwUser){
         this.$message.error('未登录企微账号');
         setTimeout(() => {
@@ -265,6 +267,7 @@ export default {
         return;
     }
     this.showQW=true;
+    this.getContacts(this.qwUser.deviceId);
     const contactData1 = {
             id: "contact-1",
             displayName: "工作协作群",
@@ -298,15 +301,17 @@ export default {
             lastSendTime: 3,
             lastContent: "你好123",
     };
+
     const IMUI = this.$refs.IMUI;
-    IMUI.initContacts(this.contactData);
+    
+    IMUI.initContacts(ContactsData);
 
-    var conversationData = ContactsData.filter(item => item.id<=7);
+    var conversationData = ContactsData.filter(item => item.id<=13);
     conversationData.sort((a1, a2) => {
       return a2.lastSendTime - a1.lastSendTime;
     });
-    IMUI.initConversations(conversationData);
 
+    IMUI.initConversations(conversationData);
   
     IMUI.initMenus([
       {
@@ -364,12 +369,50 @@ export default {
     ]);
 
     IMUI.initEmoji(EmojiData);  
-    IMUI.changeContact(13);
+
+    //  setTimeout(() => {
+    //     IMUI.changeContact("13");
+    // }, 500);
+  
   },
+
   methods: {
+        initSocket() {
+               let that=this;
+              if(!!this.qwIm.socket){
+                  // this.qwIm.initSocket(userId,true);
+                  // this.qwIm.socket.onopen = function() {
+                  //         console.log("socket连接成功");
+                  // };
+                  this.qwIm.socket.onerror = function() {
+                      console.log("连接错误")
+                  };
+                  // 监听socket消息
+                  this.qwIm.socket.onmessage = function(res) {
+                       var data=JSON.parse(res.data);
+                        console.log("收到服务端内容", JSON.stringify(data));
+                        if(data.cmd=="offline"){
+                            that.$message.error('企微号已下线');
+                            that.$store.dispatch('qwLoginOut').then(() => {
+
+                            });
+                            setTimeout(() => {
+                               that.$router.push({path:'/qw/qwLogin'});
+                            }, 2000);
+                            
+                        }
+                  };
+                    // 监听socket消息
+                  this.qwIm.socket.onclose = function(res) {
+                        console.log("socket已经关闭")
+                  };
+              }
+      },
     getContacts(){
-      getContacts(this.deviceId).then(response => {
-        this.contactData = response.data;
+      getContactsByUser(this.qwUser.userId).then(response => {
+           this.contactData = response.data;
+           this.$refs.IMUI.initContacts(this.contactData);
+           console.log("qxj request contactData:"+JSON.stringify(this.contactData));
       });
     },
     messageTimeFormat(time) {
@@ -402,7 +445,7 @@ export default {
         params.height = "90%";
         params.offsetY = "10%";
       }
-      IMUI.openDrawer(params);
+      this.IMUI.openDrawer(params);
     },
     handlePullMessages(contact, next,instance) {
       const { IMUI } = this.$refs;
@@ -562,6 +605,11 @@ export default {
     openCustomContainer() {
 
     }
+
+
+
+
+
   },
 };
 </script>

+ 642 - 0
src/views/qw/qwChat/qq2.vue

@@ -0,0 +1,642 @@
+<template>
+  <div class="app-container">
+      <div class="imui-center qq-lemon-imui" v-show="showQW">
+        <lemon-imui  class="lemon-slot"
+          :width="windowWidth"
+          :height="windowHeight"
+          :user="UserData"
+           ref="IMUI"  
+          :contextmenu="contextmenu"
+          :contact-contextmenu="contactContextmenu"
+          :theme="theme"
+          :hide-menu="hideMenu"
+          :hide-menu-avatar="hideMenuAvatar"
+          :hide-message-name="hideMessageName"
+          :hide-message-time="hideMessageTime"
+          :messageTimeFormat="messageTimeFormat"
+          @change-menu="handleChangeMenu"
+          @pull-messages="handlePullMessages"
+          @change-contact="handleChangeContact"
+          @message-click="handleMessageClick"
+          @menu-avatar-click="handleMenuAvatarClick"
+          @send="handleSend">
+          <template #cover>
+                <div class="cover">
+                <i class="lemon-icon-message"></i>
+                <p><b>自定义封面 Lemon</b>IMUI</p>
+                </div>
+          </template>
+          <template #message-title="contact">
+            <div>
+                <div style="display:flex;justify-content:space-between">
+                    <span>{{contact.displayName}}</span>
+                    <span style="font-size:12px;">
+                      <span>打开抽屉:</span>
+                      <span style="cursor:pointer;"  @click="openDrawer('right')">
+                        右侧  | 
+                      </span>
+                      <span style="cursor:pointer;" @click="openDrawer('rightInside')">
+                        右侧内部  | 
+                      </span>
+                      <span style="cursor:pointer;" @click="openDrawer('center')">
+                        居中
+                      </span>
+                    </span>
+                 </div>
+                  <div v-if="contact.isGroup" class="slot-group-menu">
+                      <span>聊天</span>
+                      <span>公告</span>
+                      <span>相册</span>
+                      <span>文件</span>
+                      <span>活动</span>
+                      <span>设置(左键弹出菜单)</span> 
+                </div>
+            </div>
+          </template>
+
+          <template #sidebar-contact-fixedtop="contact">
+                <div class="slot-contact-fixedtop">
+                  <input class="slot-search" placeholder="搜索通讯录" />
+                </div>
+          </template>
+
+         <template #message-side="contact">
+              <div v-if="contact.isGroup" class="slot-group">
+                    <div class="slot-group-title">群通知</div>
+                    <div class="slot-group-notice">
+                      进群请改备注,格式,工作地点-姓名,请大家配合谢谢
+                    </div>
+                    <div class="slot-group-title">群成员</div>
+                    <div class="slot-group-panel">
+                      <input class="slot-search" placeholder="搜索群成员" />
+                      <div class="slot-group-member">
+                        <div class="avatar"><img src="https://p.qqan.com/up/2020-2/2020022821001845128.jpg"></div>
+                        <div class="name">像梦一样自由</div> 
+                      </div>
+                      <div class="slot-group-member">
+                        <div class="avatar"><img src="https://p.qqan.com/up/2018-4/15244505348390471.jpg"></div>
+                        <div class="name">野火</div> 
+                      </div>
+                      <div class="slot-group-member">
+                        <div class="avatar"><img src="https://p.qqan.com/up/2021-1/20211411391666.jpg"></div>
+                        <div class="name">霸王花</div> 
+                      </div>
+                       <div class="slot-group-member">
+                        <div class="avatar"><img src="https://p.qqan.com/up/2021-1/2021113104111220.jpg"></div>
+                        <div class="name">森系Style</div> 
+                      </div>
+                      
+                    </div>
+               </div>
+          </template>
+        
+        </lemon-imui>
+      </div>
+   
+  </div>
+</template>
+
+<script>
+
+import store from "@/store";
+import { getQrCode } from '@/api/qw/login';
+import { getDeviceId} from '@/api/qw/account';
+import { getContacts} from '@/api/qw/im';
+import LemonMessageVoice from "@/components/LemonUI/components/lemon-message-voice";
+import ContactsData from "@/components/LemonUI/database/contacts";
+import MessagesData from "@/components/LemonUI/database/messages";
+import EmojiData from "@/components/LemonUI/database/emoji";
+import '@/components/LemonUI/index.css';
+
+export default {
+  name: "qqChat",
+  components: {  },
+  data() {
+    return {
+      theme: "default",
+      contactData:[],
+      deviceId:'4eea1292408044beb49c02d3197871b0',
+      contactContextmenu: [
+        {
+          text: "删除该聊天",
+          click: (e, instance, hide) => {
+            const { IMUI, contact } = instance;
+            IMUI.updateContact({
+              id: contact.id,
+              lastContent: null,
+            });
+            if (IMUI.currentContactId == contact.id) IMUI.changeContact(null);
+            hide();
+          },
+        },
+        {
+          text: "设置备注和标签",
+        },
+        {
+          text: "投诉",
+        },
+        {
+          icon: "lemon-icon-message",
+          text: "加入黑名单",
+          render: (h, instance, hide) => {
+            return (
+              <div style="display:flex;justify-content:space-between;align-items:center;width:130px">
+                <span>加入黑名单</span>
+                <span>
+                  <input type="checkbox" id="switch" />
+                  <label id="switch-label" for="switch">
+                    Toggle
+                  </label>
+                </span>
+              </div>
+            );
+          },
+        },
+        {
+          click(e, instance, hide) {
+            const { IMUI, contact } = instance;
+            IMUI.removeContact(contact.id);
+            if (IMUI.currentContactId == contact.id) IMUI.changeContact(null);
+            hide();
+          },
+          color: "red",
+          text: "删除好友",
+        },
+      ],
+      contextmenu: [
+        {
+          click: (e, instance, hide) => {
+            const { IMUI, message } = instance;
+            const data = {
+              id: generateRandId(),
+              type: "event",
+              //使用 jsx 时 click必须使用箭头函数(使上下文停留在vue内)
+              content: (
+                <div>
+                  <span>
+                    你撤回了一条消息{" "}
+                    <span
+                      v-show={message.type == "text"}
+                      style="color:#333;cursor:pointer"
+                      content={message.content}
+                      on-click={e => {
+                        IMUI.setEditorValue(e.target.getAttribute("content"));
+                      }}
+                    >
+                      重新编辑
+                    </span>
+                  </span>
+                </div>
+              ),
+              toContactId: message.toContactId,
+              sendTime: getTime(),
+            };
+            IMUI.removeMessage(message.id);
+            IMUI.appendMessage(data, true);
+            hide();
+          },
+          visible: instance => {
+            return instance.message.fromUser.id == this.user.id;
+          },
+          text: "撤回消息",
+        },
+        {
+          visible: instance => {
+            return instance.message.fromUser.id != this.user.id;
+          },
+          text: "举报",
+        },
+        {
+          text: "转发",
+        },
+        {
+          visible: instance => {
+            return instance.message.type == "text";
+          },
+          text: "复制文字",
+        },
+        {
+          visible: instance => {
+            return instance.message.type == "image";
+          },
+          text: "下载图片",
+        },
+        {
+          visible: instance => {
+            return instance.message.type == "file";
+          },
+          text: "下载文件",
+        },
+        {
+          click: (e, instance, hide) => {
+            const { IMUI, message } = instance;
+            IMUI.removeMessage(message.id);
+            hide();
+          },
+          icon: "lemon-icon-folder",
+          color: "red",
+          text: "删除",
+        },
+      ],
+      hideMenuAvatar: false,
+      hideMenu: false,
+      hideMessageName: false,
+      hideMessageTime: true,
+      qwUser:store.getters.qwUser,
+      showQW:false,
+      UserData: {
+        id: "1000",
+        displayName: "June",
+        avatar: "https://p.qqan.com/up/2018-4/15244505348390471.jpg",
+      },
+      windowWidth: document.documentElement.clientWidth*0.65,  //实时屏幕宽度
+      windowHeight: document.documentElement.clientHeight*0.7,   //实时屏幕高度
+    };
+  },
+  created(){
+     //this.getContacts();
+  },
+  mounted() {
+    if(!this.qwUser){
+        this.$message.error('未登录企微账号');
+        setTimeout(() => {
+          this.$router.go(-1);
+        }, 2000);
+        return;
+    }
+    console.log("qxj qwUser:"+JSON.stringify(this.qwUser));
+    this.showQW=true;
+    const contactData1 = {
+            id: "contact-1",
+            displayName: "工作协作群",
+            avatar: "http://upload.qqbodys.com/img/weixin/20170804/ji5qxg1am5ztm.jpg",
+            index: "[1]群组",
+            unread: 0,
+            lastSendTime: 1566047865417,
+            lastContent: "2",
+    };
+    const contactData2 = {
+            id: "contact-2",
+            displayName: "自定义内容",
+            avatar: "http://upload.qqbodys.com/img/weixin/20170807/jibfvfd00npin.jpg",
+            //index: "Z",
+            click(next) {
+                next();
+            },
+            renderContainer: () => {
+                return <h1 style="text-indent:20px">自定义页面</h1>;
+            },
+            lastSendTime: 1345209465000,
+            lastContent: "12312",
+            unread: 2,
+    };
+    const contactData3 = {
+            id: "contact-3",
+            displayName: "铁牛",
+            avatar: "http://upload.qqbodys.com/img/weixin/20170803/jiq4nzrkrnd0e.jpg",
+            index: "T",
+            unread: 32,
+            lastSendTime: 3,
+            lastContent: "你好123",
+    };
+    const IMUI = this.$refs.IMUI;
+    IMUI.initContacts(this.contactData);
+
+    var conversationData = ContactsData.filter(item => item.id<=7);
+    conversationData.sort((a1, a2) => {
+      return a2.lastSendTime - a1.lastSendTime;
+    });
+    IMUI.initConversations(conversationData);
+    IMUI.initMenus([
+      {
+        name: "messages",
+      },
+      {
+        name: "contacts",
+      },
+      {
+        name: "custom1",
+        title: "自定义按钮1",
+        unread: 0,
+        render: menu => {
+          return <i class="lemon-icon-attah" />;
+        },
+        renderContainer: () => {
+          return (
+            <div class="article">
+              <ul>
+                <li class="article-item">
+                  <h2>人民日报谈网红带货:产品真的值得买吗?</h2>
+                </li>
+                <li class="article-item">
+                  甘肃夏河县发生5.7级地震 暂未接到人员伤亡报告
+                </li>
+                <li class="article-item">
+                  北方多地风力仍强沙尘相伴,东北内蒙古等地迎雨雪
+                </li>
+                <li class="article-item">
+                  英货车案:越南警方采集疑死者家属DNA作比对
+                </li>
+                <li class="article-item">
+                  知名连锁咖啡店的蛋糕吃出活虫 曝光内幕太震惊
+                </li>
+              </ul>
+              <lemon-contact  props={{ contact: contactData1 }} style="margin:20px"/>
+              <lemon-contact props={{ contact: contactData3 }} style="margin:20px" />
+            </div>
+          );
+        },
+        isBottom: true,
+      },
+      {
+        name: "custom2",
+        title: "自定义按钮2",
+        unread: 0,
+        click: () => {
+          alert("拦截导航点击事件");
+        },
+        render: menu => {
+          return <i class="lemon-icon-group" />;
+        },
+        isBottom: true,
+      },
+    ]);
+
+    IMUI.initEmoji(EmojiData);  
+    IMUI.changeContact(13);
+  },
+  methods: {
+    getContacts(){
+      getContacts(this.deviceId).then(response => {
+        this.contactData = response.data;
+      });
+    },
+    messageTimeFormat(time) {
+      console.log("qxj messageTimeFormat:"+time);
+      return this.friendlyDate(time);
+    },
+    changeTheme() {
+       this.theme = this.theme == "default" ? "blue" : "default";
+    },
+    scrollToTop() {
+      document.body.scrollIntoView();
+    },
+    openDrawer(position) {
+            const IMUI = this.$refs.IMUI;
+            const params = {
+                position,
+                render: contact => {
+                return (
+                    <div style="padding:15px">
+                    <h5>{contact.displayName}</h5>
+                    <span style="cursor:pointer;" on-click={IMUI.closeDrawer}>关闭抽屉</span>
+                    </div>
+                );
+                },
+      };
+      if (position == "center") {
+        params.width = "50%";
+        params.height = "50%";
+      } else if (position == "rightInside") {
+        params.height = "90%";
+        params.offsetY = "10%";
+      }
+      IMUI.openDrawer(params);
+    },
+    handlePullMessages(contact, next,instance) {
+      const { IMUI } = this.$refs;
+      console.log("qxj instance:"+instance.getMessages(instance.currentContactId));
+      setTimeout(() => {
+            var tmessages=MessagesData[contact.id];
+            let messages= tmessages.sort((c1, c2) => c1.sendTime - c2.sendTime);
+            var currentMsgs=instance.getMessages(instance.currentContactId);
+            var sorMsgs=[];
+            var num=0
+            for (let index = currentMsgs.length; index < messages.length; index++) {
+                const item = messages[index];
+                if(num>=5){
+                    break;
+                }
+                sorMsgs.push(item);
+                num++;
+            }
+            let isEnd = false;
+            if (currentMsgs.length+sorMsgs.length>=messages.length){
+                isEnd = true;
+            }
+           next(MessagesData[contact.id], isEnd);
+      }, 3000);
+    },
+    handleChangeContact(contact, instance) {
+        console.log("qxj contact:"+JSON.stringify(contact));
+        //instance.updateContact(contact);
+        instance.closeDrawer();
+    },
+    handleSend(message, next, file) {
+      console.log(message, next, file);
+      setTimeout(() => {
+        next();
+      }, 1000);
+    },
+    handleMenuAvatarClick() {
+      console.log("Event:menu-avatar-click");
+    },
+
+    handleMessageClick(e, key, message, instance) {
+      console.log("点击了消息", e, key, message);
+      if (key == "status") {
+        instance.updateMessage({
+          id: message.id,
+          status: "going",
+          content: "正在重新发送消息...",
+        });
+        setTimeout(() => {
+          instance.updateMessage({
+            id: message.id,
+            status: "succeed",
+            content: "发送成功",
+          });
+        }, 2000);
+      }
+    },
+
+    changeMenuAvatarVisible() {
+      this.hideMenuAvatar = !this.hideMenuAvatar;
+    },
+    changeMenuVisible() {
+      this.hideMenu = !this.hideMenu;
+    },
+    changeMessageNameVisible() {
+      this.hideMessageName = !this.hideMessageName;
+    },
+    changeMessageTimeVisible() {
+      this.hideMessageTime = !this.hideMessageTime;
+    },
+    removeMessage() {
+        const { IMUI } = this.$refs;
+        const messages = IMUI.getCurrentMessages();
+        const id = messages[messages.length - 1].id;
+        if (messages.length > 0) {
+            IMUI.removeMessage(id);
+        }
+    },
+    updateMessage() {
+        const { IMUI } = this.$refs;
+        const messages = IMUI.getCurrentMessages();
+        const message = messages[messages.length - 1];
+        if (messages.length > 0) {
+            const update = {
+            id: message.id,
+            status: "succeed",
+            type: "file",
+            fileName: "被修改成文件了.txt",
+            fileSize: "4200000",
+            };
+            if (message.type == "event") {
+            update.fromUser = this.user;
+            }
+            IMUI.updateMessage(update);
+            IMUI.messageViewToBottom();
+      }
+    },
+    appendCustomMessage() {
+        const { IMUI } = this.$refs;
+        const message = {
+            id: generateRandId(),
+            status: "succeed",
+            type: "voice",
+            sendTime: getTime(),
+            content: "语音消息",
+            params1: "1",
+            params2: "2",
+            toContactId: "contact-1",
+            fromUser: this.user,
+        };
+        IMUI.appendMessage(message, true);
+    },
+    appendMessage() {
+        const { IMUI } = this.$refs;
+        const contact = IMUI.currentContact;
+        const message = generateMessage("contact-3");
+        message.fromUser = {
+            ...message.fromUser,
+            ...this.user,
+        };
+        IMUI.appendMessage(message, true);
+        console.log("🚀 ~ file: App.vue ~ line 1508 ~ appendMessage ~ message", message)
+    },
+    appendEventMessage() {
+      const { IMUI } = this.$refs;
+      const message = {
+        id: generateRandId(),
+        type: "event",
+        content: (
+          <span>
+            邀请你加入群聊{" "}
+            <span
+              style="color:#333;cursor:pointer"
+              on-click={() => alert("OK")}
+            >
+              接受
+            </span>
+          </span>
+        ),
+        toContactId: "contact-3",
+        sendTime: getTime(),
+      };
+      IMUI.appendMessage(message, true);
+    },
+    updateContact() {
+      this.$refs.IMUI.updateContact({
+        id: "contact-3",
+        unread: 10,
+        displayName: generateRandWord(),
+        lastSendTime: getTime(),
+        lastContent: "修改昵称为随机字母",
+      });
+    },
+    handleChangeMenu() {
+      console.log("Event:change-menu");
+    },
+    openCustomContainer() {
+
+    }
+  },
+};
+</script>
+
+<style lang="scss" scoped>
+    .imui-center{
+        margin-bottom:"60px"; 
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        height: 80vh;
+    }
+    .lemon-wrapper{
+        border:"1px solid #ddd";
+        height: "60%" !important;
+    }
+    .lemon-drawer{
+        border:"1px solid #ddd";
+        border-left:"0";
+    }
+    .more {
+        font-size: 12px;
+        line-height: 24px;
+        height: 24px;
+        position: absolute;
+        top: 14px;
+        right: 14px;
+        cursor: pointer;
+        -webkit-user-select: none;
+        -moz-user-select: none;
+        -ms-user-select: none;
+        user-select: none;
+        color: #f1f1f1;
+        display: inline-block;
+        border-radius: 4px;
+        background: #111;
+        padding: 0 8px;
+    }
+    
+</style>
+
+
+<style lang="stylus">
+   .lemon-container__title
+     padding-bottom:10px;
+   .slot-group
+      width:200px;
+      .slot-group-title
+        padding:0 0 10px 0;
+        .slot-group-notice
+           padding: 10px 10px;
+     
+      .slot-search
+           width:calc(100% - 20px) ;
+           margin:5px 10px;
+           padding:3px 0px;
+
+      .slot-group-member
+          display: flex;
+          padding: 5px 0;
+          flex:1;
+          font-size: 14px;
+          align-items: center;
+          .avatar
+              width: 30px;
+              height: 30px;
+              line-height: 30px;
+              margin-right:5px;
+              img 
+                vertical-align: middle;
+                border-style: none;
+                width: 100%;
+                height: 100%;
+                line-height: 30px;
+                border-radius: 50%;
+
+      
+
+</style>

+ 13 - 5
src/views/qw/qwLogin/index.vue

@@ -102,7 +102,6 @@ export default {
     },
 
     loginAction(){
-             
               const account = this.qwForm.account;
               this.loading=true;
               if (this.showQRCode) {
@@ -149,17 +148,26 @@ export default {
                         console.log("收到服务端内容", JSON.stringify(data));
                         if(data.cmd=="loginSucc"){
                             var qwUserInfo=JSON.parse(data.msg);
-                            //console.log("qxj loginSucc", JSON.stringify(qwUserInfo));
-                           
-                            store.dispatch('qwUser',qwUserInfo);
+                            Notification.success({title: "登录成功!" });
+                            that.$store.dispatch("qwUser", qwUserInfo);
                             that.showQRCode=false;
-                            that.$router.push({path:'/qw/chat'});
+                            setTimeout(() => {
+                                that.$router.push({path:'/qw/chat'});
+                            }, 2000);
                         }
                         if(data.cmd=="verifyCode"){
                             that.loginTips="登录";
                             that.showQRCode=false;
                             that.showVerifyCode=true;
                         }
+                        if(data.cmd=="offline"){
+                            that.loginTips="获取验证码";
+                            that.showQRCode=true;
+                            that.showVerifyCode=false;
+                            that.$store.dispatch('qwLoginOut').then(() => {
+                               
+                            });
+                        }
                   };
                     // 监听socket消息
                   this.qwIm.socket.onclose = function(res) {