chat-box.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  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. loadReaded(fId) {
  423. this.$http({
  424. url: `/message/private/maxReadedId?friendId=${fId}`,
  425. method: 'get'
  426. }).then((id) => {
  427. this.$store.commit("readedMessage", {
  428. friendId: fId,
  429. maxId: id
  430. });
  431. });
  432. },
  433. readedMessage() {
  434. if (this.chat.type == "GROUP") {
  435. var url = `/message/group/readed?groupId=${this.chat.targetId}`
  436. } else {
  437. url = `/message/private/readed?friendId=${this.chat.targetId}`
  438. }
  439. this.$http({
  440. url: url,
  441. method: 'PUT'
  442. }).then(() => {
  443. this.$store.commit("resetUnreadCount", this.chat)
  444. this.scrollToBottom();
  445. })
  446. },
  447. loadGroup(groupId) {
  448. this.$http({
  449. url: `/group/find/${groupId}`,
  450. method: 'GET'
  451. }).then((group) => {
  452. this.group = group;
  453. this.$store.commit("updateChatFromGroup", group);
  454. this.$store.commit("updateGroup", group);
  455. });
  456. this.$http({
  457. url: `/group/members/${groupId}`,
  458. method: 'get'
  459. }).then((groupMembers) => {
  460. this.groupMembers = groupMembers;
  461. });
  462. },
  463. loadFriend(friendId) {
  464. // 获取对方最新信息
  465. this.$http({
  466. url: `/user/find/${friendId}`,
  467. method: 'GET'
  468. }).then((friend) => {
  469. this.friend = friend;
  470. this.$store.commit("updateChatFromFriend", friend);
  471. this.$store.commit("updateFriend", friend);
  472. })
  473. },
  474. rpxTopx(rpx) {
  475. // px转换成rpx
  476. let info = uni.getSystemInfoSync()
  477. let px = info.windowWidth * rpx / 750;
  478. return Math.floor(rpx);
  479. }
  480. },
  481. computed: {
  482. mine() {
  483. return this.$store.state.userStore.userInfo;
  484. },
  485. title() {
  486. if (!this.chat) {
  487. return "";
  488. }
  489. let title = this.chat.showName;
  490. if (this.chat.type == "GROUP") {
  491. let size = this.groupMembers.filter(m => !m.quit).length;
  492. title += `(${size})`;
  493. }
  494. return title;
  495. },
  496. messageAction() {
  497. return `/message/${this.chat.type.toLowerCase()}/send`;
  498. },
  499. messageSize() {
  500. if (!this.chat || !this.chat.messages) {
  501. return 0;
  502. }
  503. return this.chat.messages.length;
  504. },
  505. unreadCount() {
  506. return this.chat.unreadCount;
  507. },
  508. atUserItems() {
  509. let atUsers = [];
  510. this.atUserIds.forEach((id) => {
  511. if (id == -1) {
  512. atUsers.push({
  513. id: -1,
  514. aliasName: "全体成员"
  515. })
  516. return;
  517. }
  518. let member = this.groupMembers.find((m) => m.userId == id);
  519. if (member) {
  520. atUsers.push(member);
  521. }
  522. })
  523. return atUsers;
  524. }
  525. },
  526. watch: {
  527. messageSize: function(newSize, oldSize) {
  528. // 接收到消息时滚动到底部
  529. if (newSize > oldSize) {
  530. this.scrollToBottom();
  531. }
  532. },
  533. unreadCount: {
  534. handler(newCount, oldCount) {
  535. if (newCount > 0) {
  536. // 消息已读
  537. this.readedMessage()
  538. }
  539. }
  540. }
  541. },
  542. onLoad(options) {
  543. // 聊天数据
  544. this.chat = this.$store.state.chatStore.chats[options.chatIdx];
  545. // 初始状态只显示30条消息
  546. let size = this.chat.messages.length;
  547. this.showMinIdx = size > 30 ? size - 30 : 0;
  548. // 激活当前会话
  549. this.$store.commit("activeChat", options.chatIdx);
  550. // 页面滚到底部
  551. this.scrollToBottom();
  552. // 消息已读
  553. this.readedMessage()
  554. // 加载好友或群聊信息
  555. if (this.chat.type == "GROUP") {
  556. this.loadGroup(this.chat.targetId);
  557. } else {
  558. this.loadFriend(this.chat.targetId);
  559. this.loadReaded(this.chat.targetId)
  560. }
  561. },
  562. onUnload() {
  563. this.$store.commit("activeChat", -1);
  564. }
  565. }
  566. </script>
  567. <style lang="scss" scoped>
  568. .chat-box {
  569. position: relative;
  570. border: #dddddd solid 1px;
  571. display: flex;
  572. flex-direction: column;
  573. .header {
  574. display: flex;
  575. justify-content: center;
  576. align-items: center;
  577. height: 60rpx;
  578. padding: 5px;
  579. background-color: white;
  580. line-height: 50px;
  581. font-size: 40rpx;
  582. font-weight: 600;
  583. border: #dddddd solid 1px;
  584. .btn-side {
  585. position: absolute;
  586. line-height: 60rpx;
  587. font-size: 28rpx;
  588. cursor: pointer;
  589. &.left {
  590. left: 30rpx;
  591. }
  592. &.right {
  593. right: 30rpx;
  594. }
  595. }
  596. }
  597. .chat-msg {
  598. flex: 1;
  599. padding: 0;
  600. border: #dddddd solid 1px;
  601. overflow: hidden;
  602. position: relative;
  603. background-color: #f8f8f8;
  604. .scroll-box {
  605. height: 100%;
  606. }
  607. }
  608. .chat-at-bar {
  609. display: flex;
  610. align-items: center;
  611. padding: 0 10rpx;
  612. border: #dddddd solid 1px;
  613. .icon-at {
  614. font-size: 35rpx;
  615. color: darkblue;
  616. font-weight: 600;
  617. }
  618. .chat-at-scroll-box {
  619. flex: 1;
  620. width: 80%;
  621. .chat-at-items {
  622. display: flex;
  623. align-items: center;
  624. height: 70rpx;
  625. .chat-at-item {
  626. padding: 0 3rpx;
  627. }
  628. }
  629. }
  630. }
  631. .send-bar {
  632. display: flex;
  633. align-items: center;
  634. padding: 10rpx;
  635. margin-bottom: 10rpx;
  636. border: #dddddd solid 1px;
  637. background-color: white;
  638. .iconfont {
  639. font-size: 60rpx;
  640. margin: 3rpx;
  641. }
  642. .send-text {
  643. flex: 1;
  644. background-color: #f8f8f8 !important;
  645. overflow: auto;
  646. padding: 20rpx;
  647. background-color: #fff;
  648. border-radius: 20rpx;
  649. max-height: 300rpx;
  650. min-height: 85rpx;
  651. font-size: 30rpx;
  652. box-sizing: border-box;
  653. .send-text-area {
  654. width: 100%;
  655. }
  656. }
  657. .btn-send {
  658. margin: 5rpx;
  659. }
  660. }
  661. .chat-tab-bar {
  662. height: 500rpx;
  663. padding: 20rpx;
  664. background-color: whitesmoke;
  665. .chat-tools {
  666. display: flex;
  667. flex-wrap: wrap;
  668. justify-content: space-between;
  669. .chat-tools-item {
  670. width: 140rpx;
  671. padding: 15rpx;
  672. display: flex;
  673. flex-direction: column;
  674. align-items: center;
  675. .tool-icon {
  676. padding: 15rpx;
  677. font-size: 80rpx;
  678. background-color: white;
  679. border-radius: 20%;
  680. }
  681. .tool-name {
  682. height: 60rpx;
  683. line-height: 60rpx;
  684. font-size: 25rpx;
  685. }
  686. }
  687. }
  688. .chat-emotion {
  689. height: 100%;
  690. .emotion-item-list {
  691. display: flex;
  692. flex-wrap: wrap;
  693. .emotion-item {
  694. width: 40px;
  695. height: 40px;
  696. text-align: center;
  697. cursor: pointer;
  698. padding: 6px;
  699. }
  700. }
  701. }
  702. }
  703. }
  704. </style>