chat-box.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776
  1. <template>
  2. <view class="page chat-box">
  3. <view class="header">
  4. <uni-icons class="btn-side left" type="back" size="30" @click="onNavBack()"></uni-icons>
  5. <text class="title">{{title}}</text>
  6. <uni-icons class="btn-side right" type="more-filled" size="30" @click="onShowMore()"></uni-icons>
  7. </view>
  8. <view class="chat-msg" @click="switchChatTabBox('none',true)">
  9. <scroll-view class="scroll-box" scroll-y="true" @scrolltoupper="onScrollToTop"
  10. :scroll-into-view="'chat-item-'+scrollMsgIdx">
  11. <view v-for="(msgInfo,idx) in chat.messages" :key="idx">
  12. <chat-message-item v-if="idx>=showMinIdx" :headImage="headImage(msgInfo)"
  13. :showName="showName(msgInfo)" @recall="onRecallMessage" @delete="onDeleteMessage"
  14. @longPressHead="onLongPressHead(msgInfo)" @download="onDownloadFile" :id="'chat-item-'+idx"
  15. :msgInfo="msgInfo" :groupMembers="groupMembers">
  16. </chat-message-item>
  17. </view>
  18. </scroll-view>
  19. </view>
  20. <view v-if="atUserIds.length>0" class="chat-at-bar" @click="openAtBox()">
  21. <view class="iconfont icon-at">:&nbsp;</view>
  22. <scroll-view v-if="atUserIds.length>0" class="chat-at-scroll-box" scroll-x="true" scroll-left="120">
  23. <view class="chat-at-items">
  24. <view v-for="m in atUserItems" class="chat-at-item">
  25. <head-image :name="m.aliasName" :url="m.headImage" :size="50"></head-image>
  26. </view>
  27. </view>
  28. </scroll-view>
  29. </view>
  30. <view class="send-bar">
  31. <view class="send-text">
  32. <textarea class="send-text-area" v-model="sendText" auto-height :show-confirm-bar="false"
  33. :placeholder="isReceipt?'[回执消息]':''"
  34. :adjust-position="false" @confirm="sendTextMessage()" @keyboardheightchange="onKeyboardheightchange"
  35. @input="onTextInput" confirm-type="send" confirm-hold :hold-keyboard="true"></textarea>
  36. </view>
  37. <view v-if="chat.type=='GROUP'" class="iconfont icon-at" @click="openAtBox()"></view>
  38. <view class="iconfont icon-icon_emoji" @click="switchChatTabBox('emo',true)"></view>
  39. <view v-if="sendText==''" class="iconfont icon-add" @click="switchChatTabBox('tools',true)">
  40. </view>
  41. <button v-if="sendText!=''||atUserIds.length>0" class="btn-send" type="primary"
  42. @touchend.prevent="sendTextMessage()" size="mini">发送</button>
  43. </view>
  44. <view class="chat-tab-bar" v-show="chatTabBox!='none' ||showKeyBoard " :style="{height:`${keyboardHeight}px`}">
  45. <view v-if="chatTabBox == 'tools'" class="chat-tools">
  46. <view class="chat-tools-item">
  47. <image-upload :maxCount="9" sourceType="album" :onBefore="onUploadImageBefore"
  48. :onSuccess="onUploadImageSuccess" :onError="onUploadImageFail">
  49. <view class="tool-icon iconfont icon-picture"></view>
  50. </image-upload>
  51. <view class="tool-name">相册</view>
  52. </view>
  53. <view class="chat-tools-item">
  54. <image-upload sourceType="camera" :onBefore="onUploadImageBefore" :onSuccess="onUploadImageSuccess"
  55. :onError="onUploadImageFail">
  56. <view class="tool-icon iconfont icon-camera"></view>
  57. </image-upload>
  58. <view class="tool-name">拍摄</view>
  59. </view>
  60. <!-- #ifndef APP-PLUS -->
  61. <!-- APP 暂时不支持选择文件 -->
  62. <view class="chat-tools-item">
  63. <file-upload :onBefore="onUploadFileBefore" :onSuccess="onUploadFileSuccess"
  64. :onError="onUploadFileFail">
  65. <view class="tool-icon iconfont icon-folder"></view>
  66. </file-upload>
  67. <view class="tool-name">文件</view>
  68. </view>
  69. <!-- #endif -->
  70. <view class="chat-tools-item" @click="showTip()">
  71. <view class="tool-icon iconfont icon-microphone"></view>
  72. <view class="tool-name">语音输入</view>
  73. </view>
  74. <view v-if="chat.type == 'GROUP'" class="chat-tools-item" @click="switchReceipt()">
  75. <view class="tool-icon iconfont icon-receipt" :class="isReceipt?'active':''"></view>
  76. <view class="tool-name">回执消息</view>
  77. </view>
  78. <view class="chat-tools-item" @click="showTip()">
  79. <view class="tool-icon iconfont icon-call"></view>
  80. <view class="tool-name">呼叫</view>
  81. </view>
  82. </view>
  83. <scroll-view v-if="chatTabBox==='emo'" class="chat-emotion" scroll-y="true">
  84. <view class="emotion-item-list">
  85. <image class="emotion-item" :title="emoText" :src="$emo.textToPath(emoText)"
  86. v-for="(emoText, i) in $emo.emoTextList" :key="i" @click="selectEmoji(emoText)" mode="aspectFit"
  87. lazy-load="true"></image>
  88. </view>
  89. </scroll-view>
  90. <view v-if="showKeyBoard"></view>
  91. </view>
  92. <chat-at-box ref="atBox" :ownerId="group.ownerId" :members="groupMembers"
  93. @complete="onAtComplete"></chat-at-box>
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. chat: {},
  101. friend: {},
  102. group: {},
  103. groupMembers: [],
  104. sendText: "",
  105. isReceipt: false, // 是否回执消息
  106. showVoice: false, // 是否显示语音录制弹窗
  107. scrollMsgIdx: 0, // 滚动条定位为到哪条消息
  108. chatTabBox: 'none',
  109. showKeyBoard: false,
  110. keyboardHeight: 322,
  111. atUserIds: [],
  112. showMinIdx: 0 // 下标小于showMinIdx的消息不显示,否则可能很卡
  113. }
  114. },
  115. methods: {
  116. showTip() {
  117. uni.showToast({
  118. title: "暂未支持...",
  119. icon: "none"
  120. })
  121. },
  122. moveChatToTop(){
  123. let chatIdx = this.$store.getters.findChatIdx(this.chat);
  124. this.$store.commit("moveTop",chatIdx);
  125. },
  126. switchReceipt(){
  127. this.isReceipt = !this.isReceipt;
  128. },
  129. openAtBox() {
  130. this.$refs.atBox.init(this.atUserIds);
  131. this.$refs.atBox.open();
  132. },
  133. onAtComplete(atUserIds) {
  134. this.atUserIds = atUserIds;
  135. },
  136. onLongPressHead(msgInfo) {
  137. if (!msgInfo.selfSend && this.chat.type == "GROUP" && this.atUserIds.indexOf(msgInfo.sendId) < 0) {
  138. this.atUserIds.push(msgInfo.sendId);
  139. }
  140. },
  141. headImage(msgInfo) {
  142. if (this.chat.type == 'GROUP') {
  143. let member = this.groupMembers.find((m) => m.userId == msgInfo.sendId);
  144. return member ? member.headImage : "";
  145. } else {
  146. return msgInfo.selfSend ? this.mine.headImageThumb : this.chat.headImage
  147. }
  148. },
  149. showName(msgInfo) {
  150. if (this.chat.type == 'GROUP') {
  151. let member = this.groupMembers.find((m) => m.userId == msgInfo.sendId);
  152. return member ? member.aliasName : "";
  153. } else {
  154. return msgInfo.selfSend ? this.mine.nickName : this.chat.showName
  155. }
  156. },
  157. sendTextMessage() {
  158. if (!this.sendText.trim() && this.atUserIds.length == 0) {
  159. return uni.showToast({
  160. title: "不能发送空白信息",
  161. icon: "none"
  162. });
  163. }
  164. let receiptText = this.isReceipt? "【回执消息】":"";
  165. let atText = this.createAtText();
  166. let msgInfo = {
  167. content: receiptText + this.sendText + atText,
  168. atUserIds: this.atUserIds,
  169. receipt : this.isReceipt,
  170. type: 0
  171. }
  172. // 填充对方id
  173. this.fillTargetId(msgInfo, this.chat.targetId);
  174. this.sendText = "";
  175. this.$http({
  176. url: this.messageAction,
  177. method: 'POST',
  178. data: msgInfo
  179. }).then((id) => {
  180. msgInfo.id = id;
  181. msgInfo.sendTime = new Date().getTime();
  182. msgInfo.sendId = this.$store.state.userStore.userInfo.id;
  183. msgInfo.selfSend = true;
  184. msgInfo.readedCount = 0,
  185. msgInfo.status = this.$enums.MESSAGE_STATUS.UNSEND;
  186. this.$store.commit("insertMessage", msgInfo);
  187. // 会话置顶
  188. this.moveChatToTop();
  189. this.sendText = "";
  190. }).finally(() => {
  191. // 滚动到底部
  192. this.scrollToBottom();
  193. // 清空@用户列表
  194. this.atUserIds = [];
  195. this.isReceipt = false;
  196. });
  197. },
  198. createAtText() {
  199. let atText = "";
  200. this.atUserIds.forEach((id) => {
  201. if (id == -1) {
  202. atText += ` @全体成员`;
  203. } else {
  204. let member = this.groupMembers.find((m) => m.userId == id);
  205. if (member) {
  206. atText += ` @${member.aliasName}`;
  207. }
  208. }
  209. })
  210. return atText;
  211. },
  212. fillTargetId(msgInfo, targetId) {
  213. if (this.chat.type == "GROUP") {
  214. msgInfo.groupId = targetId;
  215. } else {
  216. msgInfo.recvId = targetId;
  217. }
  218. },
  219. scrollToBottom() {
  220. let size = this.chat.messages.length;
  221. if (size > 0) {
  222. this.scrollToMsgIdx(size - 1);
  223. }
  224. },
  225. scrollToMsgIdx(idx) {
  226. // 如果scrollMsgIdx值没变化,滚动条不会移动
  227. if (idx == this.scrollMsgIdx && idx > 0) {
  228. this.$nextTick(() => {
  229. // 先滚动到上一条
  230. this.scrollMsgIdx = idx - 1;
  231. // 再滚动目标位置
  232. this.scrollToMsgIdx(idx);
  233. });
  234. return;
  235. }
  236. this.$nextTick(() => {
  237. this.scrollMsgIdx = idx;
  238. });
  239. },
  240. switchChatTabBox(chatTabBox, hideKeyBoard) {
  241. this.chatTabBox = chatTabBox;
  242. if (hideKeyBoard) {
  243. uni.hideKeyboard();
  244. }
  245. },
  246. selectEmoji(emoText) {
  247. this.sendText += `#${emoText};`;
  248. },
  249. onNavBack() {
  250. uni.switchTab({
  251. url: "/pages/chat/chat"
  252. })
  253. },
  254. onKeyboardheightchange(e) {
  255. if (e.detail.height > 0) {
  256. this.showKeyBoard = true;
  257. this.switchChatTabBox('none', false)
  258. this.keyboardHeight = this.rpxTopx(e.detail.height);
  259. } else {
  260. this.showKeyBoard = false;
  261. }
  262. },
  263. onUploadImageBefore(file) {
  264. let data = {
  265. originUrl: file.path,
  266. thumbUrl: file.path
  267. }
  268. let msgInfo = {
  269. id: 0,
  270. fileId: file.uid,
  271. sendId: this.mine.id,
  272. content: JSON.stringify(data),
  273. sendTime: new Date().getTime(),
  274. selfSend: true,
  275. type: this.$enums.MESSAGE_TYPE.IMAGE,
  276. readedCount: 0,
  277. loadStatus: "loading",
  278. status: this.$enums.MESSAGE_STATUS.UNSEND
  279. }
  280. // 填充对方id
  281. this.fillTargetId(msgInfo, this.chat.targetId);
  282. // 插入消息
  283. this.$store.commit("insertMessage", msgInfo);
  284. // 会话置顶
  285. this.moveChatToTop();
  286. // 借助file对象保存
  287. file.msgInfo = msgInfo;
  288. // 滚到最低部
  289. this.scrollToBottom();
  290. return true;
  291. },
  292. onUploadImageSuccess(file, res) {
  293. let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
  294. msgInfo.content = JSON.stringify(res.data);
  295. msgInfo.receipt = this.isReceipt
  296. this.$http({
  297. url: this.messageAction,
  298. method: 'POST',
  299. data: msgInfo
  300. }).then((id) => {
  301. msgInfo.loadStatus = 'ok';
  302. msgInfo.id = id;
  303. this.isReceipt = false;
  304. this.$store.commit("insertMessage", msgInfo);
  305. })
  306. },
  307. onUploadImageFail(file, err) {
  308. let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
  309. msgInfo.loadStatus = 'fail';
  310. this.$store.commit("insertMessage", msgInfo);
  311. },
  312. onUploadFileBefore(file) {
  313. let data = {
  314. name: file.name,
  315. size: file.size,
  316. url: file.path
  317. }
  318. let msgInfo = {
  319. id: 0,
  320. sendId: this.mine.id,
  321. content: JSON.stringify(data),
  322. sendTime: new Date().getTime(),
  323. selfSend: true,
  324. type: this.$enums.MESSAGE_TYPE.FILE,
  325. readedCount: 0,
  326. loadStatus: "loading",
  327. status: this.$enums.MESSAGE_STATUS.UNSEND
  328. }
  329. // 填充对方id
  330. this.fillTargetId(msgInfo, this.chat.targetId);
  331. // 插入消息
  332. this.$store.commit("insertMessage", msgInfo);
  333. // 会话置顶
  334. this.moveChatToTop();
  335. // 借助file对象保存
  336. file.msgInfo = msgInfo;
  337. // 滚到最低部
  338. this.scrollToBottom();
  339. return true;
  340. },
  341. onUploadFileSuccess(file, res) {
  342. let data = {
  343. name: file.name,
  344. size: file.size,
  345. url: res.data
  346. }
  347. let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
  348. msgInfo.content = JSON.stringify(data);
  349. msgInfo.receipt = this.isReceipt
  350. this.$http({
  351. url: this.messageAction,
  352. method: 'POST',
  353. data: msgInfo
  354. }).then((id) => {
  355. msgInfo.loadStatus = 'ok';
  356. msgInfo.id = id;
  357. this.isReceipt = false;
  358. this.$store.commit("insertMessage", msgInfo);
  359. })
  360. },
  361. onUploadFileFail(file, res) {
  362. let msgInfo = JSON.parse(JSON.stringify(file.msgInfo));
  363. msgInfo.loadStatus = 'fail';
  364. this.$store.commit("insertMessage", msgInfo);
  365. },
  366. onDeleteMessage(msgInfo) {
  367. uni.showModal({
  368. title: '删除消息',
  369. content: '确认删除消息?',
  370. success: (res) => {
  371. if (!res.cancel) {
  372. this.$store.commit("deleteMessage", msgInfo);
  373. uni.showToast({
  374. title: "删除成功",
  375. icon: "none"
  376. })
  377. }
  378. }
  379. })
  380. },
  381. onRecallMessage(msgInfo) {
  382. uni.showModal({
  383. title: '撤回消息',
  384. content: '确认撤回消息?',
  385. success: (res) => {
  386. if (!res.cancel) {
  387. let url = `/message/${this.chat.type.toLowerCase()}/recall/${msgInfo.id}`
  388. this.$http({
  389. url: url,
  390. method: 'DELETE'
  391. }).then(() => {
  392. msgInfo = JSON.parse(JSON.stringify(msgInfo));
  393. msgInfo.type = this.$enums.MESSAGE_TYPE.RECALL;
  394. msgInfo.content = '你撤回了一条消息';
  395. msgInfo.status = this.$enums.MESSAGE_STATUS.RECALL;
  396. this.$store.commit("insertMessage", msgInfo);
  397. })
  398. }
  399. }
  400. })
  401. },
  402. onDownloadFile(msgInfo) {
  403. let url = JSON.parse(msgInfo.content).url;
  404. uni.downloadFile({
  405. url: url,
  406. success(res) {
  407. if (res.statusCode === 200) {
  408. var filePath = encodeURI(res.tempFilePath);
  409. uni.openDocument({
  410. filePath: filePath,
  411. showMenu: true
  412. });
  413. }
  414. },
  415. fail(e) {
  416. console.log(e);
  417. uni.showToast({
  418. title: "文件下载失败",
  419. icon: "none"
  420. })
  421. }
  422. });
  423. },
  424. onScrollToTop() {
  425. // #ifdef MP
  426. // 防止滚动条定格在顶部,不能一直往上滚
  427. this.scrollToMsgIdx(this.showMinIdx);
  428. // #endif
  429. // 多展示10条信息
  430. this.showMinIdx = this.showMinIdx > 10 ? this.showMinIdx - 10 : 0;
  431. },
  432. onShowMore() {
  433. if (this.chat.type == "GROUP") {
  434. uni.navigateTo({
  435. url: "/pages/group/group-info?id=" + this.group.id
  436. })
  437. } else {
  438. uni.navigateTo({
  439. url: "/pages/common/user-info?id=" + this.friend.id
  440. })
  441. }
  442. },
  443. onTextInput(e) {
  444. let idx = e.detail.cursor - 1;
  445. if (this.chat.type == 'GROUP' && e.detail.value[idx] == '@') {
  446. this.openAtBox();
  447. let sendText = e.detail.value.replace("@", '');
  448. this.$nextTick(() => {
  449. this.sendText = sendText;
  450. })
  451. }
  452. },
  453. loadReaded(fId) {
  454. this.$http({
  455. url: `/message/private/maxReadedId?friendId=${fId}`,
  456. method: 'get'
  457. }).then((id) => {
  458. this.$store.commit("readedMessage", {
  459. friendId: fId,
  460. maxId: id
  461. });
  462. });
  463. },
  464. readedMessage() {
  465. if (this.chat.type == "GROUP") {
  466. var url = `/message/group/readed?groupId=${this.chat.targetId}`
  467. } else {
  468. url = `/message/private/readed?friendId=${this.chat.targetId}`
  469. }
  470. this.$http({
  471. url: url,
  472. method: 'PUT'
  473. }).then(() => {
  474. this.$store.commit("resetUnreadCount", this.chat)
  475. this.scrollToBottom();
  476. })
  477. },
  478. loadGroup(groupId) {
  479. this.$http({
  480. url: `/group/find/${groupId}`,
  481. method: 'GET'
  482. }).then((group) => {
  483. this.group = group;
  484. this.$store.commit("updateChatFromGroup", group);
  485. this.$store.commit("updateGroup", group);
  486. });
  487. this.$http({
  488. url: `/group/members/${groupId}`,
  489. method: 'get'
  490. }).then((groupMembers) => {
  491. this.groupMembers = groupMembers;
  492. });
  493. },
  494. loadFriend(friendId) {
  495. // 获取对方最新信息
  496. this.$http({
  497. url: `/user/find/${friendId}`,
  498. method: 'GET'
  499. }).then((friend) => {
  500. this.friend = friend;
  501. this.$store.commit("updateChatFromFriend", friend);
  502. this.$store.commit("updateFriend", friend);
  503. })
  504. },
  505. rpxTopx(rpx) {
  506. // px转换成rpx
  507. let info = uni.getSystemInfoSync()
  508. let px = info.windowWidth * rpx / 750;
  509. return Math.floor(rpx);
  510. }
  511. },
  512. computed: {
  513. mine() {
  514. return this.$store.state.userStore.userInfo;
  515. },
  516. title() {
  517. if (!this.chat) {
  518. return "";
  519. }
  520. let title = this.chat.showName;
  521. if (this.chat.type == "GROUP") {
  522. let size = this.groupMembers.filter(m => !m.quit).length;
  523. title += `(${size})`;
  524. }
  525. return title;
  526. },
  527. messageAction() {
  528. return `/message/${this.chat.type.toLowerCase()}/send`;
  529. },
  530. messageSize() {
  531. if (!this.chat || !this.chat.messages) {
  532. return 0;
  533. }
  534. return this.chat.messages.length;
  535. },
  536. unreadCount() {
  537. return this.chat.unreadCount;
  538. },
  539. atUserItems() {
  540. let atUsers = [];
  541. this.atUserIds.forEach((id) => {
  542. if (id == -1) {
  543. atUsers.push({
  544. id: -1,
  545. aliasName: "全体成员"
  546. })
  547. return;
  548. }
  549. let member = this.groupMembers.find((m) => m.userId == id);
  550. if (member) {
  551. atUsers.push(member);
  552. }
  553. })
  554. return atUsers;
  555. }
  556. },
  557. watch: {
  558. messageSize: function(newSize, oldSize) {
  559. // 接收到消息时滚动到底部
  560. if (newSize > oldSize) {
  561. this.scrollToBottom();
  562. }
  563. },
  564. unreadCount: {
  565. handler(newCount, oldCount) {
  566. if (newCount > 0) {
  567. // 消息已读
  568. this.readedMessage()
  569. }
  570. }
  571. }
  572. },
  573. onLoad(options) {
  574. // 聊天数据
  575. this.chat = this.$store.state.chatStore.chats[options.chatIdx];
  576. // 初始状态只显示30条消息
  577. let size = this.chat.messages.length;
  578. this.showMinIdx = size > 30 ? size - 30 : 0;
  579. // 激活当前会话
  580. this.$store.commit("activeChat", options.chatIdx);
  581. // 页面滚到底部
  582. this.scrollToBottom();
  583. // 消息已读
  584. this.readedMessage()
  585. // 加载好友或群聊信息
  586. if (this.chat.type == "GROUP") {
  587. this.loadGroup(this.chat.targetId);
  588. } else {
  589. this.loadFriend(this.chat.targetId);
  590. this.loadReaded(this.chat.targetId)
  591. }
  592. // 复位回执消息
  593. this.isReceipt = false;
  594. },
  595. onUnload() {
  596. this.$store.commit("activeChat", -1);
  597. }
  598. }
  599. </script>
  600. <style lang="scss" scoped>
  601. .chat-box {
  602. position: relative;
  603. border: #dddddd solid 1px;
  604. display: flex;
  605. flex-direction: column;
  606. .header {
  607. display: flex;
  608. justify-content: center;
  609. align-items: center;
  610. height: 60rpx;
  611. padding: 5px;
  612. background-color: white;
  613. line-height: 50px;
  614. font-size: 40rpx;
  615. font-weight: 600;
  616. border: #dddddd solid 1px;
  617. .btn-side {
  618. position: absolute;
  619. line-height: 60rpx;
  620. font-size: 28rpx;
  621. cursor: pointer;
  622. &.left {
  623. left: 30rpx;
  624. }
  625. &.right {
  626. right: 30rpx;
  627. }
  628. }
  629. }
  630. .chat-msg {
  631. flex: 1;
  632. padding: 0;
  633. border: #dddddd solid 1px;
  634. overflow: hidden;
  635. position: relative;
  636. background-color: #f8f8f8;
  637. .scroll-box {
  638. height: 100%;
  639. }
  640. }
  641. .chat-at-bar {
  642. display: flex;
  643. align-items: center;
  644. padding: 0 10rpx;
  645. border: #dddddd solid 1px;
  646. .icon-at {
  647. font-size: 35rpx;
  648. color: darkblue;
  649. font-weight: 600;
  650. }
  651. .chat-at-scroll-box {
  652. flex: 1;
  653. width: 80%;
  654. .chat-at-items {
  655. display: flex;
  656. align-items: center;
  657. height: 70rpx;
  658. .chat-at-item {
  659. padding: 0 3rpx;
  660. }
  661. }
  662. }
  663. }
  664. .send-bar {
  665. display: flex;
  666. align-items: center;
  667. padding: 10rpx;
  668. margin-bottom: 10rpx;
  669. border: #dddddd solid 1px;
  670. background-color: white;
  671. .iconfont {
  672. font-size: 60rpx;
  673. margin: 3rpx;
  674. }
  675. .send-text {
  676. flex: 1;
  677. background-color: #f8f8f8 !important;
  678. overflow: auto;
  679. padding: 20rpx;
  680. background-color: #fff;
  681. border-radius: 20rpx;
  682. max-height: 300rpx;
  683. min-height: 85rpx;
  684. font-size: 30rpx;
  685. box-sizing: border-box;
  686. .send-text-area {
  687. width: 100%;
  688. }
  689. }
  690. .btn-send {
  691. margin: 5rpx;
  692. }
  693. }
  694. .chat-tab-bar {
  695. height: 500rpx;
  696. padding: 20rpx;
  697. background-color: whitesmoke;
  698. .chat-tools {
  699. display: flex;
  700. flex-wrap: wrap;
  701. .chat-tools-item {
  702. width: 140rpx;
  703. padding: 16rpx;
  704. display: flex;
  705. flex-direction: column;
  706. align-items: center;
  707. .tool-icon {
  708. padding: 18rpx;
  709. font-size: 80rpx;
  710. background-color: white;
  711. border-radius: 20%;
  712. &.active{
  713. background-color: #ddd;
  714. }
  715. }
  716. .tool-name {
  717. height: 60rpx;
  718. line-height: 60rpx;
  719. font-size: 25rpx;
  720. }
  721. }
  722. }
  723. .chat-emotion {
  724. height: 100%;
  725. .emotion-item-list {
  726. display: flex;
  727. flex-wrap: wrap;
  728. .emotion-item {
  729. width: 40px;
  730. height: 40px;
  731. text-align: center;
  732. cursor: pointer;
  733. padding: 6px;
  734. }
  735. }
  736. }
  737. }
  738. }
  739. </style>