diff --git a/src/components/PersonCard.vue b/src/components/PersonCard.vue index 3b9e78c..1a9e5f1 100644 --- a/src/components/PersonCard.vue +++ b/src/components/PersonCard.vue @@ -4,7 +4,7 @@
{{ personInfo.name }}
-
{{ personInfo.lastMsg }}
+
{{ personInfo.detail }}
diff --git a/src/mock/index.js b/src/mock/index.js index 60c01c9..56671f2 100644 --- a/src/mock/index.js +++ b/src/mock/index.js @@ -53,26 +53,16 @@ let chatMsg1002 = Mock.mock( headImg: require("@/assets/img/head_portrait.jpg"), name: "大毛是小白", time: "09:12 AM", - msg: " Same here! Been working project for the past 5 hours despite ofhaving so much to do", + msg: " 在吗?", chatType: 0, //信息类型,0文字,1图片 uid: "1001", //uid }, - { - headImg: require("@/assets/img/head_portrait.jpg"), - name: "大毛是小白", - time: "09:12 AM", - msg: require("@/assets/img/emoji/slightly-smiling-face.png"), - chatType: 1, //信息类型,0文字,1图片 - extend: { - imgType: 1, //(1表情,2本地图片) - }, - uid: "1001", - }, + { headImg: require("@/assets/img/head_portrait1.jpg"), name: "大毛", time: "09:12 AM", - msg: " Same here! Been working project for the past 5 hours despite ofhaving so much to do", + msg: " 怎么了?", chatType: 0, //信息类型,0文字,1图片 uid: "1002", //uid }, @@ -80,7 +70,7 @@ let chatMsg1002 = Mock.mock( headImg: require("@/assets/img/head_portrait.jpg"), name: "大毛是小白", time: "09:12 AM", - msg: "Same here! Been working project for the past 5 hours despite ofhaving so much to do", + msg: "问你个问题", chatType: 0, //信息类型,0文字,1图片, 2文件 uid: "1001", }, @@ -88,10 +78,21 @@ let chatMsg1002 = Mock.mock( headImg: require("@/assets/img/head_portrait1.jpg"), name: "大毛", time: "09:12 AM", - msg: "to do", + msg: "别问", chatType: 0, //信息类型,0文字,1图片 uid: "1002", //uid }, + { + headImg: require("@/assets/img/head_portrait.jpg"), + name: "大毛是小白", + time: "09:12 AM", + msg: require("@/assets/img/emoji/slightly-smiling-face.png"), + chatType: 1, //信息类型,0文字,1图片 + extend: { + imgType: 1, //(1表情,2本地图片) + }, + uid: "1001", + }, ] ) let chatMsg1003 = Mock.mock( @@ -100,7 +101,7 @@ let chatMsg1003 = Mock.mock( headImg: require("@/assets/img/head_portrait.jpg"), name: "大毛是小白", time: "09:12 AM", - msg: " 的武器的物权法润滑油它具有就该回家该方法回复观后感防护服哈和规范化发同意头发o", + msg: "在干嘛呢", chatType: 0, //信息类型,0文字,1图片 uid: "1001", //uid }, @@ -119,7 +120,7 @@ let chatMsg1003 = Mock.mock( headImg: require("@/assets/img/head_portrait2.jpg"), name: "小毛", time: "09:12 AM", - msg: " 萨达萨达哇大所多谁打我的是否如果突然核桃油还要加㔿fhaving so much to do", + msg: "吃饭", chatType: 0, //信息类型,0文字,1图片 uid: "1002", //uid }, @@ -127,7 +128,7 @@ let chatMsg1003 = Mock.mock( headImg: require("@/assets/img/head_portrait.jpg"), name: "大毛是小白", time: "09:12 AM", - msg: "盒饭光和热挺好的返回给都发给顿肉肉人工费大概人刮大风个的个", + msg: "吃的什么饭", chatType: 0, //信息类型,0文字,1图片, 2文件 uid: "1001", }, @@ -135,15 +136,23 @@ let chatMsg1003 = Mock.mock( headImg: require("@/assets/img/head_portrait2.jpg"), name: "小毛", time: "09:12 AM", - msg: "frfrgrgtreg gt g fdg dfg drrg f d", + msg: "蛋炒饭", chatType: 0, //信息类型,0文字,1图片 uid: "1002", //uid }, + { + headImg: require("@/assets/img/head_portrait.jpg"), + name: "大毛是小白", + time: "09:12 AM", + msg: "加蛋了吗?", + chatType: 0, //信息类型,0文字,1图片, 2文件 + uid: "1001", + }, { headImg: require("@/assets/img/head_portrait2.jpg"), name: "小毛", time: "09:12 AM", - msg: "qwewqewrr hy jy ju juyj ", + msg: "你说呢", chatType: 0, //信息类型,0文字,1图片 uid: "1002", //uid }, @@ -151,8 +160,11 @@ let chatMsg1003 = Mock.mock( headImg: require("@/assets/img/head_portrait2.jpg"), name: "小毛", time: "09:12 AM", - msg: "dada dw ertgthy j uy", - chatType: 0, //信息类型,0文字,1图片 + msg: require("@/assets/img/emoji/slightly-smiling-face.png"), + chatType: 1, //信息类型,0文字,1图片 + extend: { + imgType: 1, //(1表情,2本地图片) + }, uid: "1002", //uid }, ] diff --git a/src/view/pages/chatHome/chatwindow.vue b/src/view/pages/chatHome/chatwindow.vue index 3a19beb..b3f8b39 100644 --- a/src/view/pages/chatHome/chatwindow.vue +++ b/src/view/pages/chatHome/chatwindow.vue @@ -201,6 +201,7 @@ export default { uid: "1001", //uid }; this.sendMsg(chatMsg); + this.$emit('personCardSort', this.frinedInfo.id) this.inputMsg = ""; } else { this.$message({ diff --git a/src/view/pages/chatHome/index.vue b/src/view/pages/chatHome/index.vue index bd2165c..5a76187 100644 --- a/src/view/pages/chatHome/index.vue +++ b/src/view/pages/chatHome/index.vue @@ -24,7 +24,10 @@
- +
@@ -67,6 +70,20 @@ export default { this.personInfo = info; this.pcCurrent = info.id; }, + personCardSort(id) { + if (id !== this.personList[0].id) { + console.log(id); + let nowPersonInfo; + for (let i = 0; i < this.personList.length; i++) { + if (this.personList[i].id == id) { + nowPersonInfo = this.personList[i]; + this.personList.splice(i, 1); + break; + } + } + this.personList.unshift(nowPersonInfo); + } + }, }, }; @@ -104,7 +121,7 @@ export default { } .chatRight { - flex:1; + flex: 1; padding-right: 30px; .showIcon { position: absolute;