修复BUG,v-lemon-contextmenu支持左键触发
This commit is contained in:
Vendored
+7380
-5458
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+7380
-5458
File diff suppressed because it is too large
Load Diff
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+59
-425
@@ -92,80 +92,8 @@
|
|||||||
|
|
||||||
<div style="display:flex;">
|
<div style="display:flex;">
|
||||||
<div>
|
<div>
|
||||||
<div class="title">插槽演示</div>
|
<div class="title">自定义</div>
|
||||||
<div class="imui-center">
|
<div class="imui-center"><qq-imui>12312312</qq-imui></div>
|
||||||
<lemon-imui
|
|
||||||
:user="user"
|
|
||||||
class="lemon-slot"
|
|
||||||
ref="SlotIMUI"
|
|
||||||
@pull-messages="handlePullMessages"
|
|
||||||
@message-click="handleMessageClick"
|
|
||||||
@change-contact="handleChangeContact"
|
|
||||||
@send="handleSend"
|
|
||||||
send-text="发送消息"
|
|
||||||
:send-key="e => e.ctrlKey == true"
|
|
||||||
>
|
|
||||||
<template #editor-footer>
|
|
||||||
按 ctrl 键发送消息
|
|
||||||
</template>
|
|
||||||
<template #cover>
|
|
||||||
<div class="cover">
|
|
||||||
<i class="lemon-icon-message"></i>
|
|
||||||
<p><b>自定义封面 Lemon</b> IMUI</p>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
||||||
<template #message-title="contact">
|
|
||||||
<span>{{ contact.displayName }}</span>
|
|
||||||
<small class="more" @click="changeDrawer(contact, $refs.SlotIMUI)"
|
|
||||||
>{{
|
|
||||||
($refs.SlotIMUI
|
|
||||||
? $refs.SlotIMUI.drawerVisible
|
|
||||||
: false)
|
|
||||||
? "关闭"
|
|
||||||
: "打开"
|
|
||||||
}}抽屉</small
|
|
||||||
>
|
|
||||||
</template>
|
|
||||||
<template #message-after="message">
|
|
||||||
<span>未读</span>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<template #contact-info="contact">
|
|
||||||
自定义通讯录信息 {{ contact.displayName }}
|
|
||||||
</template>
|
|
||||||
<template #sidebar-message="contact">
|
|
||||||
<lemon-badge :count="contact.unread" style="width:100%">
|
|
||||||
<div>
|
|
||||||
<p>
|
|
||||||
<span>{{ contact.displayName }}</span>
|
|
||||||
</p>
|
|
||||||
<p
|
|
||||||
class="lemon-contact__content"
|
|
||||||
style="height:18px;font-size:12px;color:#aaa;"
|
|
||||||
>
|
|
||||||
最新消息:
|
|
||||||
<span v-html="contact.lastContent"></span>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</lemon-badge>
|
|
||||||
</template>
|
|
||||||
<template #sidebar-contact="contact">
|
|
||||||
<span>{{ contact.displayName }}</span>
|
|
||||||
</template>
|
|
||||||
<template #sidebar-message-top>
|
|
||||||
<div class="bar">最新消息顶部</div>
|
|
||||||
</template>
|
|
||||||
<template #sidebar-contact-top>
|
|
||||||
<div class="bar">联系人顶部</div>
|
|
||||||
</template>
|
|
||||||
<template #sidebar-message-fixedtop>
|
|
||||||
<div class="bar">最新消息顶部 Fixed</div>
|
|
||||||
</template>
|
|
||||||
<template #sidebar-contact-fixedtop>
|
|
||||||
<div class="bar">联系人顶部 Fixed</div>
|
|
||||||
</template>
|
|
||||||
</lemon-imui>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div style="margin:0 55px;">
|
<div style="margin:0 55px;">
|
||||||
@@ -1041,8 +969,11 @@ WebSocket.onmessage = function(event) {
|
|||||||
<script>
|
<script>
|
||||||
import Vue from "vue";
|
import Vue from "vue";
|
||||||
import LemonMessageVoice from "./lemon-message-voice";
|
import LemonMessageVoice from "./lemon-message-voice";
|
||||||
|
import QQIMUI from "./qq";
|
||||||
import packageData from "../package.json";
|
import packageData from "../package.json";
|
||||||
|
import EmojiData from "./database/emoji";
|
||||||
Vue.component(LemonMessageVoice.name, LemonMessageVoice);
|
Vue.component(LemonMessageVoice.name, LemonMessageVoice);
|
||||||
|
Vue.component(QQIMUI.name, QQIMUI);
|
||||||
|
|
||||||
const tip = `export default {
|
const tip = `export default {
|
||||||
//组件的name必须以lemonMessage开头,后面跟上 Message.type
|
//组件的name必须以lemonMessage开头,后面跟上 Message.type
|
||||||
@@ -1094,7 +1025,7 @@ const generateMessage = (toContactId = "", fromUser) => {
|
|||||||
fromUser = {
|
fromUser = {
|
||||||
id: "system",
|
id: "system",
|
||||||
displayName: "系统测试",
|
displayName: "系统测试",
|
||||||
avatar: "http://upload.qqbodys.com/allimg/1710/1035512943-0.jpg"
|
avatar: "http://upload.qqbodys.com/allimg/1710/1035512943-0.jpg",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
@@ -1106,7 +1037,7 @@ const generateMessage = (toContactId = "", fromUser) => {
|
|||||||
//fileSize: 1231,
|
//fileSize: 1231,
|
||||||
//fileName: "asdasd.doc",
|
//fileName: "asdasd.doc",
|
||||||
toContactId,
|
toContactId,
|
||||||
fromUser
|
fromUser,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1122,17 +1053,17 @@ export default {
|
|||||||
const { IMUI, contact } = instance;
|
const { IMUI, contact } = instance;
|
||||||
IMUI.updateContact({
|
IMUI.updateContact({
|
||||||
id: contact.id,
|
id: contact.id,
|
||||||
lastContent: null
|
lastContent: null,
|
||||||
});
|
});
|
||||||
if (IMUI.currentContactId == contact.id) IMUI.changeContact(null);
|
if (IMUI.currentContactId == contact.id) IMUI.changeContact(null);
|
||||||
hide();
|
hide();
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "设置备注和标签"
|
text: "设置备注和标签",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "投诉"
|
text: "投诉",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: "lemon-icon-message",
|
icon: "lemon-icon-message",
|
||||||
@@ -1148,7 +1079,7 @@ export default {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
click(e, instance, hide) {
|
click(e, instance, hide) {
|
||||||
@@ -1158,8 +1089,8 @@ export default {
|
|||||||
hide();
|
hide();
|
||||||
},
|
},
|
||||||
color: "red",
|
color: "red",
|
||||||
text: "删除好友"
|
text: "删除好友",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
contextmenu: [
|
contextmenu: [
|
||||||
{
|
{
|
||||||
@@ -1188,7 +1119,7 @@ export default {
|
|||||||
),
|
),
|
||||||
|
|
||||||
toContactId: message.toContactId,
|
toContactId: message.toContactId,
|
||||||
sendTime: getTime()
|
sendTime: getTime(),
|
||||||
};
|
};
|
||||||
IMUI.removeMessage(message.id);
|
IMUI.removeMessage(message.id);
|
||||||
IMUI.appendMessage(data, true);
|
IMUI.appendMessage(data, true);
|
||||||
@@ -1197,34 +1128,34 @@ export default {
|
|||||||
visible: instance => {
|
visible: instance => {
|
||||||
return instance.message.fromUser.id == this.user.id;
|
return instance.message.fromUser.id == this.user.id;
|
||||||
},
|
},
|
||||||
text: "撤回消息"
|
text: "撤回消息",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: instance => {
|
visible: instance => {
|
||||||
return instance.message.fromUser.id != this.user.id;
|
return instance.message.fromUser.id != this.user.id;
|
||||||
},
|
},
|
||||||
text: "举报"
|
text: "举报",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
text: "转发"
|
text: "转发",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: instance => {
|
visible: instance => {
|
||||||
return instance.message.type == "text";
|
return instance.message.type == "text";
|
||||||
},
|
},
|
||||||
text: "复制文字"
|
text: "复制文字",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: instance => {
|
visible: instance => {
|
||||||
return instance.message.type == "image";
|
return instance.message.type == "image";
|
||||||
},
|
},
|
||||||
text: "下载图片"
|
text: "下载图片",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
visible: instance => {
|
visible: instance => {
|
||||||
return instance.message.type == "file";
|
return instance.message.type == "file";
|
||||||
},
|
},
|
||||||
text: "下载文件"
|
text: "下载文件",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
click: (e, instance, hide) => {
|
click: (e, instance, hide) => {
|
||||||
@@ -1234,8 +1165,8 @@ export default {
|
|||||||
},
|
},
|
||||||
icon: "lemon-icon-folder",
|
icon: "lemon-icon-folder",
|
||||||
color: "red",
|
color: "red",
|
||||||
text: "删除"
|
text: "删除",
|
||||||
}
|
},
|
||||||
],
|
],
|
||||||
tip: tip,
|
tip: tip,
|
||||||
packageData,
|
packageData,
|
||||||
@@ -1246,8 +1177,8 @@ export default {
|
|||||||
user: {
|
user: {
|
||||||
id: "1",
|
id: "1",
|
||||||
displayName: "June",
|
displayName: "June",
|
||||||
avatar: ""
|
avatar: "",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
@@ -1258,7 +1189,7 @@ export default {
|
|||||||
index: "[1]群组",
|
index: "[1]群组",
|
||||||
unread: 0,
|
unread: 0,
|
||||||
lastSendTime: 1566047865417,
|
lastSendTime: 1566047865417,
|
||||||
lastContent: "2"
|
lastContent: "2",
|
||||||
};
|
};
|
||||||
const contactData2 = {
|
const contactData2 = {
|
||||||
id: "contact-2",
|
id: "contact-2",
|
||||||
@@ -1273,7 +1204,7 @@ export default {
|
|||||||
},
|
},
|
||||||
lastSendTime: 1345209465000,
|
lastSendTime: 1345209465000,
|
||||||
lastContent: "12312",
|
lastContent: "12312",
|
||||||
unread: 2
|
unread: 2,
|
||||||
};
|
};
|
||||||
const contactData3 = {
|
const contactData3 = {
|
||||||
id: "contact-3",
|
id: "contact-3",
|
||||||
@@ -1282,7 +1213,7 @@ export default {
|
|||||||
index: "T",
|
index: "T",
|
||||||
unread: 32,
|
unread: 32,
|
||||||
lastSendTime: 3,
|
lastSendTime: 3,
|
||||||
lastContent: "你好123"
|
lastContent: "你好123",
|
||||||
};
|
};
|
||||||
const contactData4 = {
|
const contactData4 = {
|
||||||
id: "contact-4",
|
id: "contact-4",
|
||||||
@@ -1292,12 +1223,12 @@ export default {
|
|||||||
index: "",
|
index: "",
|
||||||
unread: 1,
|
unread: 1,
|
||||||
lastSendTime: 3,
|
lastSendTime: 3,
|
||||||
lastContent: "吃饭了嘛"
|
lastContent: "吃饭了嘛",
|
||||||
};
|
};
|
||||||
|
|
||||||
const { IMUI } = this.$refs;
|
const { IMUI } = this.$refs;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
IMUI.changeContact('contact-1');
|
IMUI.changeContact("contact-1");
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
IMUI.setLastContentRender("event", message => {
|
IMUI.setLastContentRender("event", message => {
|
||||||
@@ -1307,17 +1238,17 @@ export default {
|
|||||||
let contactList = [
|
let contactList = [
|
||||||
{ ...contactData1 },
|
{ ...contactData1 },
|
||||||
{ ...contactData2 },
|
{ ...contactData2 },
|
||||||
{ ...contactData3 }
|
{ ...contactData3 },
|
||||||
//...Array(100).fill(contactData1)
|
//...Array(100).fill(contactData1)
|
||||||
];
|
];
|
||||||
|
|
||||||
IMUI.initContacts(contactList);
|
IMUI.initContacts(contactList);
|
||||||
IMUI.initMenus([
|
IMUI.initMenus([
|
||||||
{
|
{
|
||||||
name: "messages"
|
name: "messages",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "contacts"
|
name: "contacts",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "custom1",
|
name: "custom1",
|
||||||
@@ -1357,7 +1288,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
isBottom: true
|
isBottom: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "custom2",
|
name: "custom2",
|
||||||
@@ -1369,19 +1300,19 @@ export default {
|
|||||||
render: menu => {
|
render: menu => {
|
||||||
return <i class="lemon-icon-group" />;
|
return <i class="lemon-icon-group" />;
|
||||||
},
|
},
|
||||||
isBottom: true
|
isBottom: true,
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
|
|
||||||
IMUI.initEditorTools([
|
IMUI.initEditorTools([
|
||||||
{
|
{
|
||||||
name: "emoji"
|
name: "emoji",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "uploadFile"
|
name: "uploadFile",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "uploadImage"
|
name: "uploadImage",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test1",
|
name: "test1",
|
||||||
@@ -1390,7 +1321,7 @@ export default {
|
|||||||
},
|
},
|
||||||
render: () => {
|
render: () => {
|
||||||
return <span>Excel</span>;
|
return <span>Excel</span>;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test1",
|
name: "test1",
|
||||||
@@ -1399,7 +1330,7 @@ export default {
|
|||||||
},
|
},
|
||||||
render: () => {
|
render: () => {
|
||||||
return <span>重制工具栏</span>;
|
return <span>重制工具栏</span>;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "test2",
|
name: "test2",
|
||||||
@@ -1410,302 +1341,10 @@ export default {
|
|||||||
},
|
},
|
||||||
render: () => {
|
render: () => {
|
||||||
return <b>···</b>;
|
return <b>···</b>;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]);
|
]);
|
||||||
let emojiData = [
|
IMUI.initEmoji(EmojiData);
|
||||||
{
|
|
||||||
label: "表情",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: "1f600",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f600.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f62c",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f62c.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f601",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f601.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f602",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f602.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f923",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f923.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f973",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f973.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f603",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f603.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f604",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f604.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f605",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f605.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f606",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f606.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f607",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f607.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f609",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f609.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60a",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60a.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f642",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f642.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f643",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f643.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1263a",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/263a.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60b",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60b.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60c",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60c.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60d",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60d.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f970",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f970.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f618",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f618.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f617",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f617.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f619",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f619.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61a",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61a.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61c",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61c.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f92a",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f92a.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f928",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f928.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f9d0",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f9d0.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61d",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61d.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61b",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61b.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f911",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f911.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f913",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f913.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60e",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60e.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f929",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f929.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f921",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f921.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f920",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f920.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f917",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f917.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f60f",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f60f.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f636",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f636.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f610",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f610.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f611",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f611.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f612",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f612.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f644",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f644.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f914",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f914.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f925",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f925.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f92d",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f92d.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f92b",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f92b.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f92c",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f92c.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f92f",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f92f.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f633",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f633.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61e",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61e.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f61f",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f61f.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f620",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f620.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f621",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f621.png"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: "收藏",
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
name: "1f62c",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f62c.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: "1f621",
|
|
||||||
title: "微笑",
|
|
||||||
src: "https://twemoji.maxcdn.com/2/72x72/1f621.png"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
];
|
|
||||||
IMUI.initEmoji(emojiData);
|
|
||||||
|
|
||||||
IMUI.setLastContentRender("voice", message => {
|
IMUI.setLastContentRender("voice", message => {
|
||||||
return <span>[语音]</span>;
|
return <span>[语音]</span>;
|
||||||
@@ -1714,13 +1353,8 @@ export default {
|
|||||||
const { SimpleIMUI } = this.$refs;
|
const { SimpleIMUI } = this.$refs;
|
||||||
contactData1.id = "11";
|
contactData1.id = "11";
|
||||||
SimpleIMUI.initContacts([contactData1]);
|
SimpleIMUI.initContacts([contactData1]);
|
||||||
SimpleIMUI.initEmoji(emojiData);
|
SimpleIMUI.initEmoji(EmojiData);
|
||||||
SimpleIMUI.changeContact(contactData1.id);
|
SimpleIMUI.changeContact(contactData1.id);
|
||||||
|
|
||||||
const { SlotIMUI } = this.$refs;
|
|
||||||
contactData3.id = "333";
|
|
||||||
SlotIMUI.initContacts([contactData4, contactData3]);
|
|
||||||
SlotIMUI.initEmoji(emojiData);
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeTheme() {
|
changeTheme() {
|
||||||
@@ -1739,13 +1373,13 @@ export default {
|
|||||||
instance.updateMessage({
|
instance.updateMessage({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
status: "going",
|
status: "going",
|
||||||
content: "正在重新发送消息..."
|
content: "正在重新发送消息...",
|
||||||
});
|
});
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
instance.updateMessage({
|
instance.updateMessage({
|
||||||
id: message.id,
|
id: message.id,
|
||||||
status: "succeed",
|
status: "succeed",
|
||||||
content: "发送成功"
|
content: "发送成功",
|
||||||
});
|
});
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
}
|
||||||
@@ -1780,7 +1414,7 @@ export default {
|
|||||||
status: "succeed",
|
status: "succeed",
|
||||||
type: "file",
|
type: "file",
|
||||||
fileName: "被修改成文件了.txt",
|
fileName: "被修改成文件了.txt",
|
||||||
fileSize: "4200000"
|
fileSize: "4200000",
|
||||||
};
|
};
|
||||||
if (message.type == "event") {
|
if (message.type == "event") {
|
||||||
update.fromUser = this.user;
|
update.fromUser = this.user;
|
||||||
@@ -1800,7 +1434,7 @@ export default {
|
|||||||
params1: "1",
|
params1: "1",
|
||||||
params2: "2",
|
params2: "2",
|
||||||
toContactId: "contact-1",
|
toContactId: "contact-1",
|
||||||
fromUser: this.user
|
fromUser: this.user,
|
||||||
};
|
};
|
||||||
IMUI.appendMessage(message, true);
|
IMUI.appendMessage(message, true);
|
||||||
},
|
},
|
||||||
@@ -1810,7 +1444,7 @@ export default {
|
|||||||
const message = generateMessage("contact-3");
|
const message = generateMessage("contact-3");
|
||||||
message.fromUser = {
|
message.fromUser = {
|
||||||
...message.fromUser,
|
...message.fromUser,
|
||||||
...this.user
|
...this.user,
|
||||||
};
|
};
|
||||||
IMUI.appendMessage(message, true);
|
IMUI.appendMessage(message, true);
|
||||||
},
|
},
|
||||||
@@ -1831,7 +1465,7 @@ export default {
|
|||||||
</span>
|
</span>
|
||||||
),
|
),
|
||||||
toContactId: "contact-3",
|
toContactId: "contact-3",
|
||||||
sendTime: getTime()
|
sendTime: getTime(),
|
||||||
};
|
};
|
||||||
IMUI.appendMessage(message, true);
|
IMUI.appendMessage(message, true);
|
||||||
},
|
},
|
||||||
@@ -1841,7 +1475,7 @@ export default {
|
|||||||
unread: 10,
|
unread: 10,
|
||||||
displayName: generateRandWord(),
|
displayName: generateRandWord(),
|
||||||
lastSendTime: getTime(),
|
lastSendTime: getTime(),
|
||||||
lastContent: "修改昵称为随机字母"
|
lastContent: "修改昵称为随机字母",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeDrawer(contact, instance) {
|
changeDrawer(contact, instance) {
|
||||||
@@ -1863,14 +1497,14 @@ export default {
|
|||||||
<p>{contact.displayName}</p>
|
<p>{contact.displayName}</p>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
handleChangeContact(contact, instance) {
|
handleChangeContact(contact, instance) {
|
||||||
console.log("Event:change-contact");
|
console.log("Event:change-contact");
|
||||||
instance.updateContact({
|
instance.updateContact({
|
||||||
id: contact.id,
|
id: contact.id,
|
||||||
unread: 0
|
unread: 0,
|
||||||
});
|
});
|
||||||
instance.closeDrawer();
|
instance.closeDrawer();
|
||||||
},
|
},
|
||||||
@@ -1884,7 +1518,7 @@ export default {
|
|||||||
const otheruser = {
|
const otheruser = {
|
||||||
id: contact.id,
|
id: contact.id,
|
||||||
displayName: contact.displayName,
|
displayName: contact.displayName,
|
||||||
avatar: contact.avatar
|
avatar: contact.avatar,
|
||||||
};
|
};
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const messages = [
|
const messages = [
|
||||||
@@ -1897,8 +1531,8 @@ export default {
|
|||||||
generateMessage(instance.currentContactId, otheruser),
|
generateMessage(instance.currentContactId, otheruser),
|
||||||
{
|
{
|
||||||
...generateMessage(instance.currentContactId, this.user),
|
...generateMessage(instance.currentContactId, this.user),
|
||||||
...{ status: "failed" }
|
...{ status: "failed" },
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
let isEnd = false;
|
let isEnd = false;
|
||||||
if (
|
if (
|
||||||
@@ -1913,8 +1547,8 @@ export default {
|
|||||||
handleChangeMenu() {
|
handleChangeMenu() {
|
||||||
console.log("Event:change-menu");
|
console.log("Event:change-menu");
|
||||||
},
|
},
|
||||||
openCustomContainer() {}
|
openCustomContainer() {},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,147 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
displayName: "像梦一样自由",
|
||||||
|
avatar: "https://p.qqan.com/up/2020-2/2020022821001845128.jpg",
|
||||||
|
index: "X",
|
||||||
|
unread: 0,
|
||||||
|
lastSendTime: 1566047865417,
|
||||||
|
lastContent: "你开心吗",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 2,
|
||||||
|
displayName: "梦醒时分、",
|
||||||
|
avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
|
||||||
|
index: "M",
|
||||||
|
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: 10,
|
||||||
|
displayName: "叶子。",
|
||||||
|
avatar: "https://p.qqan.com/up/2021-1/20211301122243621.jpg",
|
||||||
|
index: "Y",
|
||||||
|
unread: 0,
|
||||||
|
lastSendTime: 1566047865417,
|
||||||
|
lastContent: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 11,
|
||||||
|
displayName: "土豆",
|
||||||
|
avatar: "https://p.qqan.com/up/2020-12/202012111157268739.jpg",
|
||||||
|
index: "T",
|
||||||
|
unread: 0,
|
||||||
|
lastSendTime: 1566047865417,
|
||||||
|
lastContent: "",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 12,
|
||||||
|
displayName: "清沫",
|
||||||
|
avatar: "https://p.qqan.com/up/2020-12/202012415467996.jpg",
|
||||||
|
index: "Q",
|
||||||
|
unread: 0,
|
||||||
|
lastSendTime: 1566047865417,
|
||||||
|
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: "",
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,292 @@
|
|||||||
|
export default [
|
||||||
|
{
|
||||||
|
label: "表情",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: "1f600",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f600.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f62c",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f62c.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f601",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f601.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f602",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f602.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f923",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f923.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f973",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f973.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f603",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f603.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f604",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f604.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f605",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f605.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f606",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f606.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f607",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f607.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f609",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f609.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60a",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60a.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f642",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f642.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f643",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f643.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1263a",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/263a.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60b",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60b.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60c",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60c.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60d",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60d.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f970",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f970.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f618",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f618.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f617",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f617.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f619",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f619.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61a",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61a.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61c",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61c.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f92a",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f92a.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f928",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f928.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f9d0",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f9d0.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61d",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61d.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61b",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61b.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f911",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f911.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f913",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f913.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60e",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60e.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f929",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f929.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f921",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f921.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f920",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f920.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f917",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f917.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f60f",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f60f.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f636",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f636.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f610",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f610.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f611",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f611.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f612",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f612.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f644",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f644.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f914",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f914.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f925",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f925.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f92d",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f92d.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f92b",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f92b.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f92c",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f92c.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f92f",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f92f.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f633",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f633.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61e",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61e.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f61f",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f61f.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f620",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f620.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f621",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f621.png",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "收藏",
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
name: "1f62c",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f62c.png",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "1f621",
|
||||||
|
title: "微笑",
|
||||||
|
src: "https://twemoji.maxcdn.com/2/72x72/1f621.png",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
];
|
||||||
@@ -0,0 +1,156 @@
|
|||||||
|
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(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: UserData,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "因为我矮啊。[!1f600][!1f600][!1f600]",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(1),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "你开心吗",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(1),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
2: [],
|
||||||
|
3: [],
|
||||||
|
4: [],
|
||||||
|
5: [],
|
||||||
|
6: [],
|
||||||
|
7: [],
|
||||||
|
8: [],
|
||||||
|
9: [],
|
||||||
|
10: [],
|
||||||
|
11: [],
|
||||||
|
12: [],
|
||||||
|
13: [
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "我是测试时候看到的",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "上新版本了,玩玩",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "项目内没有搞这个",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "@awesome 最新的,不然哪有这功能",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(5),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "其实是跟你的遮罩层有冲突",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(4),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "自己修改index哈",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: UserData,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "你们升级到最近版了吗?",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(6),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: generateRandId(),
|
||||||
|
status: "succeed",
|
||||||
|
type: "text",
|
||||||
|
sendTime: 1566047865417,
|
||||||
|
content: "wo 现在用的142",
|
||||||
|
toContactId: 1,
|
||||||
|
fromUser: getContact(7),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
14: [],
|
||||||
|
15: [],
|
||||||
|
};
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export default {
|
||||||
|
id: 1000,
|
||||||
|
avatar: "https://p.qqan.com/up/2018-4/15244505348390471.jpg",
|
||||||
|
displayName: "野火。",
|
||||||
|
};
|
||||||
Vendored
-1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -1 +1 @@
|
|||||||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.4c3079e2.css rel=preload as=style><link href=js/chunk-vendors.2abee366.js rel=preload as=script><link href=js/index.eb3bbc56.js rel=preload as=script><link href=css/index.4c3079e2.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.2abee366.js></script><script src=js/index.eb3bbc56.js></script></body></html>
|
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no"><link rel=icon href=favicon.ico><title>Lemon IMUI</title><link href=css/index.ef88e8c1.css rel=preload as=style><link href=js/chunk-vendors.e4810482.js rel=preload as=script><link href=js/index.1eaba05d.js rel=preload as=script><link href=css/index.ef88e8c1.css rel=stylesheet></head><body><noscript><strong>We're sorry but flat-im doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.e4810482.js></script><script src=js/index.1eaba05d.js></script></body></html>
|
||||||
-7
File diff suppressed because one or more lines are too long
+7
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,200 @@
|
|||||||
|
<script>
|
||||||
|
import UserData from "../database/user";
|
||||||
|
import ContactsData from "../database/contacts";
|
||||||
|
import MessagesData from "../database/messages";
|
||||||
|
import EmojiData from "../database/emoji";
|
||||||
|
export default {
|
||||||
|
name: "QqImui",
|
||||||
|
components: {},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div class="qq-lemon-imui">
|
||||||
|
<lemon-imui
|
||||||
|
class="lemon-slot"
|
||||||
|
user={UserData}
|
||||||
|
width={900}
|
||||||
|
avatar-cricle
|
||||||
|
hide-message-time
|
||||||
|
ref="IMUI"
|
||||||
|
on={{
|
||||||
|
"pull-messages": this.handlePullMessages,
|
||||||
|
"change-contact": this.handleChangeContact,
|
||||||
|
send: this.handleSend,
|
||||||
|
}}
|
||||||
|
scopedSlots={{
|
||||||
|
"message-title": contact => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div style="display:flex;justify-content:space-between">
|
||||||
|
<span>{contact.displayName}</span>
|
||||||
|
<span style="font-size:12px;">
|
||||||
|
<span>打开抽屉:</span>
|
||||||
|
<span
|
||||||
|
class="cursor:pointer;"
|
||||||
|
on-click={() => this.openDrawer("right")}
|
||||||
|
>
|
||||||
|
右侧 |{" "}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="cursor:pointer;"
|
||||||
|
on-click={() => this.openDrawer("rightInside")}
|
||||||
|
>
|
||||||
|
右侧内部 |{" "}
|
||||||
|
</span>
|
||||||
|
<span
|
||||||
|
class="cursor:pointer;"
|
||||||
|
on-click={() => this.openDrawer("center")}
|
||||||
|
>
|
||||||
|
居中
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{contact.isGroup && (
|
||||||
|
<div class="slot-group-menu">
|
||||||
|
<span>聊天</span>
|
||||||
|
<span>公告</span>
|
||||||
|
<span>相册</span>
|
||||||
|
<span>文件</span>
|
||||||
|
<span>活动</span>
|
||||||
|
<span
|
||||||
|
v-lemon-contextmenu_click={[
|
||||||
|
{
|
||||||
|
text: "操作一",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: "操作二",
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
设置(左键弹出菜单)
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
"sidebar-contact-fixedtop": contact => {
|
||||||
|
return (
|
||||||
|
<div class="slot-contact-fixedtop">
|
||||||
|
<input class="slot-search" placeholder="搜索通讯录" />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
"message-side": contact => {
|
||||||
|
if (contact.isGroup) {
|
||||||
|
return (
|
||||||
|
<div 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">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
<div class="slot-group-member">河南-96-十里青山</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
},
|
||||||
|
computed: {},
|
||||||
|
watch: {},
|
||||||
|
created() {},
|
||||||
|
mounted() {
|
||||||
|
const IMUI = this.$refs.IMUI;
|
||||||
|
//contactData3.id = "333";
|
||||||
|
IMUI.initContacts(ContactsData);
|
||||||
|
IMUI.changeContact(13);
|
||||||
|
//console.log(IMUI.getContacts());
|
||||||
|
// SlotIMUI.initEmoji(emojiData);
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
openDrawer(position) {
|
||||||
|
const IMUI = this.$refs.IMUI;
|
||||||
|
const params = {
|
||||||
|
position,
|
||||||
|
render: contact => {
|
||||||
|
return (
|
||||||
|
<div style="padding:15px">
|
||||||
|
<h5>{contact.displayName}</h5>
|
||||||
|
<span 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) {
|
||||||
|
next(MessagesData[contact.id], true);
|
||||||
|
},
|
||||||
|
handleChangeContact() {},
|
||||||
|
handleSend(message, next, file) {
|
||||||
|
console.log(message, next, file);
|
||||||
|
setTimeout(() => {
|
||||||
|
next();
|
||||||
|
}, 1000);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
<style lang="stylus">
|
||||||
|
.slot-group
|
||||||
|
width 170px
|
||||||
|
border-left 1px solid #ddd;
|
||||||
|
height 100%
|
||||||
|
box-sizing border-box
|
||||||
|
padding 10px
|
||||||
|
.slot-search
|
||||||
|
margin 5px 0
|
||||||
|
.slot-group-notice
|
||||||
|
color #999
|
||||||
|
padding 6px 0
|
||||||
|
font-size 12px
|
||||||
|
.slot-group-title
|
||||||
|
font-size 12px
|
||||||
|
.slot-group-member
|
||||||
|
font-size 12px
|
||||||
|
line-height 18px
|
||||||
|
.slot-group-menu span
|
||||||
|
display inline-block
|
||||||
|
cursor pointer
|
||||||
|
color #888
|
||||||
|
margin 4px 10px 0 0
|
||||||
|
border-bottom 2px solid transparent;
|
||||||
|
&:hover
|
||||||
|
color #000
|
||||||
|
border-color #333
|
||||||
|
.slot-contact-fixedtop
|
||||||
|
padding 10px
|
||||||
|
border-bottom 1px solid #ddd
|
||||||
|
.slot-search
|
||||||
|
width 100%
|
||||||
|
box-sizing border-box
|
||||||
|
font-size 14px
|
||||||
|
border 1px solid #bbb
|
||||||
|
padding 5px 10px
|
||||||
|
</style>
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "lemon-imui",
|
"name": "lemon-imui",
|
||||||
"version": "1.6.7",
|
"version": "1.6.8",
|
||||||
"main": "dist/index.umd.min.js",
|
"main": "dist/index.umd.min.js",
|
||||||
"description": "基于 VUE2.0 的 IM 聊天组件",
|
"description": "基于 VUE2.0 的 IM 聊天组件",
|
||||||
"homepage": "http://june000.gitee.io/lemon-im/",
|
"homepage": "http://june000.gitee.io/lemon-im/",
|
||||||
|
|||||||
@@ -9,8 +9,8 @@ export default {
|
|||||||
from: "IMUI",
|
from: "IMUI",
|
||||||
default() {
|
default() {
|
||||||
return this;
|
return this;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
@@ -22,19 +22,20 @@ export default {
|
|||||||
type: Function,
|
type: Function,
|
||||||
default(val) {
|
default(val) {
|
||||||
return timeFormat(val, isToday(val) ? "h:i" : "y/m/d");
|
return timeFormat(val, isToday(val) ? "h:i" : "y/m/d");
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={["lemon-contact", { "lemon-contact--name-center": this.simple }]}
|
class={["lemon-contact", { "lemon-contact--name-center": this.simple }]}
|
||||||
|
title={this.contact.displayName}
|
||||||
on-click={e => this._handleClick(e, this.contact)}
|
on-click={e => this._handleClick(e, this.contact)}
|
||||||
>
|
>
|
||||||
{useScopedSlot(
|
{useScopedSlot(
|
||||||
this.$scopedSlots.default,
|
this.$scopedSlots.default,
|
||||||
this._renderInner(),
|
this._renderInner(),
|
||||||
this.contact
|
this.contact,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@@ -71,13 +72,13 @@ export default {
|
|||||||
)}
|
)}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>,
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
_handleClick(e, data) {
|
_handleClick(e, data) {
|
||||||
this.$emit("click", data);
|
this.$emit("click", data);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="stylus">
|
<style lang="stylus">
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import contextmenu from "../directives/contextmenu";
|
|||||||
import {
|
import {
|
||||||
DEFAULT_MENUS,
|
DEFAULT_MENUS,
|
||||||
DEFAULT_MENU_LASTMESSAGES,
|
DEFAULT_MENU_LASTMESSAGES,
|
||||||
DEFAULT_MENU_CONTACTS
|
DEFAULT_MENU_CONTACTS,
|
||||||
} from "utils/constant";
|
} from "utils/constant";
|
||||||
import lastContentRender from "../lastContentRender";
|
import lastContentRender from "../lastContentRender";
|
||||||
|
|
||||||
@@ -26,25 +26,25 @@ export default {
|
|||||||
name: "LemonImui",
|
name: "LemonImui",
|
||||||
provide() {
|
provide() {
|
||||||
return {
|
return {
|
||||||
IMUI: this
|
IMUI: this,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
width: {
|
width: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: 850
|
default: 850,
|
||||||
},
|
},
|
||||||
height: {
|
height: {
|
||||||
type: [String, Number],
|
type: [String, Number],
|
||||||
default: 580
|
default: 580,
|
||||||
},
|
},
|
||||||
theme: {
|
theme: {
|
||||||
type: String,
|
type: String,
|
||||||
default: "default"
|
default: "default",
|
||||||
},
|
},
|
||||||
simple: {
|
simple: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 消息时间格式化规则
|
* 消息时间格式化规则
|
||||||
@@ -59,7 +59,7 @@ export default {
|
|||||||
*/
|
*/
|
||||||
hideDrawer: {
|
hideDrawer: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 是否隐藏导航按钮上的头像
|
* 是否隐藏导航按钮上的头像
|
||||||
@@ -83,8 +83,8 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
this.CacheContactContainer = new MemoryCache();
|
this.CacheContactContainer = new MemoryCache();
|
||||||
@@ -98,7 +98,7 @@ export default {
|
|||||||
activeSidebar: DEFAULT_MENU_LASTMESSAGES,
|
activeSidebar: DEFAULT_MENU_LASTMESSAGES,
|
||||||
contacts: [],
|
contacts: [],
|
||||||
menus: [],
|
menus: [],
|
||||||
editorTools: []
|
editorTools: [],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ export default {
|
|||||||
this._renderSidebarMessage(),
|
this._renderSidebarMessage(),
|
||||||
this._renderSidebarContact(),
|
this._renderSidebarContact(),
|
||||||
this._renderContainer(),
|
this._renderContainer(),
|
||||||
this._renderDrawer()
|
this._renderDrawer(),
|
||||||
]);
|
]);
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
@@ -133,10 +133,10 @@ export default {
|
|||||||
return a2.lastSendTime - a1.lastSendTime;
|
return a2.lastSendTime - a1.lastSendTime;
|
||||||
});
|
});
|
||||||
return data;
|
return data;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
activeSidebar() {}
|
activeSidebar() {},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
_menuIsContacts() {
|
_menuIsContacts() {
|
||||||
@@ -154,10 +154,10 @@ export default {
|
|||||||
sendTime: new Date().getTime(),
|
sendTime: new Date().getTime(),
|
||||||
toContactId: this.currentContactId,
|
toContactId: this.currentContactId,
|
||||||
fromUser: {
|
fromUser: {
|
||||||
...this.user
|
...this.user,
|
||||||
}
|
|
||||||
},
|
},
|
||||||
...message
|
},
|
||||||
|
...message,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -169,14 +169,14 @@ export default {
|
|||||||
id: message.toContactId,
|
id: message.toContactId,
|
||||||
unread: "+1",
|
unread: "+1",
|
||||||
lastSendTime: message.sendTime,
|
lastSendTime: message.sendTime,
|
||||||
lastContent: this.lastContentRender(message)
|
lastContent: this.lastContentRender(message),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this._addMessage(message, message.toContactId, 1);
|
this._addMessage(message, message.toContactId, 1);
|
||||||
const updateContact = {
|
const updateContact = {
|
||||||
id: message.toContactId,
|
id: message.toContactId,
|
||||||
lastContent: this.lastContentRender(message),
|
lastContent: this.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime,
|
||||||
};
|
};
|
||||||
if (message.toContactId == this.currentContactId) {
|
if (message.toContactId == this.currentContactId) {
|
||||||
if (scrollToBottom == true) {
|
if (scrollToBottom == true) {
|
||||||
@@ -197,7 +197,7 @@ export default {
|
|||||||
next();
|
next();
|
||||||
this.updateMessage(Object.assign(message, replaceMessage));
|
this.updateMessage(Object.assign(message, replaceMessage));
|
||||||
},
|
},
|
||||||
file
|
file,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_handleSend(text) {
|
_handleSend(text) {
|
||||||
@@ -207,7 +207,7 @@ export default {
|
|||||||
this.updateContact({
|
this.updateContact({
|
||||||
id: message.toContactId,
|
id: message.toContactId,
|
||||||
lastContent: this.lastContentRender(message),
|
lastContent: this.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime,
|
||||||
});
|
});
|
||||||
this.CacheDraft.remove(message.toContactId);
|
this.CacheDraft.remove(message.toContactId);
|
||||||
});
|
});
|
||||||
@@ -218,14 +218,14 @@ export default {
|
|||||||
if (imageTypes.includes(file.type)) {
|
if (imageTypes.includes(file.type)) {
|
||||||
joinMessage = {
|
joinMessage = {
|
||||||
type: "image",
|
type: "image",
|
||||||
content: URL.createObjectURL(file)
|
content: URL.createObjectURL(file),
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
joinMessage = {
|
joinMessage = {
|
||||||
type: "file",
|
type: "file",
|
||||||
fileSize: file.size,
|
fileSize: file.size,
|
||||||
fileName: file.name,
|
fileName: file.name,
|
||||||
content: ""
|
content: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
const message = this._createMessage(joinMessage);
|
const message = this._createMessage(joinMessage);
|
||||||
@@ -236,10 +236,10 @@ export default {
|
|||||||
this.updateContact({
|
this.updateContact({
|
||||||
id: message.toContactId,
|
id: message.toContactId,
|
||||||
lastContent: this.lastContentRender(message),
|
lastContent: this.lastContentRender(message),
|
||||||
lastSendTime: message.sendTime
|
lastSendTime: message.sendTime,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
file
|
file,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_emitPullMessages(next) {
|
_emitPullMessages(next) {
|
||||||
@@ -247,7 +247,7 @@ export default {
|
|||||||
this.$emit(
|
this.$emit(
|
||||||
"pull-messages",
|
"pull-messages",
|
||||||
this.currentContact,
|
this.currentContact,
|
||||||
(messages, isEnd = false) => {
|
(messages = [], isEnd = false) => {
|
||||||
this._addMessage(messages, this.currentContactId, 0);
|
this._addMessage(messages, this.currentContactId, 0);
|
||||||
this.CacheMessageLoaded.set(this.currentContactId, isEnd);
|
this.CacheMessageLoaded.set(this.currentContactId, isEnd);
|
||||||
if (isEnd == true) this.$refs.messages.loaded();
|
if (isEnd == true) this.$refs.messages.loaded();
|
||||||
@@ -255,7 +255,7 @@ export default {
|
|||||||
this._changeContactLock = false;
|
this._changeContactLock = false;
|
||||||
next(isEnd);
|
next(isEnd);
|
||||||
},
|
},
|
||||||
this
|
this,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
clearCacheContainer(name) {
|
clearCacheContainer(name) {
|
||||||
@@ -267,14 +267,14 @@ export default {
|
|||||||
<div
|
<div
|
||||||
style={{
|
style={{
|
||||||
width: toPx(this.width),
|
width: toPx(this.width),
|
||||||
height: toPx(this.height)
|
height: toPx(this.height),
|
||||||
}}
|
}}
|
||||||
ref="wrapper"
|
ref="wrapper"
|
||||||
class={[
|
class={[
|
||||||
"lemon-wrapper",
|
"lemon-wrapper",
|
||||||
`lemon-wrapper--theme-${this.theme}`,
|
`lemon-wrapper--theme-${this.theme}`,
|
||||||
{ "lemon-wrapper--simple": this.simple },
|
{ "lemon-wrapper--simple": this.simple },
|
||||||
this.drawerVisible && "lemon-wrapper--drawer-show"
|
this.drawerVisible && "lemon-wrapper--drawer-show",
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{children}
|
{children}
|
||||||
@@ -316,7 +316,7 @@ export default {
|
|||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
"lemon-menu__item",
|
"lemon-menu__item",
|
||||||
{ "lemon-menu__item--active": this.activeSidebar == name }
|
{ "lemon-menu__item--active": this.activeSidebar == name },
|
||||||
]}
|
]}
|
||||||
on-click={() => {
|
on-click={() => {
|
||||||
funCall(click, () => {
|
funCall(click, () => {
|
||||||
@@ -332,7 +332,7 @@ export default {
|
|||||||
});
|
});
|
||||||
return {
|
return {
|
||||||
top,
|
top,
|
||||||
bottom
|
bottom,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
_renderSidebarMessage() {
|
_renderSidebarMessage() {
|
||||||
@@ -343,22 +343,26 @@ export default {
|
|||||||
return this._renderContact(
|
return this._renderContact(
|
||||||
{
|
{
|
||||||
contact,
|
contact,
|
||||||
timeFormat: this.contactTimeFormat
|
timeFormat: this.contactTimeFormat,
|
||||||
},
|
},
|
||||||
() => this.changeContact(contact.id),
|
() => this.changeContact(contact.id),
|
||||||
this.$scopedSlots["sidebar-message"]
|
this.$scopedSlots["sidebar-message"],
|
||||||
);
|
);
|
||||||
})
|
}),
|
||||||
],
|
],
|
||||||
DEFAULT_MENU_LASTMESSAGES,
|
DEFAULT_MENU_LASTMESSAGES,
|
||||||
useScopedSlot(this.$scopedSlots["sidebar-message-fixedtop"], null, this)
|
useScopedSlot(
|
||||||
|
this.$scopedSlots["sidebar-message-fixedtop"],
|
||||||
|
null,
|
||||||
|
this,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_renderContact(props, onClick, slot) {
|
_renderContact(props, onClick, slot) {
|
||||||
const {
|
const {
|
||||||
click: customClick,
|
click: customClick,
|
||||||
renderContainer,
|
renderContainer,
|
||||||
id: contactId
|
id: contactId,
|
||||||
} = props.contact;
|
} = props.contact;
|
||||||
const click = () => {
|
const click = () => {
|
||||||
funCall(customClick, () => {
|
funCall(customClick, () => {
|
||||||
@@ -366,7 +370,7 @@ export default {
|
|||||||
this._customContainerReady(
|
this._customContainerReady(
|
||||||
renderContainer,
|
renderContainer,
|
||||||
this.CacheContactContainer,
|
this.CacheContactContainer,
|
||||||
contactId
|
contactId,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -374,13 +378,13 @@ export default {
|
|||||||
return (
|
return (
|
||||||
<lemon-contact
|
<lemon-contact
|
||||||
class={{
|
class={{
|
||||||
"lemon-contact--active": this.currentContactId == props.contact.id
|
"lemon-contact--active": this.currentContactId == props.contact.id,
|
||||||
}}
|
}}
|
||||||
v-lemon-contextmenu_contact={this.contactContextmenu}
|
v-lemon-contextmenu_contact={this.contactContextmenu}
|
||||||
props={props}
|
props={props}
|
||||||
on-click={click}
|
on-click={click}
|
||||||
scopedSlots={{ default: slot }}
|
scopedSlots={{ default: slot }}
|
||||||
></lemon-contact>
|
/>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_renderSidebarContact() {
|
_renderSidebarContact() {
|
||||||
@@ -398,20 +402,24 @@ export default {
|
|||||||
this._renderContact(
|
this._renderContact(
|
||||||
{
|
{
|
||||||
contact: contact,
|
contact: contact,
|
||||||
simple: true
|
simple: true,
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.changeContact(contact.id);
|
this.changeContact(contact.id);
|
||||||
},
|
},
|
||||||
this.$scopedSlots["sidebar-contact"]
|
this.$scopedSlots["sidebar-contact"],
|
||||||
)
|
),
|
||||||
];
|
];
|
||||||
prevIndex = contact.index;
|
prevIndex = contact.index;
|
||||||
return node;
|
return node;
|
||||||
})
|
}),
|
||||||
],
|
],
|
||||||
DEFAULT_MENU_CONTACTS,
|
DEFAULT_MENU_CONTACTS,
|
||||||
useScopedSlot(this.$scopedSlots["sidebar-contact-fixedtop"], null, this)
|
useScopedSlot(
|
||||||
|
this.$scopedSlots["sidebar-contact-fixedtop"],
|
||||||
|
null,
|
||||||
|
this,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
_renderSidebar(children, name, fixedtop) {
|
_renderSidebar(children, name, fixedtop) {
|
||||||
@@ -429,7 +437,7 @@ export default {
|
|||||||
_renderDrawer() {
|
_renderDrawer() {
|
||||||
return this._menuIsMessages() && this.currentContactId ? (
|
return this._menuIsMessages() && this.currentContactId ? (
|
||||||
<div class="lemon-drawer" ref="drawer">
|
<div class="lemon-drawer" ref="drawer">
|
||||||
{renderDrawerContent()}
|
{renderDrawerContent(this.currentContact)}
|
||||||
{useScopedSlot(this.$scopedSlots.drawer, "", this.currentContact)}
|
{useScopedSlot(this.$scopedSlots.drawer, "", this.currentContact)}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
@@ -450,7 +458,7 @@ export default {
|
|||||||
nodes.push(
|
nodes.push(
|
||||||
<div class={cls} v-show={show}>
|
<div class={cls} v-show={show}>
|
||||||
{this.CacheContactContainer.get(name)}
|
{this.CacheContactContainer.get(name)}
|
||||||
</div>
|
</div>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
for (const name in this.CacheMenuContainer.get()) {
|
for (const name in this.CacheMenuContainer.get()) {
|
||||||
@@ -460,7 +468,7 @@ export default {
|
|||||||
v-show={this.activeSidebar == name && !this.currentIsDefSidebar}
|
v-show={this.activeSidebar == name && !this.currentIsDefSidebar}
|
||||||
>
|
>
|
||||||
{this.CacheMenuContainer.get(name)}
|
{this.CacheMenuContainer.get(name)}
|
||||||
</div>
|
</div>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -475,7 +483,7 @@ export default {
|
|||||||
<div class="lemon-container__displayname">
|
<div class="lemon-container__displayname">
|
||||||
{curact.displayName}
|
{curact.displayName}
|
||||||
</div>,
|
</div>,
|
||||||
curact
|
curact,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div class="lemon-vessel">
|
<div class="lemon-vessel">
|
||||||
@@ -499,19 +507,15 @@ export default {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="lemon-vessel__right">
|
<div class="lemon-vessel__right">
|
||||||
{useScopedSlot(
|
{useScopedSlot(this.$scopedSlots["message-side"], null, curact)}
|
||||||
this.$scopedSlots["message-side"],
|
|
||||||
null,
|
|
||||||
curact
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>,
|
||||||
);
|
);
|
||||||
nodes.push(
|
nodes.push(
|
||||||
<div class={cls} v-show={!curact.id && this.currentIsDefSidebar}>
|
<div class={cls} v-show={!curact.id && this.currentIsDefSidebar}>
|
||||||
{this.$slots.cover}
|
{this.$slots.cover}
|
||||||
</div>
|
</div>,
|
||||||
);
|
);
|
||||||
nodes.push(
|
nodes.push(
|
||||||
<div
|
<div
|
||||||
@@ -528,7 +532,7 @@ export default {
|
|||||||
if (isEmpty(curact.lastContent)) {
|
if (isEmpty(curact.lastContent)) {
|
||||||
this.updateContact({
|
this.updateContact({
|
||||||
id: curact.id,
|
id: curact.id,
|
||||||
lastContent: " "
|
lastContent: " ",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
this.changeContact(curact.id, DEFAULT_MENU_LASTMESSAGES);
|
this.changeContact(curact.id, DEFAULT_MENU_LASTMESSAGES);
|
||||||
@@ -537,9 +541,9 @@ export default {
|
|||||||
发送消息
|
发送消息
|
||||||
</lemon-button>
|
</lemon-button>
|
||||||
</div>,
|
</div>,
|
||||||
curact
|
curact,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>,
|
||||||
);
|
);
|
||||||
return nodes;
|
return nodes;
|
||||||
},
|
},
|
||||||
@@ -549,14 +553,14 @@ export default {
|
|||||||
_addContact(data, t) {
|
_addContact(data, t) {
|
||||||
const type = {
|
const type = {
|
||||||
0: "unshift",
|
0: "unshift",
|
||||||
1: "push"
|
1: "push",
|
||||||
}[t];
|
}[t];
|
||||||
this.contacts[type](data);
|
this.contacts[type](data);
|
||||||
},
|
},
|
||||||
_addMessage(data, contactId, t) {
|
_addMessage(data, contactId, t) {
|
||||||
const type = {
|
const type = {
|
||||||
0: "unshift",
|
0: "unshift",
|
||||||
1: "push"
|
1: "push",
|
||||||
}[t];
|
}[t];
|
||||||
if (!Array.isArray(data)) data = [data];
|
if (!Array.isArray(data)) data = [data];
|
||||||
allMessages[contactId] = allMessages[contactId] || [];
|
allMessages[contactId] = allMessages[contactId] || [];
|
||||||
@@ -573,7 +577,9 @@ export default {
|
|||||||
lastContentRender(message) {
|
lastContentRender(message) {
|
||||||
if (!isFunction(lastContentRender[message.type])) {
|
if (!isFunction(lastContentRender[message.type])) {
|
||||||
console.error(
|
console.error(
|
||||||
`not found '${message.type}' of the latest message renderer,try to use ‘setLastContentRender()’`
|
`not found '${
|
||||||
|
message.type
|
||||||
|
}' of the latest message renderer,try to use ‘setLastContentRender()’`,
|
||||||
);
|
);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -615,13 +621,13 @@ export default {
|
|||||||
if (isEmpty(contact)) return false;
|
if (isEmpty(contact)) return false;
|
||||||
this.CacheDraft.set(contactId, {
|
this.CacheDraft.set(contactId, {
|
||||||
editorValue: editorValue,
|
editorValue: editorValue,
|
||||||
lastContent: contact.lastContent
|
lastContent: contact.lastContent,
|
||||||
});
|
});
|
||||||
this.updateContact({
|
this.updateContact({
|
||||||
id: contactId,
|
id: contactId,
|
||||||
lastContent: `<span style="color:red;">[草稿]</span><span>${this.lastContentRender(
|
lastContent: `<span style="color:red;">[草稿]</span><span>${this.lastContentRender(
|
||||||
{ type: "text", content: editorValue }
|
{ type: "text", content: editorValue },
|
||||||
)}</span>`
|
)}</span>`,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
@@ -632,7 +638,7 @@ export default {
|
|||||||
if (draft) {
|
if (draft) {
|
||||||
this.updateContact({
|
this.updateContact({
|
||||||
id: contactId,
|
id: contactId,
|
||||||
lastContent: draft.lastContent
|
lastContent: draft.lastContent,
|
||||||
});
|
});
|
||||||
this.CacheDraft.remove(contactId);
|
this.CacheDraft.remove(contactId);
|
||||||
}
|
}
|
||||||
@@ -696,7 +702,7 @@ export default {
|
|||||||
const message = this.findMessage(messageId);
|
const message = this.findMessage(messageId);
|
||||||
if (!message) return false;
|
if (!message) return false;
|
||||||
const index = allMessages[message.toContactId].findIndex(
|
const index = allMessages[message.toContactId].findIndex(
|
||||||
({ id }) => id == messageId
|
({ id }) => id == messageId,
|
||||||
);
|
);
|
||||||
allMessages[message.toContactId].splice(index, 1);
|
allMessages[message.toContactId].splice(index, 1);
|
||||||
return true;
|
return true;
|
||||||
@@ -711,7 +717,7 @@ export default {
|
|||||||
let historyMessage = this.findMessage(message.id);
|
let historyMessage = this.findMessage(message.id);
|
||||||
if (!historyMessage) return false;
|
if (!historyMessage) return false;
|
||||||
historyMessage = Object.assign(historyMessage, message, {
|
historyMessage = Object.assign(historyMessage, message, {
|
||||||
toContactId: historyMessage.toContactId
|
toContactId: historyMessage.toContactId,
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -726,7 +732,7 @@ export default {
|
|||||||
const components = this.$refs.messages.$refs.message;
|
const components = this.$refs.messages.$refs.message;
|
||||||
if (components) {
|
if (components) {
|
||||||
const messageComponent = components.find(
|
const messageComponent = components.find(
|
||||||
com => com.$attrs.message.id == messageId
|
com => com.$attrs.message.id == messageId,
|
||||||
);
|
);
|
||||||
if (messageComponent) messageComponent.$forceUpdate();
|
if (messageComponent) messageComponent.$forceUpdate();
|
||||||
}
|
}
|
||||||
@@ -782,7 +788,7 @@ export default {
|
|||||||
render: menu => {
|
render: menu => {
|
||||||
return <i class="lemon-icon-message" />;
|
return <i class="lemon-icon-message" />;
|
||||||
},
|
},
|
||||||
isBottom: false
|
isBottom: false,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: DEFAULT_MENU_CONTACTS,
|
name: DEFAULT_MENU_CONTACTS,
|
||||||
@@ -792,14 +798,14 @@ export default {
|
|||||||
render: menu => {
|
render: menu => {
|
||||||
return <i class="lemon-icon-addressbook" />;
|
return <i class="lemon-icon-addressbook" />;
|
||||||
},
|
},
|
||||||
isBottom: false
|
isBottom: false,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
let menus = [];
|
let menus = [];
|
||||||
if (Array.isArray(data)) {
|
if (Array.isArray(data)) {
|
||||||
const indexMap = {
|
const indexMap = {
|
||||||
messages: 0,
|
messages: 0,
|
||||||
contacts: 1
|
contacts: 1,
|
||||||
};
|
};
|
||||||
const indexKeys = Object.keys(indexMap);
|
const indexKeys = Object.keys(indexMap);
|
||||||
menus = data.map(item => {
|
menus = data.map(item => {
|
||||||
@@ -807,7 +813,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
...defaultMenus[indexMap[item.name]],
|
...defaultMenus[indexMap[item.name]],
|
||||||
...item,
|
...item,
|
||||||
...{ renderContainer: null }
|
...{ renderContainer: null },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -815,7 +821,7 @@ export default {
|
|||||||
this._customContainerReady(
|
this._customContainerReady(
|
||||||
item.renderContainer,
|
item.renderContainer,
|
||||||
this.CacheMenuContainer,
|
this.CacheMenuContainer,
|
||||||
item.name
|
item.name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -859,10 +865,10 @@ export default {
|
|||||||
index: "",
|
index: "",
|
||||||
unread: 0,
|
unread: 0,
|
||||||
lastSendTime: "",
|
lastSendTime: "",
|
||||||
lastContent: ""
|
lastContent: "",
|
||||||
},
|
},
|
||||||
contact
|
contact,
|
||||||
)
|
),
|
||||||
);
|
);
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
@@ -893,7 +899,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.$set(this.contacts, index, {
|
this.$set(this.contacts, index, {
|
||||||
...this.contacts[index],
|
...this.contacts[index],
|
||||||
...data
|
...data,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -1000,8 +1006,8 @@ export default {
|
|||||||
},
|
},
|
||||||
closeDrawer() {
|
closeDrawer() {
|
||||||
this.drawerVisible = false;
|
this.drawerVisible = false;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="stylus">
|
<style lang="stylus">
|
||||||
@@ -1093,7 +1099,7 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
|||||||
height 100%
|
height 100%
|
||||||
flex 1
|
flex 1
|
||||||
+e(right)
|
+e(right)
|
||||||
flex 0
|
flex none
|
||||||
+b(lemon-messages)
|
+b(lemon-messages)
|
||||||
flex 1
|
flex 1
|
||||||
height auto
|
height auto
|
||||||
@@ -1102,7 +1108,6 @@ bezier = cubic-bezier(0.645, 0.045, 0.355, 1)
|
|||||||
top 0
|
top 0
|
||||||
overflow hidden
|
overflow hidden
|
||||||
background #f6f6f6
|
background #f6f6f6
|
||||||
transition width .4s bezier
|
|
||||||
z-index 11
|
z-index 11
|
||||||
display none
|
display none
|
||||||
+b(lemon-wrapper)
|
+b(lemon-wrapper)
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ export default {
|
|||||||
from: "IMUI",
|
from: "IMUI",
|
||||||
default() {
|
default() {
|
||||||
return this;
|
return this;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
contextmenu: Array,
|
contextmenu: Array,
|
||||||
@@ -16,21 +16,22 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => {
|
default: () => {
|
||||||
return {};
|
return {};
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
timeFormat: {
|
timeFormat: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default: () => ""
|
default: () => "",
|
||||||
},
|
},
|
||||||
reverse: Boolean,
|
reverse: Boolean,
|
||||||
hideName: Boolean,
|
hideName: Boolean,
|
||||||
hideTime: Boolean
|
hideTime: Boolean,
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const { fromUser, status, sendTime } = this.message;
|
const { fromUser, status, sendTime } = this.message;
|
||||||
|
const hideTitle = this.hideName == true && this.hideTime == true;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
@@ -38,8 +39,8 @@ export default {
|
|||||||
`lemon-message--status-${status}`,
|
`lemon-message--status-${status}`,
|
||||||
{
|
{
|
||||||
"lemon-message--reverse": this.reverse,
|
"lemon-message--reverse": this.reverse,
|
||||||
"lemon-message--hide-name": this.hideName
|
"lemon-message--hide-title": hideTitle,
|
||||||
}
|
},
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<div class="lemon-message__avatar">
|
<div class="lemon-message__avatar">
|
||||||
@@ -54,6 +55,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
<div class="lemon-message__inner">
|
<div class="lemon-message__inner">
|
||||||
<div class="lemon-message__title">
|
<div class="lemon-message__title">
|
||||||
|
{this.hideName == false && (
|
||||||
<span
|
<span
|
||||||
on-click={e => {
|
on-click={e => {
|
||||||
this._emitClick(e, "displayName");
|
this._emitClick(e, "displayName");
|
||||||
@@ -61,7 +63,8 @@ export default {
|
|||||||
>
|
>
|
||||||
{fromUser.displayName}
|
{fromUser.displayName}
|
||||||
</span>
|
</span>
|
||||||
{this.hideTime == true && (
|
)}
|
||||||
|
{this.hideTime == false && (
|
||||||
<span
|
<span
|
||||||
class="lemon-message__time"
|
class="lemon-message__time"
|
||||||
on-click={e => {
|
on-click={e => {
|
||||||
@@ -86,7 +89,7 @@ export default {
|
|||||||
{useScopedSlot(
|
{useScopedSlot(
|
||||||
this.IMUI.$scopedSlots["message-after"],
|
this.IMUI.$scopedSlots["message-after"],
|
||||||
null,
|
null,
|
||||||
this.message
|
this.message,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
@@ -101,7 +104,7 @@ export default {
|
|||||||
title="重发消息"
|
title="重发消息"
|
||||||
style={{
|
style={{
|
||||||
color: "#ff2525",
|
color: "#ff2525",
|
||||||
cursor: "pointer"
|
cursor: "pointer",
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
@@ -117,8 +120,8 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
_emitClick(e, key) {
|
_emitClick(e, key) {
|
||||||
this.IMUI.$emit("message-click", e, key, this.message, this.IMUI);
|
this.IMUI.$emit("message-click", e, key, this.message, this.IMUI);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="stylus">
|
<style lang="stylus">
|
||||||
@@ -223,12 +226,12 @@ arrow()
|
|||||||
+e(avatar)
|
+e(avatar)
|
||||||
padding-right 0
|
padding-right 0
|
||||||
padding-left 10px
|
padding-left 10px
|
||||||
+m(hide-name)
|
+m(hide-title)
|
||||||
+e(status)
|
+e(status)
|
||||||
top 3px
|
top 5px
|
||||||
+e(title)
|
|
||||||
display none
|
|
||||||
+e(content)
|
+e(content)
|
||||||
|
position relative
|
||||||
|
top -5px
|
||||||
&:before
|
&:before
|
||||||
top 14px
|
top 14px
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -9,26 +9,26 @@ export default {
|
|||||||
hideName: Boolean,
|
hideName: Boolean,
|
||||||
//是否隐藏显示消息时间
|
//是否隐藏显示消息时间
|
||||||
hideTime: Boolean,
|
hideTime: Boolean,
|
||||||
reverseUserId: String,
|
reverseUserId: [String, Number],
|
||||||
timeRange: {
|
timeRange: {
|
||||||
type: Number,
|
type: Number,
|
||||||
default: 1
|
default: 1,
|
||||||
},
|
},
|
||||||
timeFormat: {
|
timeFormat: {
|
||||||
type: Function,
|
type: Function,
|
||||||
default(val) {
|
default(val) {
|
||||||
return hoursTimeFormat(val);
|
return hoursTimeFormat(val);
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
messages: {
|
messages: {
|
||||||
type: Array,
|
type: Array,
|
||||||
default: () => []
|
default: () => [],
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
_loading: false,
|
_loading: false,
|
||||||
_loadend: false
|
_loadend: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
@@ -37,7 +37,7 @@ export default {
|
|||||||
<div
|
<div
|
||||||
class={[
|
class={[
|
||||||
"lemon-messages__load",
|
"lemon-messages__load",
|
||||||
`lemon-messages__load--${this._loadend ? "end" : "ing"}`
|
`lemon-messages__load--${this._loadend ? "end" : "ing"}`,
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
{this._loadend ? this._renderLoadEnd() : this._renderLoading()}
|
{this._loadend ? this._renderLoadEnd() : this._renderLoading()}
|
||||||
@@ -57,10 +57,10 @@ export default {
|
|||||||
message: {
|
message: {
|
||||||
id: "__time__",
|
id: "__time__",
|
||||||
type: "event",
|
type: "event",
|
||||||
content: hoursTimeFormat(message.sendTime)
|
content: hoursTimeFormat(message.sendTime),
|
||||||
}
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ export default {
|
|||||||
message: message,
|
message: message,
|
||||||
reverse: this.reverseUserId == message.fromUser.id,
|
reverse: this.reverseUserId == message.fromUser.id,
|
||||||
hideTime: this.hideTime,
|
hideTime: this.hideTime,
|
||||||
hideName: this.hideName
|
hideName: this.hideName,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
node.push(<tagName ref="message" refInFor={true} attrs={attrs} />);
|
node.push(<tagName ref="message" refInFor={true} attrs={attrs} />);
|
||||||
@@ -85,7 +85,7 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
msecRange() {
|
msecRange() {
|
||||||
return this.timeRange * 1000 * 60;
|
return this.timeRange * 1000 * 60;
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
watch: {},
|
watch: {},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -129,10 +129,10 @@ export default {
|
|||||||
if (wrap) {
|
if (wrap) {
|
||||||
wrap.scrollTop = wrap.scrollHeight;
|
wrap.scrollTop = wrap.scrollHeight;
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
created() {},
|
created() {},
|
||||||
mounted() {}
|
mounted() {},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
<style lang="stylus">
|
<style lang="stylus">
|
||||||
|
|||||||
@@ -15,8 +15,11 @@ document.addEventListener("click", e => {
|
|||||||
export default {
|
export default {
|
||||||
hide: hidePopover,
|
hide: hidePopover,
|
||||||
bind(el, binding, vnode) {
|
bind(el, binding, vnode) {
|
||||||
el.addEventListener("contextmenu", e => {
|
el.addEventListener(
|
||||||
|
binding.modifiers.click ? "click" : "contextmenu",
|
||||||
|
e => {
|
||||||
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
if (isEmpty(binding.value) || !Array.isArray(binding.value)) return;
|
||||||
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
LemonPopover.methods.closeAll();
|
LemonPopover.methods.closeAll();
|
||||||
let component;
|
let component;
|
||||||
@@ -42,7 +45,11 @@ export default {
|
|||||||
const icon = item.icon
|
const icon = item.icon
|
||||||
? `<i class="lemon-contextmenu__icon ${item.icon}"></i>`
|
? `<i class="lemon-contextmenu__icon ${item.icon}"></i>`
|
||||||
: "";
|
: "";
|
||||||
return `<div style="color:${item.color}" title="${item.text}" class="lemon-contextmenu__item">${icon}<span>${item.text}</span></div>`;
|
return `<div style="color:${item.color}" title="${
|
||||||
|
item.text
|
||||||
|
}" class="lemon-contextmenu__item">${icon}<span>${
|
||||||
|
item.text
|
||||||
|
}</span></div>`;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
})
|
})
|
||||||
@@ -61,14 +68,16 @@ export default {
|
|||||||
const ins = Vue.extend({
|
const ins = Vue.extend({
|
||||||
render: h => {
|
render: h => {
|
||||||
return render(h, component, hidePopover);
|
return render(h, component, hidePopover);
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
const renderComponent = new ins().$mount();
|
const renderComponent = new ins().$mount();
|
||||||
node.querySelector("span").innerHTML = renderComponent.$el.outerHTML;
|
node.querySelector("span").innerHTML =
|
||||||
|
renderComponent.$el.outerHTML;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
showPopover();
|
showPopover();
|
||||||
});
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
module.exports = {
|
||||||
|
printWidth: 80, // 每行代码长度(默认80)
|
||||||
|
tabWidth: 2, // 每个tab相当于多少个空格(默认2)
|
||||||
|
useTabs: false, // 是否使用tab进行缩进(默认false)
|
||||||
|
singleQuote: false, // 使用单引号(默认false)
|
||||||
|
semi: true, // 声明结尾使用分号(默认true)
|
||||||
|
trailingComma: 'all', // 多行使用拖尾逗号(默认none)
|
||||||
|
bracketSpacing: true, // 对象字面量的大括号间使用空格(默认true)
|
||||||
|
jsxBracketSameLine: false, // 多行JSX中的>放置在最后一行的结尾,而不是另起一行(默认false)
|
||||||
|
arrowParens: 'avoid', // 只有一个参数的箭头函数的参数是否带圆括号(默认avoid)
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user