chat-box.vue 18 KB

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