onlineService.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868
  1. <template>
  2. <view class="onlineService">
  3. <!-- 标题栏 -->
  4. <u-navbar
  5. back-icon-color="#fff"
  6. :back-text="$t('common.Back')"
  7. :is-back="true"
  8. :background="{background:'#1777FE'}"
  9. :back-text-style="{color:'#fff'}"
  10. :border-bottom="true"
  11. title-color="#fff"
  12. :title="title"
  13. >
  14. </u-navbar>
  15. <!-- 转人工-->
  16. <view v-if="this.chatState == 'ROBERT'" class="manmade" @click="changeOnline"><text class="text">{{$t('common.TransferToRober')}}</text></view>
  17. <view v-if="this.chatState == 'Artificial'" class="manmade" @click="changeOnline"><text class="text">{{$t('common.TransferToArt')}}</text></view>
  18. <!-- 聊天信息列表 -->
  19. <view class="chats" id="messageList">
  20. <view class="charitem" v-for="(charitem,charidx) in chatsList" :key="charitem.id">
  21. <!-- 机器人发信息,引导词 -->
  22. <view class="robot" v-if="charitem.messageUserType=='ROBERT' && charitem.messageContent.messageContentType != 'HTML'">
  23. <view class="robotImg"><image class="robotimg" :src="logo" mode="widthFix"></image></view>
  24. <view class="robotmsg">
  25. <view class="msg" v-if="charitem.messageContent.messageContentType == 'ML'">{{charitem.messageContent.content}}</view>
  26. </view>
  27. </view>
  28. <!--客服信息为ML格式时,猜你喜欢消息列表-->
  29. <view class="guessYou" v-if="charitem.messageUserType=='ROBERT' &&charitem.messageContent.messageContentType == 'ML'">
  30. <view class="robotmsg">
  31. <!--猜你喜欢-->
  32. <view class="tag" v-if="charidx=='0'">
  33. <image v-if="$i18n.locale == 'zh'" src="../../../static/img/server/servers/oline/guessZh.png" mode="" style="width: 100%;height: 100%;"></image>
  34. <image v-if="$i18n.locale == 'en'" src="../../../static/img/server/servers/oline/guessEn.png" mode="" style="width: 100%;height:80%;"></image>
  35. <!-- <view class="text">{{$t('common.Youmaylike')}}</view>
  36. <u-icon name="question-circle-fill" size="36" color="#FD9D00"></u-icon> -->
  37. </view>
  38. <view class="msglist">
  39. <view class="robomsgitem"
  40. v-for="(charList,listId) in charitem.messageContent.messageContentList"
  41. :key="listId"
  42. @click="answerList(charList,listId)">
  43. <text class="msg" >{{charList.content}}</text>
  44. <!-- <text class="symbol">&gt;</text> -->
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <!-- 服务列表 -->
  50. <view class="serivceBox" v-if="charidx=='0'">
  51. <scroll-view class="scroll-view_H" scroll-x="true">
  52. <view id="list" class="scroll-view-item_H uni-bg-red" style="line-height: 40upx;" v-for="(item,serviveId) in serviceList" @click="toService(item)">
  53. <view class="serviceImg">
  54. <image :src="'../../../static/img/server/servers/oline/'+(++serviveId)+'.png'" alt="" style="width: 100%;height: 100%;">
  55. </view>
  56. {{item.modelName}}
  57. </view>
  58. </scroll-view>
  59. </view>
  60. <!--客服信息为HTML格式时-->
  61. <view class="robot" v-if="charitem.messageUserType=='ROBERT' && charitem.messageContent.messageContentType == 'HTML'">
  62. <view class="robotImg"><image class="robotimg" :src="logo" mode="widthFix"></image></view>
  63. <view class="robotmsg">
  64. <view class="msglist" >
  65. <view class="robomsgitem">
  66. <text class="msg" v-html="charitem.messageContent.content"></text>
  67. </view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 在线客服消息 -->
  72. <view class="robot" v-if="charitem.messageUserType=='CUSTOMER'">
  73. <view class="robotImg"><image class="robotimg" :src="logo" mode="widthFix"></image></view>
  74. <!-- <view class="robotmsg"> -->
  75. <view class="onlinerobt">
  76. <view class="msg">{{charitem.messageContent.content}}</view>
  77. </view>
  78. </view>
  79. <!-- 当前咨询用户 -->
  80. <view class="currentUser" v-if="charitem.messageUserType=='USER'">
  81. <view v-if="!charitem.messageContent.content.messageContentType">
  82. <view class="currentUserMsg">{{charitem.messageContent.content}}</view>
  83. <view class="currentUserImg" v-if="user.umsUser&&user.umsUser.userPic">
  84. <image :src="'https://geidcp.com/api/fileextend/pub/'+user.umsUser.userPic" style="width: 100%;height: 100%;"></image>
  85. </view>
  86. <view class="currentUserImg" v-else>
  87. <image class="currentUserimg" src="../../../static/E2.png" mode="widthFix"></image>
  88. </view>
  89. <view style="clear: both"></view>
  90. </view>
  91. <view v-if="charitem.messageContent.content.messageContentType == 'COL'">
  92. <view class="currentUserMsg">{{charitem.messageContent.content.content}}</view>
  93. <view class="currentUserImg"><image class="currentUserimg" :src="robotImg" mode="widthFix"></image></view>
  94. <view style="clear: both"></view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <!-- 底部滑动块菜单 -->
  100. <view class="scrollBox">
  101. <view>
  102. <scroll-view class="scroll-view_H" scroll-x="true">
  103. <view id="list" class="scroll-view-item_H uni-bg-red" v-for="item in Morelist" @click="clickMorelist(item)" >{{item.modelName}}</view>
  104. </scroll-view>
  105. </view>
  106. </view>
  107. <!-- 发送信息 -->
  108. <view class="sendMsgBox">
  109. <view class="voice">
  110. <u-icon name="mic" size="36"></u-icon>
  111. </view>
  112. <view class="itp">
  113. <input class="uni-input" @input="showCurrentMsgStr" v-model="inputText"/>
  114. <view class="expression">
  115. <u-icon name="more-circle-fill" size="36"></u-icon>
  116. </view>
  117. </view>
  118. <view class="sendTip" @click="sendMessage">{{i18n('Send')}}</view>
  119. </view>
  120. </view>
  121. </template>
  122. <script>
  123. import UNavbar from '@/components/uni-nav-bar/uni-nav-bar.vue'
  124. import { getAllInformationByCustomer} from "@/api/customer/baseCustomerMessage"
  125. import config from '@/config'
  126. import {robertClientMessages,getOperationListByOperationType} from "@/api/customer/customerServiceRobert"
  127. export default {
  128. name:'onlineService',
  129. components:{
  130. UNavbar
  131. },
  132. data(){
  133. return {
  134. title: '',
  135. logo: '../../../static/logo11.png',
  136. robotImg: '',
  137. token: '',
  138. user:{
  139. id:'',
  140. },
  141. inputText: '',
  142. chatState: 'ROBERT',
  143. chatsList: [],
  144. userMess: {},
  145. sokectOpen:false,
  146. //服务列表图片顺序
  147. userSendMessage: {
  148. id: null,
  149. senderId: '',
  150. senderName: '',
  151. sendContent: '',
  152. receiverId: '',
  153. receiverName: '',
  154. sendingStatus: '',
  155. receivingStatus: '',
  156. messageType: '',
  157. status: '',
  158. createBy: ''
  159. },
  160. timestamp: "",
  161. //心跳检测
  162. heartCheck: {},
  163. pingpangTimes: null, //socket心跳计时器
  164. loginPopRemind: '',
  165. commentScrollCount: '',
  166. //本地重连状态
  167. lockReconnect: false,
  168. timeterver:{},
  169. customerServiceId: "",
  170. params: '',
  171. customAnswer:"",
  172. oldbottom:0,
  173. scrollTop:0,
  174. lastMsgItem:{},
  175. socketUrl:"",
  176. messageCount: 'FIRST',
  177. //在线客服信息
  178. artificial: {
  179. userId: '',
  180. userName: '',
  181. userImage: '',
  182. },
  183. //用户发送消息内容信息
  184. sendRequestMessageContent: {
  185. messageContentType: 'STR',
  186. content: "",
  187. language:"",
  188. },
  189. //用户消息信息
  190. sendRequestMessage: {
  191. "userId": "0",
  192. "userName": "",
  193. "userImage": "helpCenter/logo11.png",
  194. "messageTime":(new Date()).getTime(),
  195. "messageType": "USER",
  196. "messageUserType": "USER",
  197. "messageTypeExtend": "",
  198. "language":"",
  199. "messageContent": "",
  200. },
  201. //底部左右滑动块
  202. Morelist:[],
  203. serviceList:[],
  204. }
  205. },
  206. onLoad(e){
  207. uni.showLoading({
  208. title: this.$i18n.locale == 'zh' ? '加载中...' : 'Loading...'
  209. });
  210. this.title = this.$i18n.locale == 'zh' ? '在线客服' : 'Help Center'
  211. setTimeout(() => {
  212. uni.hideLoading();
  213. }, 100)
  214. },
  215. mounted() {
  216. this.token = uni.getStorageSync('Auth-Token') ? 'Bearer ' + uni.getStorageSync('Auth-Token') : '';
  217. const us = {id:''}
  218. this.user = uni.getStorageSync('user') ? JSON.parse(uni.getStorageSync('user')) : us;
  219. this.initSocket();
  220. this.heartBeat()
  221. this.messageCount='FIRST';
  222. this.getBotMenu();
  223. this.getserviceMenu();
  224. },
  225. // watch(){
  226. // this.messageCount='FIRST';
  227. // },
  228. methods:{
  229. /***发送消息事件 ***/
  230. // 用户点击列表,发送消息
  231. answerList(item, index) {
  232. this.userSendCof(item.content, index)
  233. },
  234. //点击底部可滑动块菜单
  235. clickMorelist(item){
  236. //用户发送消息方法
  237. this.userSendCof(item.modelName)
  238. },
  239. //获取客服消息
  240. async getMessList(messageCount){
  241. let that = this;
  242. let message = JSON.stringify(this.sendRequestMessage);
  243. let res = await this.$myRequest({
  244. url:'/customer/robertClient/get/robert/nologin',
  245. data:{
  246. messageCount,
  247. message
  248. }
  249. });
  250. if (res.status == '200') {
  251. if (messageCount == 'FIRST') {
  252. that.chatsList = []
  253. }
  254. that.chatsList.push(res.data.messages)
  255. this.messageCount = 'CHAT'
  256. }
  257. this.scroBootom()
  258. },
  259. // 切换客服状态
  260. changeOnline() {
  261. const that = this;
  262. if(this.chatState == 'ROBERT'){
  263. this.chatState = "Artificial";
  264. this.openSocket()
  265. }else{
  266. this.chatState = "ROBERT";
  267. if(this.sokectOpen = true){
  268. this.sokectOpen = false;
  269. console.log(this.sokectOpen)
  270. uni.onSocketClose(function (res) {
  271. console.log('WebSocket 已关闭!');
  272. });
  273. }
  274. // this.closeheart();
  275. // this.heartCheck.stop();
  276. }
  277. },
  278. // 获取输入框内容
  279. showCurrentMsgStr(val) {
  280. var userSend = {
  281. type: '3',
  282. name: val.detail.value
  283. }
  284. this.userMess = userSend;
  285. },
  286. // 点击发送按钮发送消息
  287. sendMessage() {
  288. if (this.userMess.name) {
  289. this.userSendCof(this.userMess.name)
  290. this.userMess = "";
  291. this.inputText = "";
  292. } else {
  293. uni.showToast({
  294. title: '说点什么吧 ~',
  295. icon: 'none'
  296. })
  297. }
  298. this.scroBootom()
  299. },
  300. //识别并且发送消息
  301. userSendCof(item, index) {
  302. // this.getUserMessage();
  303. let that = this;
  304. this.sendRequestMessageContent.language = this.$i18n.locale.toUpperCase();
  305. this.sendRequestMessage.language = this.$i18n.locale.toUpperCase();
  306. if(this.chatState == 'ROBERT'){
  307. //机器人小E
  308. this.sendRequestMessageContent.content = item;
  309. this.sendRequestMessage.messageContent = this.sendRequestMessageContent;
  310. this.filters();
  311. let messageCount = JSON.parse(JSON.stringify(this.messageCount));
  312. if (this.messageCount != 'FIRST') {
  313. let sendRequestMessageget = JSON.parse(JSON.stringify(this.sendRequestMessage));
  314. that.chatsList.push(sendRequestMessageget)
  315. }
  316. this.getMessList(messageCount);
  317. }else if(this.chatState == 'Artificial'){
  318. //人工客服
  319. this.sendRequestMessageContent.content = item;
  320. this.sendRequestMessage.messageContent = this.sendRequestMessageContent;
  321. this.sendRequestMessage.userName = this.user.username;
  322. this.filters();
  323. var message = {
  324. language:this.$i18n.locale.toUpperCase(),
  325. userId: "",
  326. message: "",
  327. messageType: "ARTM",
  328. }
  329. message.message = this.sendRequestMessage;
  330. message.userId = '2';
  331. this.sendSocket(JSON.stringify(message))
  332. let sendRequestMessageget = JSON.parse(JSON.stringify(this.sendRequestMessage));
  333. if(item != ""){
  334. that.chatsList.push(sendRequestMessageget)
  335. }
  336. }
  337. this.scroBootom()
  338. },
  339. //调用Socket方法发送消息
  340. sendSocket(msg) {
  341. uni.sendSocketMessage({
  342. data: msg,
  343. success : ()=> {
  344. console.log('发送成功')
  345. }
  346. });
  347. },
  348. /**获取数据信息**/
  349. async getBotMenu(){
  350. let that = this;
  351. var operationType = "QUICKLIST";
  352. var language = this.$i18n.locale.toUpperCase();
  353. let res = await this.$myRequest({
  354. url:'/customer/customerOperations/getOperationListByOperationType',
  355. data:{
  356. operationType,
  357. language
  358. }
  359. });
  360. if ('200' == res.status) {
  361. if(res.data.customerOperations){
  362. this.Morelist = res.data.customerOperations
  363. }
  364. }
  365. },
  366. /**获取服务列表**/
  367. async getserviceMenu(){
  368. let that = this;
  369. var operationType = "PLATFORMSERVICES";
  370. var language = this.$i18n.locale.toUpperCase();
  371. let res = await this.$myRequest({
  372. url:'/customer/customerOperations/getOperationListByOperationType',
  373. data:{
  374. operationType,
  375. language
  376. }
  377. });
  378. if ('200' == res.status) {
  379. if(res.data.customerOperations){
  380. this.serviceList = res.data.customerOperations
  381. }
  382. }
  383. },
  384. /*** socket事件 ***/
  385. //初始化socket
  386. initSocket() {
  387. const that = this;
  388. //获取用户信息
  389. this.getUserMessage();
  390. //第一次发起请求
  391. this.userSendCof("");
  392. //监听socket消息
  393. this.getTimeMessage();
  394. this.scroBootom()
  395. },
  396. //创建socket连接
  397. openSocket(){
  398. const that = this;
  399. that.user.id = (new Date()).getTime();
  400. // if(process.env.NODE_ENV === 'development'){
  401. // console.log('开发环境')
  402. // this.socketUrl ="http://172.16.10.44:7028/userConn/" + this.$i18n.locale.toUpperCase() + "/" + this.user.id;
  403. // console.log(this.socketUrl)
  404. // }else{
  405. this.socketUrl = 'wss://www.geidcp.com' + "/userConn/"+ this.$i18n.locale.toUpperCase() + "/" + this.user.id;
  406. // }
  407. this.socketUrl = this.socketUrl.replace("https", "wss").replace("http", "ws");
  408. uni.connectSocket({
  409. url: this.socketUrl
  410. });
  411. // 打开socket
  412. uni.onSocketOpen(function (res) {
  413. console.log('Socket连接已打开!');
  414. this.sokectOpen = true;
  415. });
  416. //初始化socket
  417. this.initOperation()
  418. //监听socket错误
  419. uni.onSocketError((res) => {
  420. console.log('Socket连接打开失败');
  421. that.reconnect(this.socketUrl);
  422. })
  423. this.scroBootom()
  424. },
  425. //检查用户身份
  426. getUserMessage(){
  427. //用户信息
  428. if (this.user.id != '') {
  429. this.sendRequestMessage.userId = this.user.id;
  430. this.sendRequestMessage.userName = this.user.username;
  431. this.robotImg = this.user.umsUser.userPic;
  432. } else{
  433. this.user.id = new Date().getTime();
  434. this.sendRequestMessage.userId = this.user.id;
  435. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  436. this.user.username = '游客';
  437. this.sendRequestMessage.userName = '游客';
  438. } else {
  439. this.user.username = 'Tourist';
  440. this.sendRequestMessage.userName = 'Tourist';
  441. }
  442. this.user.userImage = '';
  443. this.sendRequestMessage.userImage = this.user.userImage;
  444. }
  445. },
  446. //初始化socket操作方法
  447. initOperation(){
  448. let that = this;
  449. // 监听到socket
  450. uni.onSocketMessage(function (res) {
  451. var message = JSON.parse(res.data);
  452. console.log(message)
  453. if (message.messageType == 'PONG') {
  454. } else {
  455. that.artificial.userId = message.userId;
  456. that.artificial.userName = message.userName;
  457. that.chatsList.push(message)
  458. }
  459. });
  460. },
  461. //心跳机制
  462. heartBeat(){
  463. let that = this;
  464. this.heartCheck = {
  465. timeout:30000,
  466. timeoutObj: null,
  467. serverTimeoutObj: null,
  468. //socket: this.socket,
  469. start: function () {
  470. console.log('start');
  471. var self = this;
  472. this.timeoutObj && clearTimeout(this.timeoutObj);
  473. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  474. this.timeoutObj = setTimeout(function () {
  475. //发送一个心跳
  476. var message = {
  477. userId: "",
  478. message: "",
  479. messageType: "PING",
  480. }
  481. var a = JSON.stringify(message);
  482. uni.sendSocketMessage({
  483. data:a,
  484. success: () => {
  485. },
  486. });
  487. self.serverTimeoutObj = setTimeout(function () {
  488. uni.onSocketClose(function (res) {
  489. console.log('WebSocket 已关闭!');
  490. });
  491. }, self.timeout);
  492. }, this.timeout)
  493. },
  494. stop () {
  495. clearTimeout(this.timeoutObj);
  496. clearTimeout(this.serverTimeoutObj);
  497. },
  498. }
  499. },
  500. // 重新连接心跳
  501. reconnect() {
  502. let that = this;
  503. if (this.lockReconnect) {
  504. return;
  505. };
  506. this.lockReconnect = true;
  507. //没连接上会一直重连,设置延迟避免请求过多
  508. this.timeterver && clearTimeout(this.timeterver);
  509. this.timeterver = setTimeout(function () {
  510. that.openSocket();
  511. that.lockReconnect = false;
  512. }, 4000);
  513. },
  514. //监听socket消息
  515. getTimeMessage(){
  516. const that = this;
  517. //监听socket消息
  518. uni.onSocketMessage(function (res){
  519. if(!res){
  520. console.log("没有监听到的返回数据")
  521. }
  522. that.heartCheck.start();
  523. let infos = JSON.parse(res.data);
  524. that.chatsList.push(infos);
  525. this.scroBootom();
  526. })
  527. },
  528. //发送消息滚动到底部
  529. scroBootom(){
  530. setTimeout(() => {
  531. uni.pageScrollTo({scrollTop: 99999, duration: 0});
  532. }, 50);
  533. },
  534. //跳转至服务
  535. toService(item){
  536. if(item.linkPath == "conferenceServices"){
  537. //会议服务
  538. item.link = '/pages/conference/meetingIndexCh/meetingIndex'
  539. }else if(item.linkPath == "IntroductionMemberProfile"){
  540. //定制服务
  541. item.link = '/pages/cooperationNetwork/cooperationNetwork'
  542. }else if(item.linkPath == "financialServices"){
  543. //金融服务
  544. item.link = '/pages/financialService/financialService'
  545. }else if(item.linkPath == "resourceSharing"){
  546. //资源共享
  547. item.link = '/pages/resourceSharing/resourceSharing'
  548. }else{
  549. //资源共享
  550. item.link = '/pages/category/exhibition';
  551. }
  552. this.toView(item.link)
  553. },
  554. //跳转事件
  555. toView(href){
  556. uni.navigateTo({
  557. url:href
  558. })
  559. },
  560. i18n (data) {
  561. return this.$t('common.'+data);
  562. },
  563. //时间戳的处理
  564. filters(){
  565. var dates=new Date();
  566. // var now = new Date(dates*1000);
  567. var year = dates.getFullYear();
  568. var month = dates.getMonth() + 1;
  569. if (month < 10) {
  570. month = '0' + month
  571. }
  572. var date = dates.getDate();
  573. if (date < 10) {
  574. date = '0' + date
  575. }
  576. var hours = dates.getHours();
  577. if (hours < 10)
  578. hours = "0" + hours;
  579. var minutes = dates.getMinutes();
  580. if (minutes < 10)
  581. minutes = "0" + minutes;
  582. var seconds = dates.getSeconds();
  583. if (seconds < 10)
  584. seconds = "0" + seconds;
  585. let time = year + "-" + month + "-" + date +" " + hours + ":" + minutes+ ":" + seconds;
  586. this.sendRequestMessage.messageTime = time;
  587. },
  588. }
  589. }
  590. </script>
  591. <style lang="scss" scoped>
  592. .onlineService{
  593. padding-bottom:20upx;
  594. .manmade{
  595. position: fixed;
  596. width: 100%;
  597. background:#5FC1B9;
  598. padding:5px 0;
  599. text-align: center;
  600. z-index: 100;
  601. .text{
  602. color:#fff;
  603. padding:10upx 40upx;
  604. border-radius:10upx;
  605. }
  606. }
  607. .serviceStatus{
  608. font-size:24upx;
  609. display:flex;
  610. justify-content:flex-end;
  611. padding:1% 3% 1% 3%;
  612. color:#666;
  613. }
  614. .robot,.currentUser{
  615. display:flex;
  616. width:94%;
  617. margin:80upx auto 50upx;
  618. .robotImg,.currentUserImg{
  619. width:100upx;
  620. height:100upx;
  621. position:relative;
  622. overflow:hidden;
  623. margin-right:20upx;
  624. border-radius:50%;
  625. background-color:#fff;
  626. &.currentUserImg{
  627. margin-left:20upx;
  628. display: inline-block;
  629. }
  630. .robotimg,.currentUserimg{
  631. width:80%;
  632. margin:10%;
  633. display:block;
  634. }
  635. }
  636. .robotmsg{
  637. color:#333;
  638. background:#fff;
  639. padding:20upx;
  640. border-radius:20upx;
  641. width:80%;
  642. .msglist{
  643. .robomsgitem{
  644. margin:20upx 0;
  645. border-bottom:1px solid #fafafa;
  646. padding:10upx 0;
  647. display:flex;
  648. justify-content:space-between;
  649. align-items:flex-end;
  650. &.blue {
  651. .msg{
  652. color:#0091FF;
  653. }
  654. }
  655. }
  656. }
  657. }
  658. .onlinerobt{
  659. color:#333;
  660. background:#fff;
  661. padding:20upx;
  662. border-radius:20upx;
  663. max-width:80%;
  664. }
  665. &.currentUser{
  666. justify-content:flex-end;
  667. .currentUserMsg{
  668. text-align:right;
  669. background:#fff;
  670. padding:20upx;
  671. border-radius:20upx;
  672. /*display: inline-block;*/
  673. float: left;
  674. max-width: 80%;
  675. text-align: left;
  676. }
  677. }
  678. }
  679. .serivceBox{
  680. width: 90%;
  681. height: 120upx;
  682. background-color: #fff;
  683. margin:40upx auto;
  684. border-radius: 20upx;
  685. padding: 0 20upx;
  686. display: flex;
  687. flex-wrap: nowrap;
  688. position: relative;
  689. .serviceImg{
  690. width: 66upx;
  691. height: 66upx;
  692. position: relative;
  693. left: 25%;
  694. }
  695. }
  696. .guessYou{
  697. display:flex;
  698. width:94%;
  699. margin:auto;
  700. .robotmsg{
  701. color:#333;
  702. background:#fff;
  703. padding:20upx;
  704. border-radius:20upx;
  705. width: 95%;
  706. margin: auto;
  707. .tag{
  708. width:13%;
  709. height: 180upx;
  710. margin: 20px 0 0 15px;
  711. float: left;
  712. .text{
  713. font-size:40rpx;
  714. font-family:"microsoft yahei";
  715. font-weight:1000;
  716. font-style:italic;
  717. margin-right:20upx;
  718. color:#2DA4EA;
  719. }
  720. }
  721. .symbol{
  722. color:#aaa;
  723. margin-left: 20upx;
  724. }
  725. .msglist{
  726. width: 65%;
  727. float: left;
  728. margin-left: 20upx;
  729. .robomsgitem{
  730. margin:20upx 0;
  731. border-bottom:1px solid #fafafa;
  732. padding:10upx 0;
  733. display:flex;
  734. justify-content:space-between;
  735. align-items:flex-end;
  736. &.blue {
  737. .msg{
  738. color:#0091FF;
  739. }
  740. }
  741. }
  742. }
  743. }
  744. }
  745. .chats{
  746. padding:0 0 200upx 0;
  747. }
  748. // 发送信息框
  749. .sendMsgBox{
  750. position:fixed;
  751. bottom:0;
  752. width:100%;
  753. padding:20upx 10%;
  754. height:120upx;
  755. background:#FaFaFa;
  756. z-index:9999;
  757. display:flex;
  758. align-items:center;
  759. .voice{
  760. margin-right:16upx;
  761. }
  762. .itp{
  763. flex:1;
  764. display:flex;
  765. background:#fff;
  766. text-indent:20upx;
  767. border-radius:60upx;
  768. align-items:center;
  769. .uni-input{
  770. height:60upx;
  771. line-height:60upx;
  772. flex:1;
  773. }
  774. .expression{
  775. margin-right:16upx;
  776. }
  777. }
  778. .sendBtn{
  779. width:60upx;
  780. height:60upx;
  781. line-height:60upx;
  782. text-align:center;
  783. font-size:60upx;
  784. color:#666;
  785. }
  786. .sendTip{
  787. font-size: 24upx;
  788. color:#666;
  789. }
  790. }
  791. .scrollBox{
  792. width: 100%;
  793. background-color: #D5DCE1;
  794. position: fixed;
  795. bottom: 120upx;
  796. height: 80upx;
  797. }
  798. .scroll-view_H {
  799. white-space: nowrap;
  800. width: 100%;
  801. }
  802. .scroll-view-item_H {
  803. display: inline-block;
  804. min-width: 20%;
  805. height: 40upx;
  806. background: #fff;
  807. line-height: 40upx;
  808. text-align: center;
  809. font-size: 20upx;
  810. border-radius: 40upx;
  811. margin: 20upx 16upx;
  812. padding: 0 10upx;
  813. }
  814. }
  815. </style>