qq.vue 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459
  1. <template>
  2. <div style="width: 100%;height: 100%">
  3. <!-- <el-tabs class="im-tabs" type="card" v-model="appKey" @tab-click="qwUserChange">
  4. <el-tab-pane
  5. v-for="item in qwUserList"
  6. :key="item.id"
  7. :name="item.appKey">
  8. <span slot="label">
  9. <el-badge :value="getUnreadCount(item.appKey)"
  10. :max="99"
  11. v-if="getUnreadCount(item.appKey) > 0">
  12. {{ item.qwUserName }}
  13. </el-badge>
  14. <template v-else>
  15. {{ item.qwUserName }}
  16. </template>
  17. </span>
  18. </el-tab-pane>
  19. </el-tabs> -->
  20. <!-- <div class="close-box">
  21. <i class="el-icon-close" @click="handleClose" style="font-size: 22px;margin-right: 8px;cursor: pointer;"/>
  22. </div> -->
  23. <div class="imui-center qq-lemon-imui" v-show="showQW">
  24. <lemon-imui class="lemon-slot"
  25. :width="isMaximized ? '100vw' : '100%'"
  26. :height="isMaximized ? '90vh' : windowHeight"
  27. :user="userData"
  28. ref="IMUI"
  29. :contact-contextmenu="contactContextmenu"
  30. :theme="theme"
  31. :hide-menu="hideMenu"
  32. :hide-menu-avatar="hideMenuAvatar"
  33. :hide-message-name="hideMessageName"
  34. :hide-message-time="hideMessageTime"
  35. :messageTimeFormat="messageTimeFormat"
  36. @change-menu="handleChangeMenu"
  37. @pull-messages="handlePullMessages"
  38. @change-contact="handleChangeContact"
  39. @change-conversation="handleChangeConversation"
  40. @message-click="handleMessageClick"
  41. @menu-avatar-click="handleMenuAvatarClick"
  42. @pick-image="handleImageClick"
  43. @send="handleSend">
  44. <template #menu-top>
  45. <div class="qiwei">
  46. <div v-for="item in qwUserList" :key="item.id" @click="qwUserChange(item)" :class="appId==item.id?'q-item active':'q-item'">
  47. <el-badge :value="getUnreadCount(item.appKey)"
  48. :max="99"
  49. :hidden="getUnreadCount(item.appKey) < 1">
  50. <el-avatar shape="square" :src="item.avatar"></el-avatar>
  51. <el-popover
  52. popper-class="popover"
  53. placement="right"
  54. :title="'姓名:'+item.qwUserName"
  55. trigger="hover"
  56. :content="'所属公司:'+item.corpName">
  57. <div slot="reference">
  58. <div class="name" >{{item.qwUserName}}</div>
  59. <div class="text" >{{item.corpName}}</div>
  60. </div>
  61. </el-popover>
  62. </el-badge>
  63. </div>
  64. </div>
  65. </template>
  66. <template #sidebar-message-top>
  67. <div style="padding: 12px; display: flex; align-items: center;">
  68. <el-input
  69. v-model="searchKeyword"
  70. prefix-icon="el-icon-search"
  71. placeholder="搜索"
  72. size="small"
  73. clearable
  74. @input="handleSearch"
  75. style="flex: 1;height: 32px;margin-right: 8px;"
  76. class="top-input"
  77. />
  78. <el-popover
  79. placement="bottom-end"
  80. width="200"
  81. v-model="filterPopoverVisible"
  82. trigger="click"
  83. >
  84. <!-- 这里放你的过滤选项内容 -->
  85. <div>
  86. <el-checkbox-group v-model="selectedFilters">
  87. <el-checkbox label="1">去掉重粉</el-checkbox>
  88. <el-checkbox label="2">去掉黑粉</el-checkbox>
  89. <!-- <el-checkbox label="3">按催课排序</el-checkbox> -->
  90. </el-checkbox-group>
  91. <div style="margin-top: 10px; text-align: right;">
  92. <el-button size="mini" type="primary" @click="applyFilter">确定</el-button>
  93. </div>
  94. </div>
  95. <el-button
  96. slot="reference"
  97. icon="el-icon-setting"
  98. style="padding: 8px;height: 32px;border: none;background: #F1F4F8;width:32px;"
  99. size="medium"
  100. :type="selectedFilters.length > 0 ? 'primary' : 'default'"
  101. ></el-button>
  102. </el-popover>
  103. </div>
  104. </template>
  105. <template #sidebar-contact-top>
  106. <!-- 联系人顶部 -->
  107. </template>
  108. <template #group-top>
  109. <div class="group-item" @click="toggleGroup" style="padding-top: 14px;">
  110. <div class="left">
  111. <i class="el-icon-arrow-right" :class="{ 'rotate': openGroup }"></i>
  112. <div class="name">群聊</div>
  113. </div>
  114. <div class="num">{{qwGroupNum}}</div>
  115. </div>
  116. </template>
  117. <template #contact-top>
  118. <div class="group-item" @click="toggleContact">
  119. <div class="left">
  120. <i class="el-icon-arrow-right" :class="{ 'rotate': openContact }"></i>
  121. <div class="name">联系人</div>
  122. </div>
  123. <div class="num">{{qwContactNum}}</div>
  124. </div>
  125. </template>
  126. <template #message-title="contact">
  127. <div class="user-name">
  128. {{contact.displayName}}
  129. </div>
  130. <!-- <div @click="openDrawer('right')" style="position: absolute;right: 14px;top: 10px;">-->
  131. <!-- <i class="el-icon-more" style="cursor: pointer"/>-->
  132. <!-- </div>-->
  133. <!-- <div>-->
  134. <!-- <el-button-->
  135. <!-- type="primary"-->
  136. <!-- size="small"-->
  137. <!-- style="position: absolute;right: 14px;top: 10px;z-index: 1000"-->
  138. <!-- @click="showDetail(contact.extId)"-->
  139. <!-- >详情</el-button>-->
  140. <!-- </div>-->
  141. </template>
  142. <template #message-extend="contact">
  143. <div class="close-box">
  144. <i class="el-icon-close" @click="handleClose" style="font-size: 22px;cursor: pointer;"/>
  145. </div>
  146. <div v-if="contact.extId" style="width:100%;overflow: auto">
  147. <userDetail :ext-id="contact.extId" :conversation-id="contact.conversationId" :extend="true" ref="userDetail" />
  148. </div>
  149. <!-- 课程管理 -->
  150. <div v-if="showCourseManage">
  151. <course-manage :conversationId="contact.conversationId" :extend="true"/>
  152. </div>
  153. </template>
  154. </lemon-imui>
  155. </div>
  156. <el-dialog :visible.sync="dialogVisible" append-to-body width="35%">
  157. <img style="width:100%;height:auto" :src="dialogImageUrl" alt="" />
  158. </el-dialog>
  159. <el-dialog :visible.sync="dialogVideoVisible"
  160. :close-on-click-modal="false"
  161. :destroy-on-close="true"
  162. :width="aplayer.pWidth"
  163. :height="aplayer.height"
  164. @close="dialogVideoVisible=false"
  165. ref="player">
  166. <videoPlayer :width="aplayer.width" :height="aplayer.height" :videoWidth="aplayer.videoWidth" :videoHeight="aplayer.videoHeight" :vid="aplayer.vid" :autoplay="true"
  167. :source="dialogVideoUrl" :cover="dialogVideoCover" ref="player"></videoPlayer>
  168. </el-dialog>
  169. <!-- 用户详情 -->
  170. <el-drawer
  171. append-to-body
  172. :with-header="false"
  173. size="35%"
  174. :destroy-on-close="true"
  175. :title="detail.title" :visible.sync="detail.open">
  176. <userDetail ref="userDetail" />
  177. </el-drawer>
  178. </div>
  179. </template>
  180. <script>
  181. import {getConversations,getMessageList,getConversation,sendMsg,getQwUserList,getContactList,getGroupList,getConversationId} from '@/api/qw/im';
  182. import Conversations from "@/components/LemonUI/database/conversations";
  183. import EmojiData from "@/components/LemonUI/database/emoji";
  184. import '@/components/LemonUI/index.css';
  185. import VideoPlayer from '@/components/VideoPlayer/VueAliplayer.vue'
  186. import UserDetail from "@/views/qw/qwChat/userDetail/index.vue";
  187. import courseManage from "@/views/qw/qwChat/userDetail/courseManage.vue";
  188. import {ImSocket} from "@/utils/ImSocket";
  189. import {getToken} from '@/utils/auth'
  190. import {uploadOss} from "@/api/common";
  191. import {mapState} from "vuex";
  192. import {generateUUID} from "@/components/LemonUI/utils";
  193. import {getTime} from "@/utils";
  194. import notificationMp3 from '@/assets/voice/new-notification.mp3'
  195. export default {
  196. name: "qqChat",
  197. components: {
  198. VideoPlayer,
  199. UserDetail,
  200. courseManage
  201. },
  202. props: {
  203. showQw: Boolean,
  204. isMaximized: Boolean
  205. },
  206. data() {
  207. return {
  208. activeNames: ['0'],
  209. openContact:false,
  210. openGroup:false,
  211. contactName:'',
  212. appKey:null,
  213. appId:null,
  214. qwUserId:null,
  215. qwUserList:[],
  216. theme: "default",
  217. IMUI:null,
  218. contactContextmenu: [],
  219. hideMenuAvatar: false,
  220. hideMenu: false,
  221. hideMessageName: false,
  222. hideMessageTime: true,
  223. qwUser:{},
  224. showQW:false,
  225. userData: {},
  226. contactData:null,
  227. conversationData:Conversations,
  228. dialogImageUrl: '',
  229. dialogVisible: false,
  230. dialogVideoVisible:false,
  231. dialogVideoUrl:'',
  232. dialogVideoCover:'',
  233. imageArr:[],
  234. pickUploadImgData:null,
  235. aplayer: {
  236. vid: "bf9b7e4a36d84aea8cee769765fbc28b",
  237. pWidth:"1040px",
  238. width:"1000px",
  239. height:"900px",
  240. videoWidth:"1000px",
  241. videoHeight:"900px"
  242. },
  243. player: null,
  244. roomMembers:[],
  245. roomAdmins:[],
  246. roomInfo:null,
  247. windowWidth: document.documentElement.clientWidth * 0.9, //实时屏幕宽度
  248. windowHeight: document.documentElement.clientHeight * 0.85, //实时屏幕高度
  249. queryParams: {
  250. pageNum: 1,
  251. pageSize: 10,
  252. conversationId: null,
  253. userId:null
  254. },
  255. pageParams: {
  256. pageNum: 1,
  257. pageSize: 500
  258. },
  259. detail: {
  260. title: '',
  261. open: false
  262. },
  263. imSocket: null,
  264. imUrl: process.env.VUE_APP_IM_WS_URL,
  265. searchKeyword: '',
  266. filterPopoverVisible: false,
  267. selectedFilters: [],
  268. // 存储每个企微账号的会话记录和状态
  269. qwUserSessions: {},
  270. // 存储每个企微账号的分页信息
  271. qwUserPages: {},
  272. // 销售ID,用于WebSocket连接
  273. companyUserId: null,
  274. // 存储每个企微账号的未读消息数
  275. qwUserUnreadCount: [],
  276. //联系人列表
  277. qwContactList:[],
  278. qwContactNum:0,
  279. //群聊列表
  280. qwGroupList:[],
  281. qwGroupNum:0,
  282. //课程列表
  283. showCourseManage:false
  284. };
  285. },
  286. created(){
  287. // 初始化企微账号会话页码对象
  288. this.qwUserPages = {};
  289. //获取企微列表
  290. getQwUserList().then(response => {
  291. this.qwUserList = response.data;
  292. if (this.qwUserList.length>0){
  293. this.qwUser = this.qwUserList[0];
  294. this.appKey = this.qwUser.appKey;
  295. this.appId=this.qwUser.id;
  296. this.companyUserId = this.qwUser.companyUserId;
  297. this.setQwUserInfo();
  298. this.getConversation();
  299. // 初始化单个WebSocket连接
  300. this.initImSocket();
  301. // 初始化未读消息数
  302. this.initUnreadCount();
  303. //群聊
  304. this.initGroup(this.qwUser.id)
  305. //this.toggleContact();
  306. //联系人
  307. // this.initContact(this.qwUser.id)
  308. }else {
  309. this.qwUser={};
  310. }
  311. });
  312. console.log(this.contact,'---')
  313. },
  314. computed: {
  315. ...mapState('qwIm', ['shareCourse']),
  316. // 计算所有企微账号的未读消息总数
  317. totalUnreadCount() {
  318. return this.qwUserUnreadCount.reduce((sum, item) => sum + item.unreadCount, 0);
  319. },
  320. },
  321. watch: {
  322. showQw(nv, ov) {
  323. if (nv) {
  324. this.clearUnreadCount(this.appKey)
  325. this.$nextTick(() => {
  326. this.$refs.IMUI.messageViewToBottom();
  327. });
  328. }
  329. },
  330. shareCourse(nv) {
  331. if (nv) { // 发送小程序卡片消息
  332. const IMUI = this.$refs.IMUI;
  333. const contact = IMUI.currentContact;
  334. if (!contact) {
  335. return;
  336. }
  337. // 创建消息对象
  338. let message = {
  339. type: 'miniprogram',
  340. title: nv.title,
  341. image: nv.thumbnail,
  342. content: nv.url,
  343. toContactId: contact.conversationId,
  344. };
  345. this.detail.open = false
  346. this.$store.dispatch('qwIm/shareCourse', null)
  347. // 使用handleSend方法发送消息
  348. this.handleSend(
  349. message,
  350. (replaceMessage = { status: "succeed" }) => {
  351. IMUI.updateMessage(Object.assign(message, replaceMessage));
  352. },
  353. null
  354. );
  355. }
  356. },
  357. // 监听未读消息数变化
  358. qwUserUnreadCount: {
  359. handler() {
  360. this.$store.dispatch('qwIm/totalUnreadCount', this.totalUnreadCount)
  361. },
  362. deep: true // 深度监听对象内部变化
  363. }
  364. },
  365. mounted() {
  366. this.showQW=true;
  367. const IMUI = this.$refs.IMUI;
  368. const conversationData = Conversations.filter(item => item.conversationId <= 1);
  369. conversationData.sort((a1, a2) => {
  370. return a2.lastSendTime - a1.lastSendTime;
  371. });
  372. IMUI.initMenus([
  373. {
  374. name: "messages",
  375. },
  376. {
  377. name:'contacts'
  378. }
  379. ]);
  380. IMUI.initEmoji(EmojiData);
  381. IMUI.initEditorTools([
  382. { name: "emoji" },
  383. { name: "uploadImage" }
  384. ])
  385. },
  386. beforeDestroy() {
  387. // 关闭WebSocket连接
  388. if (this.imSocket) {
  389. this.imSocket.close();
  390. this.imSocket = null;
  391. }
  392. this.clearSessionCache()
  393. },
  394. methods: {
  395. getUnreadCount(appKey) {
  396. const index = this.qwUserUnreadCount.findIndex(entry => entry.appKey === appKey);
  397. return index !== -1 ? this.qwUserUnreadCount[index].unreadCount : 0;
  398. },
  399. // 清除会话缓存
  400. clearSessionCache() {
  401. this.qwUserSessions = {};
  402. this.qwUserPages = {};
  403. },
  404. // 初始化WebSocket连接
  405. initImSocket() {
  406. // 如果已经有连接,先关闭
  407. if (this.imSocket) {
  408. this.imSocket.close();
  409. }
  410. // 创建新的WebSocket连接,使用公司ID
  411. this.imSocket = new ImSocket(`${this.imUrl}/${this.companyUserId}?token=${getToken()}`);
  412. // 处理接收到的消息
  413. this.imSocket.onMessage(data => {
  414. const { IMUI } = this.$refs;
  415. try {
  416. let message = JSON.parse(data);
  417. this.appendRemoteMessage(message);
  418. // 播放声音 暂时不播放声音
  419. // const audio = new Audio(notificationMp3);
  420. // audio.play().catch(err => {
  421. // console.warn("播放声音失败", err);
  422. // });
  423. // 确定消息所属的企微账号
  424. const messageAppKey = message.appKey;
  425. // 检查消息是否属于当前企微账号
  426. if (messageAppKey === this.appKey) {
  427. if (!this.showQw) {
  428. this.incrementUnreadCount(messageAppKey);
  429. }
  430. let conversation = IMUI.findConversation(message.toContactId);
  431. if (conversation && Object.keys(conversation).length !==0) {
  432. conversation.lastSendTime = message.sendTime;
  433. conversation.lastContent = IMUI.lastContentRender(message);
  434. IMUI.topPopConversations(conversation);
  435. // 更新缓存中的会话记录
  436. this.updateSessionConversation(conversation);
  437. } else {
  438. // 如果找不到会话,可能需要刷新会话列表
  439. this.refreshSession(messageAppKey);
  440. }
  441. } else if (messageAppKey) {
  442. // 如果不是当前账号的消息,增加对应账号的未读消息数
  443. this.incrementUnreadCount(messageAppKey);
  444. if (this.qwUserSessions[messageAppKey]) {
  445. const index = this.qwUserSessions[messageAppKey].findIndex(
  446. item => item.conversationId === message.toContactId
  447. );
  448. if (index === -1) {
  449. this.refreshSession(messageAppKey, false)
  450. }
  451. if (index !== -1) {
  452. let conversation = this.qwUserSessions[messageAppKey][index]
  453. conversation.lastSendTime = message.sendTime;
  454. conversation.lastContent = IMUI.lastContentRender(message);
  455. conversation.unread = conversation.unread + 1;
  456. this.qwUserSessions[messageAppKey][index] = {...conversation};
  457. }
  458. }
  459. }
  460. } catch (error) {
  461. console.error("处理WebSocket消息时出错:", error);
  462. }
  463. });
  464. },
  465. // 初始化未读消息数
  466. initUnreadCount() {
  467. // 为每个企微账号初始化未读消息数为0
  468. this.qwUserUnreadCount = []; // 先清空
  469. this.qwUserList.forEach(user => {
  470. this.qwUserUnreadCount.push({
  471. appKey: user.appKey,
  472. qwUserId: user.qwUserId,
  473. unreadCount: 0
  474. });
  475. });
  476. },
  477. // 增加指定企微账号的未读消息数
  478. incrementUnreadCount(appKey) {
  479. if (!appKey) {
  480. console.error("incrementUnreadCount: appKey不能为空");
  481. return;
  482. }
  483. // 查找对应的企微账号记录
  484. const index = this.qwUserUnreadCount.findIndex(item => item.appKey === appKey);
  485. if (index !== -1) {
  486. // 如果找到,则增加未读消息数
  487. const newCount = this.qwUserUnreadCount[index].unreadCount + 1;
  488. this.$set(this.qwUserUnreadCount[index], 'unreadCount', newCount);
  489. } else {
  490. // 如果没找到,则添加新记录
  491. const user = this.qwUserList.find(u => u.appKey === appKey);
  492. if (user) {
  493. this.qwUserUnreadCount.push({
  494. appKey: appKey,
  495. qwUserId: user.qwUserId,
  496. unreadCount: 1
  497. });
  498. }
  499. }
  500. },
  501. // 清除指定企微账号的未读消息数
  502. clearUnreadCount(appKey) {
  503. // 查找对应的企微账号记录
  504. const index = this.qwUserUnreadCount.findIndex(item => item.appKey === appKey);
  505. if (index !== -1) {
  506. // 如果找到,则清除未读消息数
  507. this.$set(this.qwUserUnreadCount[index], 'unreadCount', 0);
  508. }
  509. },
  510. // 切换企微账号
  511. qwUserChange(tab){
  512. this.appKey = tab.appKey;
  513. this.appId = tab.id;
  514. let index= this.qwUserList.findIndex(item => item.appKey === tab.appKey);
  515. this.qwUser=this.qwUserList[index];
  516. // 清除当前账号的未读消息数
  517. this.clearUnreadCount(this.appKey);
  518. // 不需要重新创建WebSocket连接,只需更新当前账号信息
  519. this.setQwUserInfo();
  520. this.getConversation(); //获取会话信息
  521. this.initGroup(this.qwUser.id)
  522. },
  523. //联系人列表
  524. initContact(id){
  525. getContactList(id).then(response => {
  526. this.qwContactList=response.rows;
  527. this.qwContactNum=response.total
  528. const mergedList = [...this.qwGroupList, ...this.qwContactList];
  529. this.$refs.IMUI.initContacts(mergedList);
  530. // this.getConversationId(id)
  531. });
  532. },
  533. //群聊列表
  534. initGroup(id){
  535. getGroupList(id).then(response => {
  536. this.qwGroupList=response.rows
  537. this.qwGroupNum = response.total
  538. this.initContact(id)
  539. //this.$refs.IMUI.initContacts(this.qwContactList);
  540. });
  541. },
  542. // 切换分组展开/收起状态
  543. toggleGroup() {
  544. this.openGroup = !this.openGroup;
  545. this.$refs.IMUI.changeOpenGroup(this.openGroup);
  546. },
  547. // 切换分组展开/收起状态
  548. toggleContact() {
  549. this.openContact = !this.openContact;
  550. this.$refs.IMUI.changeOpenContact(this.openContact);
  551. },
  552. handleOpenGroup(val){
  553. // console.log(val,'val')
  554. },
  555. handleChange(val) {
  556. this.activeNames=val
  557. },
  558. setQwUserInfo(){
  559. this.userData.id=this.qwUser.id;
  560. this.userData.displayName=this.qwUser.qwUserName;
  561. this.userData.avatar=this.qwUser.avatar;
  562. },
  563. getConversation(){
  564. const IMUI = this.$refs.IMUI;
  565. // 检查是否已有该企微账号的会话记录缓存
  566. if (this.qwUserSessions[this.appKey]) {
  567. // 如果有,直接使用缓存的会话记录
  568. this.conversationData = this.qwUserSessions[this.appKey];
  569. IMUI.initConversations(this.conversationData);
  570. // 恢复上次选中的会话
  571. const lastSelectedConversation = this.qwUserSessions[`${this.appKey}_selected`];
  572. if (lastSelectedConversation) {
  573. IMUI.changeContact(lastSelectedConversation);
  574. } else {
  575. // 如果没有上次选中的会话,选择第一个会话
  576. const fstConversation = this.conversationData[0];
  577. if(fstConversation) {
  578. IMUI.changeContact(fstConversation.conversationId);
  579. }
  580. }
  581. } else {
  582. // 如果没有缓存,则从服务器获取会话记录
  583. getConversations(this.qwUser.id,this.pageParams).then(response => {
  584. this.conversationData = response.data.list;
  585. // 缓存会话记录
  586. this.qwUserSessions[this.appKey] = response.data.list;
  587. IMUI.initConversations(response.data.list);
  588. const fstConversation = this.conversationData[0];
  589. if(fstConversation) {
  590. IMUI.changeContact(fstConversation.conversationId);
  591. }
  592. });
  593. }
  594. },
  595. messageTimeFormat(time) {
  596. return this.friendlyDate(time);
  597. },
  598. openDrawer(position) {
  599. const IMUI = this.$refs.IMUI;
  600. const params = {
  601. width: '30%',
  602. position,
  603. render: contact => {
  604. return (
  605. <div style="padding:15px">
  606. <h5>{contact.displayName}</h5>
  607. </div>
  608. );
  609. },
  610. };
  611. IMUI.changeDrawer(params);
  612. },
  613. handlePullMessages(contact, next,instance) {
  614. const { IMUI } = this.$refs;
  615. let isEnd = false;
  616. getMessageList(this.queryParams).then(response => {
  617. if(response.code==200){
  618. isEnd=response.data.isLastPage;
  619. console.log(isEnd,'isEnd')
  620. next(response.data.list, isEnd);
  621. if(!isEnd){
  622. this.qwUserPages[contact.conversationId]++;
  623. this.queryParams.pageNum=this.qwUserPages[contact.conversationId];
  624. this.queryParams.userId = this.qwUser.id
  625. }
  626. }
  627. });
  628. },
  629. handleChangeConversation(conversation, instance) {
  630. console.log(conversation,'conversation')
  631. this.showCourseManage=false
  632. if(conversation.isGroup){
  633. // this.contact.extId=conversation.extId
  634. this.showCourseManage=conversation.isGroup
  635. }
  636. // 保存当前选中的会话ID
  637. this.qwUserSessions[`${this.appKey}_selected`] = conversation.conversationId;
  638. // 检查是否已有该会话的分页信息
  639. if (!this.qwUserPages[conversation.conversationId]){
  640. this.qwUserPages[conversation.conversationId] =1;
  641. }
  642. this.queryParams.pageNum=this.qwUserPages[conversation.conversationId];
  643. this.queryParams.conversationId=conversation.conversationId;
  644. this.queryParams.userId = this.qwUser.id
  645. if(conversation.unread>0){
  646. conversation.unread=0;
  647. instance.updateContact(conversation);
  648. // 更新缓存中的会话记录
  649. this.updateSessionConversation(conversation);
  650. }
  651. },
  652. // 更新缓存中的会话记录
  653. updateSessionConversation(conversation) {
  654. if (this.qwUserSessions[this.appKey]) {
  655. const index = this.qwUserSessions[this.appKey].findIndex(
  656. item => item.conversationId === conversation.conversationId
  657. );
  658. if (index !== -1) {
  659. this.qwUserSessions[this.appKey][index] = {...conversation};
  660. }
  661. }
  662. },
  663. handleChangeContact(contact) {
  664. const IMUI = this.$refs.IMUI;
  665. console.log(contact,'contact')
  666. if(contact.conversationId==null){
  667. const data={
  668. id:contact.id,
  669. isGroup:contact.isGroup,
  670. qwUserId:this.qwUser.id,
  671. }
  672. getConversationId(data).then(response => {
  673. IMUI.appendConversation(response.data)
  674. IMUI.changeContact(contact.conversationId);
  675. IMUI.currentNewContactId=contact.id;
  676. });
  677. }
  678. },
  679. //收到消息后添加消息显示
  680. appendMessageAction(msgData){
  681. if(msgData.type=="text" || msgData.type=="image" || msgData.type=="voice"){ //文本 text image video voice
  682. const message = {
  683. id: msgData.id,
  684. status: msgData.status,
  685. type: msgData.type,
  686. sendTime: msgData.sendTime,
  687. content: msgData.content,
  688. params1: "1",
  689. params2: "2",
  690. toContactId: msgData.toContactId,
  691. fromUser: msgData.fromUser,
  692. };
  693. this.appendRemoteMessage(message);
  694. }
  695. else if(msgData.type=="file"){
  696. const message = {
  697. id: msgData.id,
  698. status: msgData.status,
  699. type: msgData.type,
  700. sendTime: msgData.sendTime,
  701. content: msgData.content,
  702. toContactId: msgData.toContactId,
  703. fromUser: msgData.fromUser,
  704. fileName:msgData.fileName,
  705. fileSize:msgData.fileSize
  706. };
  707. this.appendRemoteMessage(message);
  708. }
  709. else{
  710. const message = {
  711. id: msgData.id,
  712. status: msgData.status,
  713. type: msgData.type,
  714. sendTime: msgData.sendTime,
  715. content: msgData.content,
  716. toContactId: msgData.toContactId,
  717. fromUser: msgData.fromUser,
  718. };
  719. this.appendRemoteMessage(message);
  720. }
  721. },
  722. //发送消息
  723. handleSend(message, next, file) {
  724. const IMUI = this.$refs.IMUI;
  725. let params = {};
  726. if(message.type === "text"){ //text image voice video
  727. params = {"sessionId":message.toContactId,"appKey":this.qwUser.appKey,"content":message.content, "msgType": 1};
  728. sendMsg(params).then(response => {
  729. const {code, data} = response
  730. if(code === 200){
  731. this.appendRemoteMessage(data)
  732. let conversation = IMUI.findConversation(message.toContactId);
  733. conversation.lastSendTime = message.sendTime;
  734. conversation.lastContent = IMUI.lastContentRender(message)
  735. IMUI.topPopConversations(conversation);
  736. // 更新缓存中的会话记录
  737. this.updateSessionConversation(conversation);
  738. next();
  739. } else {
  740. next({status:'failed'})
  741. }
  742. });
  743. }
  744. // image
  745. else if(message.type === "image"){
  746. const formData = new FormData();
  747. formData.append("file", file);
  748. uploadOss(formData).then(response => {
  749. const {code, url} = response
  750. if (code === 200) {
  751. params = {"sessionId":message.toContactId,"appKey":this.qwUser.appKey,"content":url, "msgType": 2};
  752. sendMsg(params).then(response => {
  753. const {code} = response
  754. if(code === 200){
  755. let conversation = IMUI.findConversation(message.toContactId);
  756. conversation.lastSendTime = message.sendTime;
  757. conversation.lastContent = IMUI.lastContentRender(message)
  758. IMUI.topPopConversations(conversation);
  759. // 更新缓存中的会话记录
  760. this.updateSessionConversation(conversation);
  761. next();
  762. } else {
  763. next({status:'failed'})
  764. }
  765. });
  766. }
  767. })
  768. }
  769. // 小程序
  770. else if(message.type === "miniprogram"){
  771. // 小程序消息参数
  772. params = {
  773. "sessionId": message.toContactId,
  774. "appKey": this.qwUser.appKey,
  775. "title": message.title,
  776. "image": message.image,
  777. "content": message.content,
  778. "msgType": 5 // 小程序消息类型
  779. };
  780. sendMsg(params).then(response => {
  781. const {code, data} = response
  782. if(code === 200){
  783. this.appendRemoteMessage(data)
  784. let conversation = IMUI.findConversation(message.toContactId);
  785. conversation.lastSendTime = message.sendTime;
  786. conversation.lastContent = IMUI.lastContentRender(message)
  787. IMUI.topPopConversations(conversation);
  788. // 更新缓存中的会话记录
  789. this.updateSessionConversation(conversation);
  790. }
  791. });
  792. }
  793. // file
  794. else if(message.type === "file"){
  795. console.log("Event:file-click", message, next, file)
  796. }
  797. },
  798. handleMenuAvatarClick() {
  799. console.log("Event:menu-avatar-click");
  800. },
  801. //聊天工具栏点击图片
  802. handleImageClick() {
  803. // this.$refs.material.openMaterial(this.qwUser.deviceId);
  804. console.log("Event:handleImageClick");
  805. },
  806. //选择图片框确定按钮回调
  807. handlePickImageDone(data){
  808. console.log("handlePickImageDone:"+JSON.stringify(data));
  809. this.pickUploadImgData=data;
  810. const IMUI = this.$refs.IMUI;
  811. IMUI._handleRemoteImage(data.url);
  812. },
  813. tooglePlayVideo(data){
  814. this.dialogVideoVisible=true;
  815. this.dialogVideoUrl=data.content;
  816. this.dialogVideoCover=data.url;
  817. const player = this.$refs.player.instance
  818. player && player.play()
  819. },
  820. handleMessageClick(e, key, message, instance) {
  821. if (key === 'avatar') {
  822. this.qwUser.id !== message.fromUser.id && this.showDetail(message.extId)
  823. return
  824. }
  825. if(message.type=="image"){
  826. var url=!!message.url?message.url:message.content;
  827. this.handlePicturePreview(url);
  828. }
  829. else if(message.type=="video"){
  830. this.tooglePlayVideo(message);
  831. }
  832. else if(message.type=="file"){
  833. }
  834. if (key == "status") {
  835. instance.updateMessage({
  836. id: message.id,
  837. status: "going",
  838. content: "正在重新发送消息...",
  839. });
  840. setTimeout(() => {
  841. instance.updateMessage({
  842. id: message.id,
  843. status: "succeed",
  844. content: "发送成功",
  845. });
  846. }, 2000);
  847. }
  848. },
  849. changeMenuAvatarVisible() {
  850. this.hideMenuAvatar = !this.hideMenuAvatar;
  851. },
  852. changeMenuVisible() {
  853. this.hideMenu = !this.hideMenu;
  854. },
  855. changeMessageNameVisible() {
  856. this.hideMessageName = !this.hideMessageName;
  857. },
  858. changeMessageTimeVisible() {
  859. this.hideMessageTime = !this.hideMessageTime;
  860. },
  861. removeMessage() {
  862. const { IMUI } = this.$refs;
  863. const messages = IMUI.getCurrentMessages();
  864. const id = messages[messages.length - 1].id;
  865. if (messages.length > 0) {
  866. IMUI.removeMessage(id);
  867. }
  868. },
  869. updateMessage() {
  870. const { IMUI } = this.$refs;
  871. const messages = IMUI.getCurrentMessages();
  872. const message = messages[messages.length - 1];
  873. if (messages.length > 0) {
  874. const update = {
  875. id: message.id,
  876. status: "succeed",
  877. type: "file",
  878. fileName: "被修改成文件了.txt",
  879. fileSize: "4200000",
  880. };
  881. if (message.type == "event") {
  882. update.fromUser = this.user;
  883. }
  884. IMUI.updateMessage(update);
  885. IMUI.messageViewToBottom();
  886. }
  887. },
  888. appendCustomMessage() {
  889. const { IMUI } = this.$refs;
  890. const message = {
  891. id: generateUUID(),
  892. status: "succeed",
  893. type: "voice",
  894. sendTime: getTime(),
  895. content: "语音消息",
  896. params1: "1",
  897. params2: "2",
  898. toContactId: "contact-1",
  899. fromUser: this.user,
  900. };
  901. IMUI.appendMessage(message, true);
  902. },
  903. appendMessage() {
  904. const { IMUI } = this.$refs;
  905. const contact = IMUI.currentContact;
  906. const message = generateMessage("contact-3");
  907. message.fromUser = {
  908. ...message.fromUser,
  909. ...this.user,
  910. };
  911. IMUI.appendMessage(message, true);
  912. console.log("🚀 ~ file: App.vue ~ line 1508 ~ appendMessage ~ message", message)
  913. },
  914. appendRemoteMessage(message) { //从服务端返回的消息
  915. const { IMUI } = this.$refs;
  916. if (!IMUI) {
  917. console.error("IMUI引用不存在,无法添加消息");
  918. return;
  919. }
  920. try {
  921. // 确保消息对象包含必要的字段
  922. if (!message.id) {
  923. message.id = generateUUID(); // 使用UUID生成唯一ID
  924. }
  925. if (!message.status) {
  926. message.status = "succeed";
  927. }
  928. if (!message.sendTime) {
  929. message.sendTime = new Date().getTime();
  930. }
  931. // 根据消息类型处理
  932. switch (message.type) {
  933. case "text":
  934. // 文本消息不需要特殊处理
  935. break;
  936. case "image":
  937. // 确保图片消息有content或url字段
  938. if (!message.content && message.url) {
  939. message.content = message.url;
  940. }
  941. break;
  942. case "voice":
  943. // 确保语音消息有content字段
  944. if (!message.content) {
  945. message.content = "语音消息";
  946. }
  947. // 添加语音时长
  948. if (message.duration) {
  949. message.params1 = message.duration.toString();
  950. }
  951. break;
  952. case "file":
  953. // 确保文件消息有fileName和fileSize字段
  954. if (!message.fileName) {
  955. message.fileName = "未命名文件";
  956. }
  957. if (!message.fileSize && message.fileSize !== 0) {
  958. message.fileSize = 0;
  959. }
  960. break;
  961. case "miniprogram":
  962. // 小程序消息处理
  963. if (!message.content) {
  964. message.content = "小程序卡片";
  965. }
  966. break;
  967. default:
  968. console.warn("未知消息类型:", message.type);
  969. break;
  970. }
  971. // 添加消息到UI
  972. IMUI.appendMessage(message, true);
  973. // 更新缓存中的会话记录
  974. if (message.toContactId && IMUI.conversations) {
  975. const conversation = IMUI.findConversation(message.toContactId);
  976. if (conversation) {
  977. this.updateSessionConversation(conversation);
  978. }
  979. }
  980. } catch (error) {
  981. console.error("添加远程消息时出错:", error);
  982. }
  983. },
  984. handleChangeMenu() {
  985. console.log("Event:change-menu");
  986. },
  987. handlePicturePreview(url) {
  988. this.dialogImageUrl = url;
  989. this.dialogVisible = true;
  990. },
  991. // 详情
  992. showDetail(extId) {
  993. this.detail.open = true
  994. setTimeout(() => {
  995. this.$refs.userDetail.getDetail(extId);
  996. }, 1);
  997. },
  998. // 搜索
  999. handleSearch() {
  1000. const keyword = this.searchKeyword.trim().toLowerCase();
  1001. if (!keyword && !this.selectedFilters) {
  1002. // 为空时显示全部
  1003. this.$refs.IMUI.initConversations(this.conversationData);
  1004. return;
  1005. }
  1006. const notRepeat = this.selectedFilters.some(item => item === '1')
  1007. const notBlack = this.selectedFilters.some(item => item === '2')
  1008. // 过滤会话列表
  1009. const filtered = this.conversationData.filter(item => {
  1010. // 搜索最后一条消息内容和联系人名
  1011. return (
  1012. (item.lastContent && item.lastContent.toLowerCase().includes(keyword)) ||
  1013. (item.displayName && item.displayName.toLowerCase().includes(keyword))
  1014. )
  1015. && (notRepeat ? !item.isRepeat : true)
  1016. && (notBlack ? !item.isBlack : true);
  1017. });
  1018. this.$refs.IMUI.initConversations(filtered);
  1019. },
  1020. applyFilter() {
  1021. this.filterPopoverVisible = false;
  1022. this.handleSearch();
  1023. },
  1024. // 刷新企微账号会话列表
  1025. refreshSession(appKey, isCurrent = true) {
  1026. // 删除当前企微账号的会话缓存
  1027. delete this.qwUserSessions[appKey];
  1028. delete this.qwUserSessions[`${appKey}_selected`];
  1029. // 重新获取会话列表
  1030. getConversations(this.qwUser.id,this.pageParams).then(response => {
  1031. this.conversationData = response.data.list;
  1032. // 缓存会话记录
  1033. this.qwUserSessions[appKey] = response.data.list;
  1034. if (isCurrent) {
  1035. this.$refs.IMUI.initConversations(response.data.list);
  1036. const fstConversation = this.conversationData[0];
  1037. if(fstConversation) {
  1038. this.$refs.IMUI.changeContact(fstConversation.conversationId);
  1039. }
  1040. }
  1041. });
  1042. },
  1043. handleClose() {
  1044. this.$emit('close')
  1045. }
  1046. },
  1047. };
  1048. </script>
  1049. <style lang="scss" scoped>
  1050. .close-box{
  1051. width: 100%;
  1052. height: 52px;
  1053. padding: 12px;
  1054. background: #FFFFFF;
  1055. // border-bottom: 1px solid #EDEFF2;
  1056. display: flex;
  1057. align-items: center;
  1058. justify-content: right;
  1059. }
  1060. .qiwei{
  1061. width: 90px;
  1062. padding: 10px;
  1063. height: 100%;
  1064. display: flex;
  1065. flex-direction: column;
  1066. align-items:center;
  1067. position: relative;
  1068. background: #409EFF;
  1069. overflow-y: auto;
  1070. scrollbar-width: none; /* Firefox */
  1071. -ms-overflow-style: none; /* IE 和 Edge */
  1072. position:relative;
  1073. &::-webkit-scrollbar {
  1074. display: none; /* 隐藏滚动条 */
  1075. }
  1076. .q-item{
  1077. width: 72px;
  1078. padding: 12px;
  1079. display: flex;
  1080. flex-direction: column;
  1081. align-items: center;
  1082. justify-content: center;
  1083. transition: border-radius 0.2s ease, background 0.2s ease; /* 只过渡需要变化的属性 */
  1084. border-radius: 0 6px 6px 0;
  1085. .el-avatar{
  1086. width: 36px;
  1087. height: 36px;
  1088. border-radius: 4px 4px 4px 4px;
  1089. }
  1090. .name{
  1091. margin-top: 10px;
  1092. font-weight: 500;
  1093. font-size: 14px;
  1094. width: 72px;
  1095. padding: 0 2px;
  1096. white-space: nowrap; /* 强制文本不换行 */
  1097. overflow: hidden; /* 超出部分隐藏 */
  1098. text-overflow: ellipsis; /* 超出部分显示省略号 */
  1099. color: #fff;
  1100. text-align: center;
  1101. }
  1102. .text{
  1103. margin-top: 2px;
  1104. font-weight: 500;
  1105. font-size: 14px;
  1106. width: 72px;
  1107. padding: 0 2px;
  1108. white-space: nowrap; /* 强制文本不换行 */
  1109. overflow: hidden; /* 超出部分隐藏 */
  1110. text-overflow: ellipsis; /* 超出部分显示省略号 */
  1111. color: #fff;
  1112. text-align: center;
  1113. }
  1114. &.active{
  1115. background: #F1F4F8;
  1116. border-radius: 6px;
  1117. //border-radius: 6px 0px 0px 6px;
  1118. position: relative; /* 确保z-index生效 */
  1119. z-index: 1; /* 高于相邻元素的默认层级 */
  1120. .name{
  1121. color: #202124;
  1122. }
  1123. .text{
  1124. color: #202124;
  1125. }
  1126. // &:before{
  1127. // content: '';
  1128. // position: absolute;
  1129. // z-index: 0;
  1130. // right: 0;
  1131. // width: 10px;
  1132. // height: auto;
  1133. // background: #F1F4F8;
  1134. // }
  1135. }
  1136. }
  1137. /* 下一个元素:仅保留右上圆角,清除默认的右下圆角 */
  1138. // .q-item.active + .q-item {
  1139. // border-top-right-radius: 6px;
  1140. // border-bottom-right-radius: 0; /* 避免与选中元素底部衔接处的多余圆角 */
  1141. // }
  1142. // /* 上一个元素:仅保留右下圆角,清除默认的右上圆角 */
  1143. // .q-item + .q-item.active {
  1144. // border-bottom-right-radius: 6px;
  1145. // border-top-right-radius: 0; /* 避免与选中元素顶部衔接处的多余圆角 */
  1146. // }
  1147. }
  1148. .group-item{
  1149. padding-left: 12px;
  1150. padding-right: 12px;
  1151. width: 100%;
  1152. height: 45px;
  1153. line-height: 45px;
  1154. // padding-bottom: 12px;
  1155. display: flex;
  1156. justify-content: space-between;
  1157. align-items: center;
  1158. position: sticky;
  1159. position: -webkit-sticky;
  1160. top: 0px;
  1161. z-index: 9;
  1162. background-color: #fff;
  1163. /* 箭头旋转动画 */
  1164. .el-icon-arrow-right {
  1165. transition: transform 0.3s ease;
  1166. margin-right: 5px;
  1167. }
  1168. .el-icon-arrow-right.rotate {
  1169. transform: rotate(90deg); /* 展开时箭头向右旋转90度(指向下方) */
  1170. }
  1171. .left{
  1172. display: flex;
  1173. align-items: center;
  1174. font-weight: 400;
  1175. font-size: 14px;
  1176. color: #141F36;
  1177. }
  1178. .num{
  1179. font-weight: 400;
  1180. font-size: 12px;
  1181. color: #84868C;
  1182. }
  1183. }
  1184. .user-name{
  1185. font-weight: 500;
  1186. font-size: 18px;
  1187. color: #202124;
  1188. }
  1189. .imui-center{
  1190. align-items: center;
  1191. justify-content: center;
  1192. }
  1193. .lemon-drawer{
  1194. border:1px solid #ddd;
  1195. border-left:0;
  1196. }
  1197. .more {
  1198. font-size: 12px;
  1199. line-height: 24px;
  1200. height: 24px;
  1201. position: absolute;
  1202. top: 14px;
  1203. right: 14px;
  1204. cursor: pointer;
  1205. -webkit-user-select: none;
  1206. -moz-user-select: none;
  1207. -ms-user-select: none;
  1208. user-select: none;
  1209. color: #f1f1f1;
  1210. display: inline-block;
  1211. border-radius: 4px;
  1212. background: #111;
  1213. padding: 0 8px;
  1214. }
  1215. /deep/.el-dialog__headerbtn{
  1216. top:10px;
  1217. }
  1218. ::v-deep .im-tabs {
  1219. width: 97%;
  1220. .el-tabs__header {
  1221. margin: 0 !important;
  1222. .el-tabs__item {
  1223. border-bottom: 0 !important;
  1224. }
  1225. }
  1226. /* 未读消息徽标样式 */
  1227. .el-badge__content {
  1228. border: none;
  1229. font-size: 12px;
  1230. font-weight: bold;
  1231. background-color: #F56C6C;
  1232. transform: translateY(-2px);
  1233. right: unset
  1234. }
  1235. }
  1236. </style>
  1237. <style lang="stylus">
  1238. // .el-popover{
  1239. // color: #409EFF !important;
  1240. // }
  1241. .q-item{
  1242. .el-badge{
  1243. display: flex;
  1244. flex-direction: column;
  1245. align-items: center;
  1246. }
  1247. .el-badge__content {
  1248. background-color:#FC4B0E !important;
  1249. border: none !important;;
  1250. }
  1251. }
  1252. .lemon-container__title{
  1253. padding:12px !important;
  1254. background: #fff !important;
  1255. }
  1256. .lemon-menu{
  1257. width: 150px !important;
  1258. flex-direction: row !important;
  1259. background: #F1F4F8 !important;
  1260. .lemon-avatar{
  1261. width: 36px !important;
  1262. height: 36px !important;
  1263. line-height:36px !important;
  1264. margin-bottom: 0 !important
  1265. }
  1266. }
  1267. .lemon-menu-right{
  1268. width:60px;
  1269. height: 100%;
  1270. display: flex;
  1271. flex-direction: column;
  1272. align-items: center;
  1273. padding: 12px;
  1274. .lemon-menu__item{
  1275. padding:0 !important;
  1276. margin-top: 12px;
  1277. color:#666 !important;
  1278. }
  1279. .lemon-menu__item--active{
  1280. color:#409EFF !important;
  1281. }
  1282. }
  1283. .lemon-container{
  1284. border-left: 1px solid #EDEFF2;
  1285. }
  1286. .lemon-editor__tool{
  1287. box-shadow: none !important;
  1288. border-top: 1px solid #EDEFF2;
  1289. }
  1290. .lemon-editor__tool-item{
  1291. padding: 0px 10px 0 0 !important;
  1292. }
  1293. .lemon-container:empty {
  1294. display: none;
  1295. }
  1296. .lemon-container div{
  1297. scrollbar-width: none; /* Firefox */
  1298. -ms-overflow-style: none; /* IE 和 Edge */
  1299. }
  1300. /* Chrome、Safari 和 Opera */
  1301. .lemon-container div::-webkit-scrollbar {
  1302. display: none;
  1303. }
  1304. .lemon-menu{
  1305. padding: 0!important;
  1306. // background-color:#409EFF !important;
  1307. }
  1308. .lemon-message-event__content{
  1309. background: #F1F4F8 !important;
  1310. color:#84868C !important;
  1311. }
  1312. .lemon-sidebar{
  1313. width:228px !important;
  1314. background: #fff !important;
  1315. }
  1316. .lemon-sidebar div::-webkit-scrollbar {
  1317. display: none;
  1318. }
  1319. .lemon-contact{
  1320. background: #fff !important;
  1321. }
  1322. .lemon-contact--active{
  1323. background: #E9F1FE !important;
  1324. }
  1325. .lemon-editor{
  1326. background: #fff !important;
  1327. }
  1328. .lemon-button--color-default{
  1329. color: #fff !important;
  1330. background: #409EFF !important;
  1331. }
  1332. .top-input .el-input__inner{
  1333. border: none !important;
  1334. background-color: #F1F4F8 !important;
  1335. }
  1336. .slot-group{
  1337. width:200px;
  1338. }
  1339. .slot-group-title{
  1340. padding:0 0 10px 0;
  1341. }
  1342. .slot-group-notice{
  1343. padding: 10px 10px;
  1344. }
  1345. .slot-search{
  1346. width:calc(100% - 20px) ;
  1347. margin:5px 10px;
  1348. padding:3px 0px;
  1349. }
  1350. .slot-group-member{
  1351. display: flex;
  1352. padding: 5px 0;
  1353. flex:1;
  1354. font-size: 14px;
  1355. align-items: center;
  1356. }
  1357. .avatar{
  1358. width: 30px;
  1359. height: 30px;
  1360. line-height: 30px;
  1361. margin-right:5px;
  1362. }
  1363. .img{
  1364. vertical-align: middle;
  1365. border-style: none;
  1366. width: 100%;
  1367. height: 100%;
  1368. line-height: 30px;
  1369. border-radius: 50%;
  1370. }
  1371. </style>