chat-box.vue 20 KB

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