chat.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913
  1. <template>
  2. <div v-loading="allLoading" element-loading-text="拼命连接中">
  3. <div class="chatBox">
  4. <!-- ************************* 头部消息 ************************* -->
  5. <el-header height='80px'>
  6. <el-row type="flex" justify='space-between' align='middle' style="height:100%;">
  7. <el-col class="tit nopd" v-if="machineAndAtl == 10"><span>智能客服</span></el-col>
  8. <el-col class="tit nopd" v-else-if="machineAndAtl == 100"><span v-if="service">{{service.serverInfo.name}}</span>
  9. </el-col>
  10. <el-col>
  11. <div class="imgBox">
  12. <i v-if="selNum > chatNum" @click="ejectEvl(10)" class="sc pointer"
  13. :class="selType?'scActy':''"></i>
  14. <div style="float: right" class="pointer" @click="leaveMsg()">
  15. <span style="font-size: 25px; color: #b3c1e7; margin-top: 13px;" @click="back()"
  16. class="el-icon-chat-line-round"></span>
  17. </div>
  18. <!-- <i class="sy pointer" @click="select(2)" :class="syType?'syActy':''"></i>
  19. <i class="sq pointer" @click="select(3)" :class="sqType?'sqActy':''"></i>-->
  20. </div>
  21. </el-col>
  22. </el-row>
  23. </el-header>
  24. <div class="cationer">
  25. <!--****************************** 聊天会话框模块 *****************************-->
  26. <el-main>
  27. <!-- 广告展示隐藏按钮 -->
  28. <div class="retract pointer" @click="retract()">
  29. <img src="./../assets/st-img/retract.png" alt="" v-if="retractShow">
  30. <img src="./../assets/st-img/retract2.png" alt="" v-else>
  31. </div>
  32. <el-row class="pd informationBox scroll" id="main">
  33. <!-------------------机器人聊天板块 ----------------------->
  34. <div v-if="machineAndAtl == 10">
  35. <!--··············· 欢迎语 ············-->
  36. <div class="conversationBox" v-if="machine != ''">
  37. <div class=" row">
  38. <div class="conversation row">
  39. <div class="headImg">
  40. <img src="./../assets/st-img/headAdvent.png" alt="">
  41. </div>
  42. <div class="cont left">
  43. <div>{{machine.content}}</div>
  44. </div>
  45. </div>
  46. <div style="width:66px;"></div>
  47. </div>
  48. </div>
  49. <!--··········· 快捷问题回答模块 ············-->
  50. <div class="questionList" v-if="questionShow">
  51. <section v-for="(item,idx) in problem" :key="item.id">
  52. <div @click="answers(idx)">
  53. <span class="pointer gl">{{item.robot_name}}</span>
  54. </div>
  55. </section>
  56. <section>
  57. <div>
  58. <span class="col6">上面问题都不是</span>
  59. <span class="pointer ly" @click="changeService()">转人工客服</span>
  60. </div>
  61. </section>
  62. </div>
  63. <!--················ 和机器人会话发送消息 ·············-->
  64. <div v-for="item in chatCont" :key="item.id">
  65. <!-- 用户发文本信息 -->
  66. <div class="conversationBox" v-if="item.type =='user'">
  67. <div class="timer">{{item.time}}</div>
  68. <div class="customer row allAlignment">
  69. <div style="width:66px;"></div>
  70. <div class="row">
  71. <!-- 显示内容 -->
  72. <div v-if="item.chat" class="cont right">
  73. <div v-html="item.chat"></div>
  74. </div>
  75. <div v-else class=" right noafter" style="width:200px;margin-right:10px; ">
  76. <div slot="file">
  77. <img class="el-upload-list__item-thumbnail"
  78. @click="handlePictureCardPreview(url+item.imgUrl)"
  79. style="width:100%;height:auto;border-radius: 10px;"
  80. :src="url+item.imgUrl" alt="">
  81. </div>
  82. </div>
  83. <!-- 图片放大 -->
  84. <el-dialog :visible.sync="dialogVisible">
  85. <img width="100%" :src="dialogImageUrl" alt="">
  86. </el-dialog>
  87. <!-- 头像 -->
  88. <div class="headImg">
  89. <img :src="user_info.avatar" alt="">
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- 机器人无法回答转人工 -->
  95. <div class="conversationBox" v-if="item.type == 1001">
  96. <div class=" row">
  97. <div class="conversation row">
  98. <div class="headImg">
  99. <img src="./../assets/st-img/headAdvent.png" alt="">
  100. </div>
  101. <div class="cont left">
  102. <div>您的问题暂时无法处理</div>
  103. <div>
  104. <span class="col">问题没有解决?</span>
  105. <span class="change pointer ly"
  106. @click="changeService()">转人工客服</span>
  107. </div>
  108. </div>
  109. </div>
  110. <div style="width:66px;"></div>
  111. </div>
  112. </div>
  113. <!-- 机器人回答 -->
  114. <div class="conversationBox" v-else-if='item.type == "service"'>
  115. <div class=" row">
  116. <div class="conversation row">
  117. <div class="headImg">
  118. <img src="./../assets/st-img/headAdvent.png" alt="">
  119. </div>
  120. <div class="cont left">
  121. <div>{{item.cont}}</div>
  122. </div>
  123. </div>
  124. <div style="width:66px;"></div>
  125. </div>
  126. </div>
  127. <!-- 快捷问题回答 -->
  128. <div class="conversationBox" v-else-if="item.type == 'machine'">
  129. <div class="timer">
  130. {{item.robot_addTime}}
  131. </div>
  132. <div class=" row">
  133. <div class="conversation row">
  134. <div class="headImg">
  135. <img src="./../assets/st-img/headAdvent.png" alt="">
  136. </div>
  137. <div class="cont left">
  138. <div>{{item.robot_content}}</div>
  139. <div>
  140. <span class="col">问题没有解决</span>
  141. <span class="change pointer ly"
  142. @click="changeService()">转人工客服</span>
  143. </div>
  144. </div>
  145. </div>
  146. <div style="width:66px;"></div>
  147. </div>
  148. </div>
  149. <!-- 转接客服列表 -->
  150. <div class="changeService" v-else-if="item.type == 'artService'">
  151. <div v-for="(itemList,idx) in serviceList" :key="idx">
  152. <span class="col6">人工客服:</span>
  153. <span class="colE5 pointer gl" @click="jumpService(itemList.id)">{{itemList.name}}</span>
  154. </div>
  155. </div>
  156. </div>
  157. <!--············· 各种消息提示框 ··············-->
  158. <!-- 转接客服 -->
  159. <div class="promptBox" v-if="artAndLeave == 10">
  160. <div class="prompt">
  161. <span>已转接人工客服</span>
  162. </div>
  163. </div>
  164. <!-- 客服关闭会话 -->
  165. <div class="promptBox" v-if="closeByServer">
  166. <div class="prompt" style="width: 150px">
  167. <span>已重新连接</span>
  168. </div>
  169. </div>
  170. <!-- 客服不在线帮助提示框 -->
  171. <div class="promptBox " v-if="artAndLeave == 100">
  172. <div class="prompt help">
  173. <span>当前客服不在线,如需帮助请</span>
  174. <span class="colE5 ly pointer" @click="leaveMsg()">留言</span>
  175. </div>
  176. </div>
  177. </div>
  178. <!--············ 和人工会话聊天模块 ··············-->
  179. <div v-if="machineAndAtl == 100">
  180. <!-- 人工客服回复消息 -->
  181. <div v-for="item in customerSviceChat" :key="item.id">
  182. <!-- tem.cont != '' -->
  183. <div class="conversationBox" v-if="item.type == 'service' ">
  184. <div class="timer"> {{item.time}}</div>
  185. <div class=" row">
  186. <div class="conversation row">
  187. <div class="headImg">
  188. <img :src="serviceImg?url+serviceImg:require('@/assets/st-img/kf.png')"
  189. alt="">
  190. </div>
  191. <div class="cont left">
  192. <div v-if="item.content != ''" v-html="item.content"></div>
  193. <div v-else slot="file">
  194. <img class="el-upload-list__item-thumbnail"
  195. @click="handlePictureCardPreview(url+item.imgUrl)"
  196. style="width:100%;height:auto;border-radius: 10px;"
  197. :src="url+item.imgUrl" alt="">
  198. </div>
  199. </div>
  200. </div>
  201. <div style="width:66px;"></div>
  202. </div>
  203. </div>
  204. <!-- 用户发送文本消息 -->
  205. <div class="conversationBox" v-if="item.type == 'user' ">
  206. <div>
  207. <div class="timer">{{item.time}}</div>
  208. <div class="customer row allAlignment">
  209. <div style="width:66px;"></div>
  210. <div class="row">
  211. <div class="cont right">
  212. <div v-if="item.content != ''" v-html="item.content"></div>
  213. <div v-else slot="file">
  214. <img class="el-upload-list__item-thumbnail"
  215. @click="handlePictureCardPreview(url+item.imgUrl)"
  216. style="width:100%;height:auto;border-radius: 10px;"
  217. :src="url+item.imgUrl" alt="">
  218. </div>
  219. </div>
  220. <div class="headImg">
  221. <img :src="user_info.avatar" alt="">
  222. </div>
  223. </div>
  224. </div>
  225. </div>
  226. </div>
  227. <!-- 点击图片放大 -->
  228. <el-dialog :visible.sync="dialogVisible">
  229. <img width="100%" :src="dialogImageUrl" alt="">
  230. </el-dialog>
  231. </div>
  232. <!-- 评价 -->
  233. <div class="evaluate" @click="ejectEvl(10)" v-if="consult">
  234. <span>欢迎你的咨询,请对我们的服务做出评价</span>
  235. <span class="btn seek">评价</span>
  236. </div>
  237. <div class="promptBox " v-if="comtSuccess">
  238. <div class="prompt help">
  239. <span>您对我们的服务评价为: {{comtCount}}。非常感谢!</span>
  240. </div>
  241. </div>
  242. <!-- 系统即将结束会话
  243. <div class="promptBoxH " v-if="willOverTime">
  244. <div class="prompt help" style="width: 280px; height: 35px;">
  245. <span>{{willOverTime}}</span>
  246. </div>
  247. </div> -->
  248. <!-- 客服关闭会话 -->
  249. <div class="promptBox " v-if="closeByServer">
  250. <div class="prompt help" style="width: 280px;">
  251. <span>会话已关闭,如需继续咨询请</span>
  252. <span class="colE5 ly pointer" @click="goBack()">重新连接</span>
  253. </div>
  254. </div>
  255. <!-- 客服关闭会话 -->
  256. <div class="promptBox " v-if="serverNotOnlin">
  257. <div class="prompt help" style="width: 280px;">
  258. <span>客服掉线</span>
  259. </div>
  260. </div>
  261. </div>
  262. </el-row>
  263. <!--·········· 文本编辑框 ···········-->
  264. <el-row class="chatting">
  265. <el-col>
  266. <!-- 发送图和表情按钮 -->
  267. <div style="height:18px; display:flex;">
  268. <el-popover placement="top-start" width="200" trigger="hover"
  269. style="margin-top: -2px;">
  270. <ul>
  271. <li class="emoticon" v-for="(item,index) in frceArr" :key="item.id">
  272. <img class="pointer" :src="require(`@/assets/st-img/${index}.gif`)"
  273. @click="memeImg(index)" alt="">
  274. </li>
  275. </ul>
  276. <el-button class="expression" slot="reference"></el-button>
  277. </el-popover>
  278. <el-upload class="avatar-uploader" action="/api/index/upload/uploadImg"
  279. :on-success="handleAvatarSuccess"
  280. :before-upload="beforeAvatarUpload"
  281. :on-error='handError'
  282. list-type='no' accept="image/jpeg,image/jpg,image/png,image/svg">
  283. <!-- <img v-if="imageUrl" :src="imageUrl" class="avatar"> -->
  284. <i slot="default" class=" photo"></i>
  285. </el-upload>
  286. </div>
  287. <div class="row center allAlignment chattingBox">
  288. <div style="height:44px;width:300px;">
  289. <textarea name="" id="" v-model="information" cols="30" rows="1"
  290. placeholder="请输入你的问题:"></textarea>
  291. </div>
  292. <div>
  293. <!-- 准备修改 -->
  294. <div @click="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?sendInfo():''):''"
  295. class="sendOut pointer"
  296. :class="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?'sendCol':'netSendCol'):'netSendCol'">
  297. <span class="">发送</span>
  298. </div>
  299. </div>
  300. </div>
  301. </el-col>
  302. </el-row>
  303. </el-main>
  304. <el-aside width='255px' v-if="retractShow">
  305. <el-row class="rt">
  306. <el-col :span='24' class="artificial pd20">
  307. <div class="infor">
  308. <div v-if="machineAndAtl == 10">
  309. <span>姓名:</span>
  310. <span>{{service.kf_name ? service.kf_name : '智能客服' }}</span>
  311. </div>
  312. <div v-else-if="machineAndAtl == 100">
  313. <span>姓名:</span>
  314. <span v-if="service">{{ service.serverInfo.name ? service.serverInfo.name : '001客服' }}</span>
  315. </div>
  316. <div>
  317. <span>工号:</span>
  318. <span>{{service.serverInfo ? service.serverInfo.job_name : '001'}}</span>
  319. </div>
  320. <div>
  321. <span>性别:</span>
  322. <span>保密</span>
  323. </div>
  324. <div>
  325. <span>职务:</span>
  326. <span>咨询客服</span>
  327. </div>
  328. </div>
  329. <div class="headPortrait">
  330. <img :src="service.serverInfo?(url+service.serverInfo.avatar):require('@/assets/st-img/kf.png')"
  331. alt="">
  332. </div>
  333. </el-col>
  334. <el-col class="autograph pd20">
  335. <div>
  336. <span>个性签名:</span>
  337. <span>{{service.serverInfo ? service.serverInfo.signature :'' }}</span>
  338. </div>
  339. </el-col>
  340. <el-col class="advent" v-for="imgs in advert" :key="imgs.id">
  341. <a :href="'http://'+imgs.advertisement_url" target="_blank" rel="noopener noreferrer">
  342. <img :src="url + imgs.advertisement_img" alt="">
  343. </a>
  344. </el-col>
  345. </el-row>
  346. </el-aside>
  347. </div>
  348. <!-- 评价框 -->
  349. <el-card class="box-card" v-if="evlShow">
  350. <!-- <div class="close" @click="closeEvl(10)"> -->
  351. <!-- <i></i> -->
  352. <!-- </div> -->
  353. <div class="tit">
  354. <span>感谢您的咨询,请对我们的服务做出评价</span>
  355. </div>
  356. <div class="selIcon row allAlignment">
  357. <div @click="chage(1)">
  358. <i :class="changeIcon == 10? '':'sfd'"></i>
  359. <span>满意</span>
  360. </div>
  361. <div @click="chage(2)">
  362. <i class="comm" :class="changeIcon == 100?'comm2':''"></i>
  363. <span>一般</span>
  364. </div>
  365. <div @click="chage(3)">
  366. <i class="notSfd" :class="changeIcon == 1000?'notSfd2':''"></i>
  367. <span>不满意</span>
  368. </div>
  369. </div>
  370. <div class="levMsg">
  371. <el-input type="textarea" rows="6" placeholder="评价备注" v-model="textarea">
  372. </el-input>
  373. </div>
  374. <div class="sure" @click="evaluateSure()">
  375. <span>确定</span>
  376. </div>
  377. </el-card>
  378. <div class="zzBox" v-if="zzShow"></div>
  379. </div>
  380. </div>
  381. </template>
  382. <script>
  383. import '../css/index.css';
  384. import frce from '../assets/frce.js';
  385. export default {
  386. data() {
  387. return {
  388. textarea: '',//备注
  389. evlShow: false, // 评价框显示
  390. zzShow: false, // 遮罩层显示
  391. vertion: '',//图形验证码
  392. provShow: true, // 验证框显示
  393. changeIcon: 10,
  394. name: '', // 验证框姓名model
  395. phone: '',// 验证框电话model
  396. email: '',// 验证框邮箱model
  397. frceArr: [], //表情包代码
  398. information: '',//发送的文本信息
  399. sendCol: false, // 发送按钮切换样式
  400. selType: false, //图标选中样式 true为选中,false为未选中
  401. selNum: 0, // 自增当达到某个条件显示图片
  402. // syType : false,
  403. // sqType : false,
  404. error: false,
  405. emlError: false,
  406. artAndLeave: 0, // 默认为100,转人工为10,人工不在转留言为100
  407. chatCont: [], // 客户会话数据
  408. imageUrl: [],//上传图片
  409. img: '', //上传的单个图片路径
  410. dialogVisible: false, //图片放大
  411. dialogImageUrl: '', // 放大的图片
  412. dialogUrl: false,
  413. serviceInfor: '', //客服信息
  414. websock: null, //会话初始值
  415. currTime: "", //获取系统时间
  416. apiToken: '',//系统Token
  417. machine: '', //机器会话信息
  418. advert: '', // 广告语
  419. problem: '', //机器智能问题
  420. macNotPro: false, //机器人问题无法解决显示
  421. answer: [], //解答问题的答案
  422. questionShow: true, // 问题显示
  423. consult: false, //评价模块显示
  424. type: 1001, //自增
  425. jumpArtl: false, // 跳转人工客服状态
  426. group: '', //客服组
  427. userConversation: {}, //用户当前会话
  428. machineAndAtl: 10, //默认为机器人,100为人工
  429. satisfaction: 1, //评价满意度,1为满意,2为一般,3为不满意
  430. url: 'http://kfadmin.bocai186.com', // 域名地址
  431. //url :'http://192.168.2.186:8090', // 域名地址
  432. user_info: '', // 用户信息
  433. // 人工客服信息
  434. service: '',
  435. serviceList: [], //后台推送的人工客服列表
  436. customerWelCome: '', // 客服欢迎语
  437. customerSviceChat: [], // 客服会话信息
  438. serviceImg: '',
  439. timerVote: '', //存储上一次时间
  440. curtTimer: '',//当前时间
  441. returnTimer: '',//返回当前时间
  442. // isConnection:true,//人工分组列表开关
  443. chatNum: '', // 会话数量
  444. comtSuccess: false, // 评论发送成功显示
  445. comtCount: '', // 评论成功返回的满意度
  446. retractShow: true, // 展开侧边栏
  447. sensitive: [], //敏感词1
  448. senType: false,//敏感词状态
  449. sensitiveNumber: 0,//敏感词次数
  450. doubSensitive: [],//重复的敏感词
  451. senInfo: '', //敏感词数据
  452. // sensitiveWordsNumber:0,
  453. hourse: '', //返回时间,小时
  454. closeByServer: false, //客服关闭会话
  455. serverNotOnlin: false, //客服掉线
  456. willOverTime: '', //超时关闭会话
  457. allLoading: true, //整个页面加载中
  458. webTime: '',//网络时间
  459. /*****************websockt心跳变量*******************/
  460. reconnectData: null,
  461. lockReconnect: false, //避免重复连接,因为onerror之后会立即触发 onclose
  462. timeout: 10000, //10s一次心跳检测
  463. timeoutObj: null,
  464. serverTimeoutObj: null,
  465. }
  466. },
  467. methods: {
  468. /******************文字信息转表情******************/
  469. turnFace(data) {
  470. let str = data.match(/\#\[.*?\]\//g);
  471. let arr = Array.from(new Set(str));
  472. arr.forEach(e => {
  473. let imgsrc = '';
  474. for (let i = 0; i < this.frceArr.length; i++) {
  475. let expText = e.slice(1, e.length - 1);
  476. if (expText == this.frceArr[i]) {
  477. imgsrc = '<img class="hover" src="' + require(`@/assets/st-img/${i}.gif`) + '"/>'
  478. break;
  479. }
  480. }
  481. data = data.replace(new RegExp(`\\#\\[${e.substring(2, e.length - 2)}\\]\\/`, 'g'), imgsrc);
  482. })
  483. return data;
  484. },
  485. // 关闭加载中
  486. allLoadingClose() {
  487. this.allLoading = false;
  488. },
  489. /**************切换显示客服信息**************** */
  490. retract() {
  491. this.retractShow = !this.retractShow;
  492. },
  493. /***************发送图片***************/
  494. beforeAvatarUpload(file) {
  495. let self = this
  496. const isJPG = file.type == 'image/jpeg' || 'image/jpg' || 'image/png' || 'image/svg';
  497. const isLt2M = file.size / 1024 / 1024 < 2;
  498. if (!isJPG) {
  499. this.$message.error('上传只能是图片格式!');
  500. }
  501. if (!isLt2M) {
  502. this.$message.error('上传图片大小不能超过 2MB!');
  503. }
  504. //对图片进行压缩
  505. const imgSize = file.size / 1024 / 1024;
  506. if (imgSize > 0.5) {
  507. const _this = this
  508. return new Promise(resolve => {
  509. const reader = new FileReader()
  510. const image = new Image()
  511. image.onload = (imageEvent) => {
  512. const canvas = document.createElement('canvas');
  513. const context = canvas.getContext('2d');
  514. const width = image.width * 0.4;
  515. const height = image.height * 0.4;
  516. canvas.width = width;
  517. canvas.height = height;
  518. context.clearRect(0, 0, width, height);
  519. context.drawImage(image, 0, 0, width, height);
  520. const dataUrl = canvas.toDataURL(file.type);
  521. const blobData = _this.dataURItoBlob(dataUrl, file.type);
  522. resolve(blobData)
  523. }
  524. reader.onload = (e => {
  525. image.src = e.target.result;
  526. });
  527. reader.readAsDataURL(file);
  528. })
  529. }
  530. },
  531. dataURItoBlob(dataURI, type) {
  532. var binary = atob(dataURI.split(',')[1]);
  533. var array = [];
  534. for (var i = 0; i < binary.length; i++) {
  535. array.push(binary.charCodeAt(i));
  536. }
  537. return new Blob([new Uint8Array(array)], {type: type});
  538. },
  539. handError(err, file, fileList) {
  540. // 获取当前发送时间
  541. },
  542. /***************传输成功之后返回图片*************** */
  543. handleAvatarSuccess(res, file) {
  544. // console.log(res)
  545. this.dialogUrl = true;
  546. this.img = res.data.src;
  547. this.sendMessage();
  548. },
  549. /***************图片放大*************** */
  550. handlePictureCardPreview(url) {
  551. this.dialogImageUrl = url;
  552. this.dialogVisible = true;
  553. },
  554. /***************弹出评价框*************** */
  555. ejectEvl(type) {
  556. if (this.comtSuccess) return;
  557. this.changeIcon = 10;
  558. if (type == 10) {
  559. this.evlShow = true
  560. }
  561. this.zzShow = true;
  562. },
  563. /***************传入父组件进行组件切换*************** */
  564. leaveMsg() {
  565. this.$emit('value', 100)
  566. },
  567. //回到初始页面
  568. goBack() {
  569. this.artAndLeave = 0;
  570. this.machineAndAtl = 10;
  571. this.macNotPro = false;
  572. this.jumpArtl = false;
  573. this.time = '';
  574. this.returnTimer = '';
  575. // this.automaticRolling();
  576. this.initWebSocket();
  577. this.chatCont = [];
  578. this.customerSviceChat = [];
  579. this.reconnect();
  580. //this.questionShow = true;
  581. },
  582. /*******发送消息按钮*******/
  583. sendInfo() {
  584. this.closeByServer = false;
  585. this.artAndLeave = 0;
  586. this.jumpArtl = false;
  587. this.dialogUrl = false;
  588. this.sendMessage();
  589. },
  590. /***************改变评价框的满意度*************** */
  591. chage(type) {
  592. this.satisfaction = type;
  593. if (type == 1) {
  594. this.comtCount = '满意'
  595. this.changeIcon = 10;
  596. } else if (type == 2) {
  597. this.comtCount = '一般'
  598. this.changeIcon = 100;
  599. } else {
  600. this.comtCount = '不满意'
  601. this.changeIcon = 1000;
  602. }
  603. },
  604. /***************图标样式切换*************** */
  605. select(type) {
  606. if (type == 1) {
  607. this.selType = !this.selType;
  608. } else if (type == 2) {
  609. this.syType = !this.syType;
  610. } else {
  611. this.sqType = !this.sqType;
  612. }
  613. },
  614. /***************评价确认*************** */
  615. evaluateSure() {
  616. // 参数
  617. let params = {
  618. 'evaluateId': this.satisfaction,
  619. 'conversationId': this.service.conversationId,
  620. 'evaluateContent': this.textarea
  621. }
  622. this.$axios.get('/api/index/evaluate/putEvaluate', {
  623. params,
  624. headers: {
  625. 'Content-Type': 'application/x-www-form-urlencoded',
  626. 'apiToken': this.setApiToken('putevaluate', 'evaluate', this.currTime, 'index')
  627. }
  628. }).then(res => {
  629. if (res.data.code == 1) {
  630. this.evlShow = false;
  631. this.zzShow = false;
  632. this.textarea = '';
  633. this.comtSuccess = true;
  634. if (this.changeIcon == 10) {
  635. this.comtCount = '满意'
  636. }
  637. }
  638. })
  639. },
  640. /***************验证框确认*************** */
  641. yySure() {
  642. this.provShow = false;
  643. this.zzShow = false;
  644. },
  645. /***************转人工客服列表*************** */
  646. changeService() {
  647. // if(!this.isConnection) return
  648. this.$axios.post('/api/index/groups/index', {}, {
  649. headers: {
  650. 'Content-Type': 'application/x-www-form-urlencoded',
  651. 'apiToken': this.setApiToken('index', 'groups', this.currTime, 'index')
  652. }
  653. }).then(res => {
  654. if (res.data.code == 1) {
  655. this.serviceList = res.data.data;
  656. this.chatCont.push({
  657. 'type': 'artService'
  658. })
  659. this.automaticRolling();
  660. }
  661. })
  662. // this.isConnection = false;
  663. },
  664. /***************表情点击*************** */
  665. memeImg(i) {
  666. //当表情被点击
  667. this.information = this.information + "#" + this.frceArr[i] + "/";
  668. },
  669. /***************失去焦点做正则验证*************** */
  670. sureInfor(type) {
  671. if (type == 1) {
  672. if (!/^1[34578]\d{9}$/.test(this.phone)) {
  673. this.error = true;
  674. this.phone = '';
  675. } else {
  676. this.error = false;
  677. }
  678. } else if (type == 10) {
  679. if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) {
  680. this.emlError = true;
  681. this.email = '';
  682. } else {
  683. this.emlError = false;
  684. }
  685. }
  686. },
  687. /***************获取热点智能问题*************** */
  688. getProblem() {
  689. this.$axios.post('/api/index/robot/index', {groups_id: 1, robotgroups_id: 1}, {
  690. headers: {
  691. 'Content-Type': 'application/x-www-form-urlencoded',
  692. 'apiToken': this.setApiToken('index', 'robot', this.currTime, 'index')
  693. }
  694. }).then(res => {
  695. if (res.data.code == 1) {
  696. this.problem = res.data.data
  697. }
  698. })
  699. },
  700. /*****************获取聊天次数*******************/
  701. getChatNum() {
  702. this.$axios.post('/api/index/evaluate/minRound', '', {
  703. headers: {
  704. 'Content-Type': 'application/x-www-form-urlencoded',
  705. 'apiToken': this.setApiToken('minround', 'evaluate', this.currTime, 'index')
  706. }
  707. }).then(res => {
  708. if (res.data.code == 1) {
  709. this.chatNum = res.data.data.systemconfig_data
  710. }
  711. })
  712. },
  713. /*****************屏蔽关键字******************/
  714. shieldingKeyword(data) {
  715. //将敏感词组用|转换字符串
  716. let snstive = this.sensitive.join('|');
  717. //console.log(snstive);
  718. this.sensitiveNumber = 0;
  719. //匹配出会话中的敏感词
  720. return data.replace(eval('/' + snstive + '/g'), (res) => {
  721. var str = '';
  722. for (var i = 0; i < res.length; i++) {
  723. str += '*';
  724. }
  725. this.sensitiveNumber++;
  726. return str;
  727. })
  728. },
  729. /*---------------------------------------------------------------------------------*/
  730. /**************初始化WebSocket****************/
  731. initWebSocket() {
  732. let _this = this;
  733. let apiToken = this.$md5.hex_md5('customer-service' + this.currTime + window.location.origin);
  734. this.websock = new WebSocket('ws://103.108.43.176:9101?apiToken=' + apiToken);
  735. //this.websock = new WebSocket('ws://192.168.2.186:9101?apiToken=' + apiToken);
  736. // 数据接收
  737. this.websock.onmessage = this.websocketonmessage;
  738. // 连接建立之后
  739. this.websock.onopen = this.websocketonopen;
  740. // 连接建立失败重连
  741. this.websock.onerror = this.websocketonerror;
  742. // 关闭会话
  743. this.websock.onclose = this.websocketonclose;
  744. },
  745. /****************连接建立成功***************/
  746. websocketonopen() {
  747. console.log('链接成功');
  748. //心跳检测
  749. this.heatBeat()
  750. },
  751. /*************连接建立失败重连***************** */
  752. websocketonerror() {
  753. console.log('连接建立失败重连');
  754. this.goBack();
  755. },
  756. /**************数据接收***************** */
  757. websocketonmessage(e) {
  758. const redata = JSON.parse(e.data);
  759. //心跳检测
  760. this.heatBeat()
  761. console.log(redata)
  762. // 欢迎语
  763. if (redata.message_type == 'helloMessage') {
  764. this.machine = redata.data;
  765. }
  766. // 广告语
  767. if (redata.message_type == 'advertisement') {
  768. this.advert = redata.data;
  769. }
  770. // 评价
  771. if (redata.message_type == 'getEvaluate') {
  772. this.consult = true;
  773. }
  774. //返回的会话时间
  775. if (redata.message_type == 'webTime') {
  776. //处理会话时间大于两分钟显示会话时间并且储存本次会话时间
  777. if (this.machineAndAtl == 100) {
  778. let num = this.customerSviceChat.length - 1;
  779. if (this.customerSviceChat[num].type == "user") {
  780. if (redata.data.webTime.split(":")[1] - this.webTime.split(":")[1] > 2) {
  781. this.$set(this.customerSviceChat[num], 'time', redata.data.webTime);
  782. this.webTime = redata.data.webTime;
  783. } else {
  784. this.$set(this.customerSviceChat[num], 'time', '');
  785. }
  786. }
  787. }
  788. }
  789. //会话超时提示
  790. if (redata.message_type == 'overtime') {
  791. console.log('接收会话超时');
  792. }
  793. // 链接客服信息
  794. if (redata.message_type == 'connect') {
  795. this.artAndLeave = 10;
  796. this.machineAndAtl = 100;
  797. this.service = redata.data;
  798. console.log(this.service, '============客服信息')
  799. this.serviceImg = redata.data.serverInfo.avatar;
  800. }
  801. // 暂无客服
  802. if (redata.message_type == 'wait') {
  803. let content = JSON.parse(redata.data.content)
  804. this.artAndLeave = 100;
  805. }
  806. //接收客服会话
  807. if (redata.message_type == 'chatMessage') {
  808. //存储会话超时间
  809. this.webTime = redata.data.time;
  810. //会话大于两分钟显示
  811. let timer = ''
  812. if (this.returnTimer == '') {
  813. timer = redata.data.time;
  814. this.returnTimer = redata.data.time
  815. } else {
  816. let timeStamp = this.returnTimer.split(":");
  817. let rdtime = redata.data.time.split(":");
  818. if (timeStamp[0] == rdtime[0]) {
  819. if ((rdtime[1] - timeStamp[1]) < 2) {
  820. timer = ''
  821. } else {
  822. timer = redata.data.time;
  823. }
  824. }
  825. }
  826. //
  827. let contType = this.isJSON(redata.data.content);
  828. let content = {};
  829. if (contType == false) {
  830. content.text = redata.data.content
  831. } else {
  832. content = JSON.parse(redata.data.content)
  833. }
  834. let obj = {
  835. time: timer,
  836. content: content.text ? this.turnFace(content.text) : '',
  837. imgUrl: content.img ? content.img : '',
  838. type: 'service'
  839. }
  840. this.customerSviceChat.push(obj);
  841. // console.log(this.customerSviceChat);
  842. this.selNum++;
  843. this.automaticRolling();
  844. }
  845. //接收机器会话
  846. if (redata.message_type == 'robotMessage') {
  847. if (redata.data.content == 'error') {
  848. let _this = this;
  849. this.chatCont.push({type: 1001})
  850. this.automaticRolling();
  851. } else {
  852. this.chatCont.push({
  853. 'robot_content': redata.data.content,
  854. 'type': 'machine'
  855. })
  856. this.automaticRolling();
  857. }
  858. let num = this.chatCont.length - 2;
  859. if (this.webTime) {
  860. if (redata.data.time.split(":")[1] - this.webTime.split(":")[1] > 2) {
  861. this.$set(this.chatCont[num], 'time', redata.data.time);
  862. this.webTime = redata.data.time;
  863. } else {
  864. this.$set(this.chatCont[num], 'time', '');
  865. }
  866. } else {
  867. this.webTime = redata.data.time;
  868. this.$set(this.chatCont[num], 'time', redata.data.time);
  869. }
  870. }
  871. // 没有客服上线.
  872. if (redata.message_type == 'notice') {
  873. this.artAndLeave = 100;
  874. this.automaticRolling();
  875. this.machineAndAtl = 10;
  876. this.jumpArtl = false;
  877. this.initWebSocket();
  878. //this.noServer();
  879. }
  880. // 客服关闭会话.
  881. if (redata.message_type == 'closeBysever') {
  882. this.goBack();
  883. // this.closeByServer = true;
  884. // this.automaticRolling();
  885. }
  886. // 客服掉线.
  887. if (redata.message_type == 'serviceoffline') {
  888. this.serverNotOnlin = true;
  889. this.closeByServer = true;
  890. this.automaticRolling();
  891. }
  892. // 超时.
  893. if (redata.message_type == 'overtime') {
  894. this.willOverTime = redata.data.content;
  895. this.automaticRolling();
  896. }
  897. },
  898. /************关闭会话*******************/
  899. websocketonclose(e) {
  900. console.log('断开会话', e);
  901. this.goBack();
  902. },
  903. /*************数据发送***************** */
  904. websocketsend(data) {
  905. this.websock.send(data);
  906. },
  907. /***************************************/
  908. //socket重连
  909. reconnect() {
  910. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  911. return
  912. }
  913. this.lockReconnect = true;
  914. this.reconnectData && clearTimeout(this.reconnectData);
  915. this.reconnectData = setTimeout(() => {
  916. this.initWebSocket();
  917. this.lockReconnect = false;
  918. }, 5000)
  919. },
  920. /*************************************/
  921. //心跳检测
  922. heatBeat() {
  923. this.timeoutObj && clearTimeout(this.timeoutObj);
  924. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  925. this.timeoutObj = setTimeout(() => {
  926. console.log('发送', {type: 'ping'});
  927. this.websocketsend(JSON.stringify({type: 'ping'})) //根据后台要求发送
  928. this.serverTimeoutObj = setTimeout(() => {
  929. this.websock.close(); //如果 5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  930. }, 5000);
  931. }, this.timeout)
  932. },
  933. /******************消息发送数据处理********************/
  934. sendMessage() {
  935. // 给机器人发送文本消息
  936. if (this.machineAndAtl == 10) {
  937. //给机器人发送文本消息-本地储存
  938. let datas = {
  939. time: '',
  940. chat: this.turnFace(this.shieldingKeyword(this.information)),
  941. imgUrl: this.img,
  942. type: 'user'
  943. }
  944. this.chatCont.push(datas)
  945. //消息发送-机器人
  946. this.websocketsend(JSON.stringify({
  947. type: 'toRobot',
  948. data: {
  949. groups_id: '1',
  950. robot_name: this.shieldingKeyword(this.information),
  951. webTime: this.webTime,
  952. robotgroups_id: '1',
  953. }
  954. }))
  955. } else if (this.machineAndAtl == 100) { //人工聊天
  956. //发送给客服消息-本地储存
  957. this.customerSviceChat.push({
  958. time: '',
  959. content: this.turnFace(this.shieldingKeyword(this.information)),
  960. imgUrl: this.img,
  961. type: 'user',
  962. });
  963. //消息发送-客服
  964. this.websocketsend(JSON.stringify({
  965. type: 'chatMessage',
  966. data: {
  967. from_name: this.user_info.name,
  968. from_avatar: this.user_info.avatar,
  969. from_id: this.user_info.id,
  970. content: JSON.stringify({
  971. text: this.information,
  972. img: this.img,
  973. type: 'user'
  974. }),
  975. webTime: this.webTime,
  976. to_id: this.service.kf_id,
  977. to_name: this.service.kf_name,
  978. sensitiveNumber: this.sensitiveNumber,
  979. conversationId: this.service.conversationId
  980. }
  981. }))
  982. }
  983. // 发送之后清空发送数据
  984. this.img = '';
  985. this.information = '';
  986. //高度自动向上滑动
  987. this.automaticRolling();
  988. },
  989. /*************设置token加密***************** */
  990. setApiToken(name, controller, time, modules) {
  991. return this.$md5.hex_md5(name + 'customer-service' + controller + time + modules)
  992. },
  993. /*************跳转人工客服***************** */
  994. jumpService(id) {
  995. this.jumpArtl = true;
  996. this.closeByServer = false;
  997. this.group = id;
  998. //人工会话登陆
  999. let data = {
  1000. 'type': 'userInit',
  1001. data: {
  1002. 'uid': this.user_info.id,
  1003. 'name': this.user_info.name,
  1004. 'avatar': this.user_info.avatar,
  1005. 'group': this.group
  1006. }
  1007. }
  1008. this.websock.send(JSON.stringify(data));
  1009. },
  1010. /*************机器智能回答问题***************** */
  1011. answers(idx) {
  1012. let obj = {
  1013. 'robot_addTime': this.problem[idx].robot_addTime,
  1014. 'robot_content': this.problem[idx].robot_content,
  1015. 'type': 'machine'
  1016. }
  1017. this.information = this.problem[idx].robot_name
  1018. this.sendMessage();
  1019. this.automaticRolling();
  1020. },
  1021. /**************匿名注册**************** */
  1022. registered() {
  1023. let token = localStorage.getItem('token');
  1024. let data = {
  1025. token: token != null ? token : '',//
  1026. appid: this.$public.getQueryString('appid'),//
  1027. appuid: this.$public.getQueryString('appuid'),//
  1028. }
  1029. let obj = {
  1030. headers: {
  1031. "apiToken": this.setApiToken('autoreg', 'register', this.currTime, 'index')
  1032. }
  1033. }
  1034. this.$axios.post('/api/index/register/autoReg', data, obj).then(res => {
  1035. if (res.data.code == 1) {
  1036. this.user_info = res.data.data;
  1037. localStorage.setItem("token", res.data.data.token);
  1038. }
  1039. })
  1040. },
  1041. /***********聊天滑动的时候滑动滚动条到底部******************* */
  1042. automaticRolling() {
  1043. this.$nextTick(() => {
  1044. let msg = document.getElementById('main') // 获取对象
  1045. msg.scrollTop = msg.scrollHeight // 滚动高度
  1046. })
  1047. },
  1048. /**************获取敏感词**************** */
  1049. getSensitive() {
  1050. let obj = {
  1051. headers: {
  1052. 'Content-Type': 'application/x-www-form-urlencoded',
  1053. "apiToken": this.setApiToken('sensitivewords', 'index', this.currTime, 'index')
  1054. }
  1055. };
  1056. let data = {
  1057. userToken: ''
  1058. }
  1059. this.$axios.post('/api/index/index/sensitiveWords', '', obj).then(res => {
  1060. if (res.data.code == 1) {
  1061. console.log(res.data.data);
  1062. res.data.data.userSensitive.forEach(res => {
  1063. this.sensitive.push(res.sensitivewords_word)
  1064. })
  1065. }
  1066. })
  1067. },
  1068. /**********判定是否是JSON格式*********** */
  1069. isJSON(str) {
  1070. if (typeof str == 'string') {
  1071. try {
  1072. JSON.parse(str);
  1073. return true;
  1074. } catch (e) {
  1075. //console.log(e);
  1076. return false;
  1077. }
  1078. }
  1079. },
  1080. },
  1081. /**************页面加载中挂载**************** */
  1082. mounted() {
  1083. let self = this;
  1084. this.frceArr = frce.frce;
  1085. this.$axios.get('api/index/index/systime?t=' + new Date()).then(res => {
  1086. if (res.data.code == 1) {
  1087. // 获取系统时间
  1088. let date = res.data.data.time.split(" ");
  1089. date[0] = (new Date(date[0].replace(/-/g, '/')).getTime()) / 1000;
  1090. this.currTime = date[0];
  1091. this.hourse = date[1];
  1092. // 获取机器智能问题
  1093. this.getProblem();
  1094. // 匿名注册
  1095. this.registered();
  1096. setTimeout(() => {
  1097. //关闭加载条
  1098. this.allLoadingClose();
  1099. // 初始化websocket
  1100. this.initWebSocket();
  1101. }, 2000);
  1102. // 获取聊天次数
  1103. this.getChatNum();
  1104. // 获取敏感词
  1105. this.getSensitive();
  1106. }
  1107. })
  1108. },
  1109. // 组件挂载阶段
  1110. destroyed() {
  1111. this.websock.close() //离开路由之后断开websocket连接
  1112. },
  1113. computed: {
  1114. inforLeng() {
  1115. return this.information.length;
  1116. }
  1117. },
  1118. watch: {
  1119. inforLeng(val) {
  1120. if (val > 0) {
  1121. this.sendCol = true;
  1122. } else {
  1123. this.sendCol = false;
  1124. }
  1125. }
  1126. }
  1127. }
  1128. </script>
  1129. <style scoped>
  1130. .chatBox {
  1131. width: 700px;
  1132. position: relative;
  1133. }
  1134. .el-header {
  1135. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1136. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1137. }
  1138. .tit {
  1139. height: 100%;
  1140. line-height: 80px;
  1141. text-align: left;
  1142. padding-left: 20px;
  1143. }
  1144. .el-col span {
  1145. font-size: 18px;
  1146. color: #FFFFFF;
  1147. }
  1148. .imgBox {
  1149. text-align: right;
  1150. }
  1151. .imgBox img {
  1152. margin-right: 20px;
  1153. }
  1154. .imgBox img:nth-last-child(1) {
  1155. margin-right: 0
  1156. }
  1157. .el-main {
  1158. background: #fff;
  1159. width: 63%;
  1160. padding: 0;
  1161. }
  1162. .el-aside {
  1163. background: #F5F5F5;
  1164. width: 37%;
  1165. }
  1166. .cationer, .artificial {
  1167. display: flex;
  1168. justify-content: space-between;
  1169. /* align-items: center; */
  1170. }
  1171. .rt {
  1172. width: 100%;
  1173. box-sizing: inherit;
  1174. }
  1175. .artificial {
  1176. /* width: 150px; */
  1177. /* padding:0 20px; */
  1178. margin-top: 23px;
  1179. margin-bottom: 9px;
  1180. vertical-align: middle;
  1181. /* flex-direction: column;*/
  1182. }
  1183. .infor div {
  1184. margin-bottom: 3px;
  1185. }
  1186. .infor div span, .autograph span {
  1187. color: #999999;
  1188. font-size: 14px;
  1189. font-weight: 400;
  1190. }
  1191. .infor div span:nth-child(2), .autograph span:nth-child(2) {
  1192. color: #666666;
  1193. margin-left: 4px;
  1194. }
  1195. .headPortrait {
  1196. width: 46%;
  1197. height: 100px;
  1198. }
  1199. .headPortrait img {
  1200. width: 100%;
  1201. height: 100%;
  1202. }
  1203. .autograph {
  1204. margin-bottom: 11px;
  1205. }
  1206. .advent {
  1207. border-top: 1px solid #DDDDDD;
  1208. padding: 20px;
  1209. }
  1210. .advent img {
  1211. width: 100%;
  1212. height: 350px;
  1213. }
  1214. .pd {
  1215. padding: 20px;
  1216. }
  1217. .pd20 {
  1218. padding: 0 20px;
  1219. }
  1220. /* 会话 */
  1221. .conversationBox {
  1222. margin-top: 13px;
  1223. margin-bottom: 13px;
  1224. }
  1225. .timer {
  1226. text-align: center;
  1227. margin: 10px 0;
  1228. color: #999999;
  1229. font-size: 12px;
  1230. }
  1231. .headImg {
  1232. width: 40px;
  1233. height: 40px;
  1234. margin-right: 13px;
  1235. }
  1236. .headImg img {
  1237. display: inline-block;
  1238. width: 40px;
  1239. height: 40px;
  1240. }
  1241. .conversation .cont, .customer .cont {
  1242. background: #ffffff;
  1243. padding: 9px 8px 12px 10px;
  1244. display: inline-block;
  1245. border: 1px solid rgba(223, 223, 223, 1);
  1246. border-radius: 5px;
  1247. position: relative;
  1248. max-width: 270px;
  1249. }
  1250. .left::after {
  1251. position: absolute;
  1252. content: "";
  1253. display: inline-block;
  1254. left: -4px;
  1255. top: 5px;
  1256. width: 5px;
  1257. height: 9px;
  1258. background: #fff;
  1259. -webkit-transform: skewX(30deg);
  1260. transform: skewX(30deg);
  1261. /* z-index: -1; */
  1262. border-left: 1px solid #dfdfdf;
  1263. border-top: 1px solid #dfdfdf;
  1264. }
  1265. div.noafter::after {
  1266. content: '';
  1267. width: 0;
  1268. height: 0;;
  1269. display: inline;
  1270. position: relative;
  1271. border: 0;
  1272. }
  1273. .conversation .cont div, .customer .cont div {
  1274. color: #666666;
  1275. font-size: 16px;
  1276. }
  1277. .customer {
  1278. justify-content: space-between;
  1279. }
  1280. .customer .cont {
  1281. margin-right: 13px;
  1282. border: 0;
  1283. background: #5EA0F7;
  1284. max-width: 260px;
  1285. word-wrap: break-word;
  1286. word-break: normal;
  1287. }
  1288. .customer .cont div {
  1289. color: #FFFFFF;
  1290. }
  1291. .right::after {
  1292. position: absolute;
  1293. content: "";
  1294. display: inline-block;
  1295. right: -2px;
  1296. top: 6px;
  1297. width: 5px;
  1298. height: 9px;
  1299. background: #5ea0f7;
  1300. -webkit-transform: skewX(-30deg);
  1301. transform: skewX(-30deg);
  1302. border-left: 1px solid #5ea0f7;
  1303. border-top: 1px solid #5ea0f7;
  1304. }
  1305. .col {
  1306. color: #999999;
  1307. }
  1308. .change {
  1309. color: #5ea0f7;
  1310. }
  1311. .questionList, .changeService {
  1312. margin: 10px;
  1313. border: 1px solid rgba(223, 223, 223, 1);
  1314. border-radius: 5px;
  1315. }
  1316. .questionList div, .changeService div {
  1317. height: 40px;
  1318. line-height: 40px;
  1319. padding-left: 15px;
  1320. }
  1321. .questionList div span {
  1322. color: #5EA0F7;
  1323. font-size: 14px;
  1324. }
  1325. .questionList section:nth-child(odd), .changeService div:nth-child(odd) {
  1326. background: #F6F6F6;
  1327. }
  1328. .changeService div span {
  1329. font-size: 14px;
  1330. }
  1331. .changeService div span:nth-child(1) {
  1332. margin-right: 5px;
  1333. }
  1334. .col6 {
  1335. color: #666666 !important;
  1336. }
  1337. .colE5 {
  1338. color: #5EA0F7;
  1339. }
  1340. .promptBox {
  1341. display: flex;
  1342. justify-content: center;
  1343. height: 26px;
  1344. margin: 10px 0 10px;
  1345. /* line-height: 26px; */
  1346. }
  1347. .promptBoxH {
  1348. display: flex;
  1349. justify-content: center;
  1350. height: 50px;
  1351. margin: 10px 0 10px;
  1352. /* line-height: 26px; */
  1353. }
  1354. .prompt {
  1355. line-height: 25px;
  1356. text-align: center;
  1357. background: #DDDDDD;
  1358. border-radius: 30px;
  1359. width: 140px;
  1360. color: #FFFFFF;
  1361. font-size: 12px;
  1362. }
  1363. .help {
  1364. width: 260px;
  1365. }
  1366. .help .prompt {
  1367. width: 100%;
  1368. }
  1369. /* 评论 */
  1370. .evaluate {
  1371. height: 101px;
  1372. padding: 19px 0 16px;
  1373. background: rgba(255, 255, 255, 1);
  1374. border: 1px solid rgba(223, 223, 223, 1);
  1375. border-radius: 10px;
  1376. margin-top: 15px;
  1377. text-align: center;
  1378. position: relative;
  1379. box-sizing: border-box;
  1380. }
  1381. .evaluate span {
  1382. font-size: 14px;
  1383. color: #666666;
  1384. }
  1385. .nopd {
  1386. padding: 0;
  1387. }
  1388. .evaluate .btn {
  1389. display: block;
  1390. background: #F04992;
  1391. border-radius: 10px;
  1392. margin-top: 10px;
  1393. color: #FFFFFF;
  1394. height: 36px;
  1395. line-height: 36px;
  1396. width: 100px;
  1397. position: absolute;
  1398. bottom: 16px;
  1399. left: 35%;
  1400. cursor: pointer;
  1401. }
  1402. /* 聊天框 */
  1403. .chatting {
  1404. width: 100%;
  1405. background: rgba(255, 255, 255, 1);
  1406. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1407. height: 100px;
  1408. padding: 10px 20px;
  1409. }
  1410. .informationBox {
  1411. height: 500px;
  1412. overflow: auto;
  1413. }
  1414. .expression, .photo {
  1415. display: inline-block;
  1416. width: 18px;
  1417. height: 18px;
  1418. background: url("./../assets/st-img/expression.png") no-repeat;
  1419. background-size: 100% 100%;
  1420. cursor: pointer;
  1421. margin-right: 18px;
  1422. }
  1423. .expression:hover {
  1424. background: url("./../assets/st-img/expressionHover.png") no-repeat;
  1425. background-size: 100% 100%;
  1426. }
  1427. .photo {
  1428. background: url("./../assets/st-img/photo.png") no-repeat;
  1429. background-size: 100% 100%;
  1430. }
  1431. .photo:hover {
  1432. background: url("./../assets/st-img/photoHover.png") no-repeat;
  1433. background-size: 100% 100%;
  1434. }
  1435. textarea {
  1436. height: 30px;
  1437. width: 300px;
  1438. border: 0;
  1439. -webkit-user-select: auto;
  1440. user-select: auto;
  1441. -o-user-select: auto;
  1442. -ms-user-select: auto;
  1443. resize: none;
  1444. outline: none;
  1445. padding-top: 10px;
  1446. }
  1447. .sendOut {
  1448. width: 80px;
  1449. height: 44px;
  1450. line-height: 40px;
  1451. border: 1px solid rgba(221, 221, 221, 1);
  1452. border-radius: 5px;
  1453. text-align: center;
  1454. margin-left: 20px;
  1455. }
  1456. .sendOut span {
  1457. color: #CCCCCC;
  1458. font-size: 16px;
  1459. }
  1460. .chattingBox {
  1461. margin-top: 12px;
  1462. }
  1463. /* 评论弹框 */
  1464. .zzBox {
  1465. position: absolute;
  1466. width: 100%;
  1467. height: 100%;
  1468. background: rgba(0, 0, 0, 0.3)
  1469. }
  1470. .box-card, .proving {
  1471. width: 494px;
  1472. height: 429px;
  1473. position: absolute;
  1474. left: 50%;
  1475. top: 50%;
  1476. transform: translate(-50%, -50%);
  1477. z-index: 999;
  1478. border-radius: 10px;
  1479. padding: 20px 20px 30px 50px;
  1480. box-sizing: border-box;
  1481. }
  1482. .proving {
  1483. padding: 20px 20px 30px 47px;
  1484. }
  1485. /* .close{
  1486. text-align: right;
  1487. cursor: pointer;
  1488. } */
  1489. /* .close i{
  1490. display: inline-block;
  1491. width: 18px;
  1492. height: 18px;
  1493. background: url("./../assets/st-img/close.png") no-repeat;
  1494. background-size: 100% 100%;
  1495. } */
  1496. .box-card .tit {
  1497. text-align: center;
  1498. padding-right: 65px;
  1499. margin-bottom: 40px;
  1500. }
  1501. .box-card .tit span {
  1502. font-size: 18px;
  1503. color: #666666;
  1504. }
  1505. .selIcon {
  1506. padding-right: 30px;
  1507. margin-bottom: 30px;
  1508. }
  1509. .selIcon div {
  1510. text-align: center;
  1511. cursor: pointer;
  1512. }
  1513. .selIcon div i {
  1514. display: block;
  1515. width: 44px;
  1516. height: 44px;
  1517. background: url("./../assets/st-img/satisfied.png") no-repeat;
  1518. background-size: 100% 100%;
  1519. margin-bottom: 10px;
  1520. }
  1521. .selIcon div span {
  1522. /* display: block; */
  1523. }
  1524. .selIcon div .comm {
  1525. background: url("./../assets/st-img/comm2.png") no-repeat;
  1526. }
  1527. .selIcon div .sfd {
  1528. background: url("./../assets/st-img/Satisfied2.png") no-repeat;
  1529. }
  1530. .selIcon div .comm2 {
  1531. background: url("./../assets/st-img/comm.png") no-repeat;
  1532. }
  1533. .selIcon div .notSfd {
  1534. background: url("./../assets/st-img/notSatisfied2.png")
  1535. }
  1536. .selIcon div .notSfd2 {
  1537. background: url("./../assets/st-img/notSatisfied.png")
  1538. }
  1539. .levMsg {
  1540. padding-right: 30px;
  1541. margin-bottom: 20px;
  1542. }
  1543. .sure {
  1544. text-align: center;
  1545. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1546. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1547. border-radius: 10px;
  1548. width: 100px;
  1549. height: 48px;
  1550. line-height: 48px;
  1551. color: #fff;
  1552. position: absolute;
  1553. bottom: 30px;
  1554. left: 37%;
  1555. cursor: pointer;
  1556. }
  1557. /* 验证框 */
  1558. .logo {
  1559. text-align: center;
  1560. margin-bottom: 20px;
  1561. }
  1562. .logo span {
  1563. font-size: 38px;
  1564. font-weight: bold;
  1565. color: #5EA0F7;
  1566. font-family: Microsoft YaHei;
  1567. }
  1568. .logo span:nth-child(1) {
  1569. color: #F04992;
  1570. }
  1571. .formBox {
  1572. padding: 0 27px 0 0;
  1573. }
  1574. .formBox .el-input {
  1575. margin-bottom: 21px;
  1576. }
  1577. .formBox .phone .el-input, .formBox .email .el-input {
  1578. margin-bottom: 0;
  1579. }
  1580. .formBox .phone, .formBox .email {
  1581. margin-bottom: 10px;
  1582. }
  1583. .vertion {
  1584. vertical-align: middle;
  1585. /* margin-bottom: 28px; */
  1586. }
  1587. .vertion .el-input {
  1588. width: 250px;
  1589. margin-right: 15px;
  1590. display: inline-block;
  1591. }
  1592. .vertion span {
  1593. display: inline-block;
  1594. width: 128px;
  1595. height: 40px;;
  1596. vertical-align: middle;
  1597. background: rgba(241, 225, 224, 1);
  1598. }
  1599. .formBox .sure {
  1600. bottom: 21px;
  1601. }
  1602. .el-card__body .tit {
  1603. line-height: 25px;
  1604. }
  1605. .chatting .el-button {
  1606. border: none;
  1607. padding: 0;
  1608. border-radius: 0
  1609. }
  1610. .emoticon {
  1611. width: 30px;
  1612. height: 30px;
  1613. display: inline-block;
  1614. }
  1615. .pointer {
  1616. cursor: pointer;
  1617. }
  1618. .ly:hover {
  1619. border-bottom: 1px solid #5EA0F7;
  1620. /* 高亮效果 */
  1621. filter: brightness(0.9);
  1622. }
  1623. .gl:hover {
  1624. filter: brightness(0.9);
  1625. }
  1626. .seek:hover {
  1627. background: #860c60
  1628. }
  1629. .sendCol {
  1630. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1631. }
  1632. .netSendCol {
  1633. cursor: not-allowed;
  1634. }
  1635. /* 修改滚动条 */
  1636. ::-webkit-scrollbar-button {
  1637. background: transparent;
  1638. border: 0;
  1639. }
  1640. /* 顶部三个图标 */
  1641. .imgBox i {
  1642. display: inline-block;
  1643. width: 25px;
  1644. height: 25px;
  1645. margin-right: 20px;
  1646. background: url("./../assets/st-img/pj.png") no-repeat;
  1647. background-size: 100% 100%;
  1648. vertical-align: middle;
  1649. }
  1650. .imgBox .sy {
  1651. background: url("./../assets/st-img/sy.png") no-repeat;
  1652. }
  1653. .imgBox .sq {
  1654. background: url("./../assets/st-img/sq.png") no-repeat;
  1655. }
  1656. /* .sc:hover{
  1657. background: url("./../assets/st-img/pjhover.png") no-repeat;
  1658. }
  1659. .sy:hover{
  1660. background: url("./../assets/st-img/sy2.png")no-repeat;
  1661. }
  1662. .sq:hover{
  1663. background: url("./../assets/st-img/sq2.png") no-repeat;
  1664. } */
  1665. i.scActy {
  1666. background: #1654D1 url("./../assets/st-img/pjhover.png") no-repeat;
  1667. width: 33px;
  1668. height: 33px;
  1669. background-position: 5px;
  1670. }
  1671. /* .imgBox .syActy{
  1672. background:#1654D1 url("./../assets/st-img/jzsy.png") no-repeat;
  1673. width: 33px;
  1674. height: 33px;
  1675. background-position: 5px;
  1676. }
  1677. .imgBox .sqActy{
  1678. background: #1654D1 url("./../assets/st-img/sq2.png") no-repeat;
  1679. width: 33px;
  1680. height: 33px;
  1681. transform: rotate(180deg);
  1682. background-position: 5px;
  1683. } */
  1684. .tips {
  1685. font-size: 12px;
  1686. color: #F04992;
  1687. }
  1688. #main {
  1689. position: relative;
  1690. }
  1691. .retract {
  1692. position: absolute;
  1693. right: 0;
  1694. top: 290px;
  1695. z-index: 999;
  1696. }
  1697. /* 滚动条样式 */
  1698. .scroll::-webkit-scrollbar {
  1699. border: 5px solid #fff;
  1700. }
  1701. .scroll::-webkit-scrollbar {
  1702. width: 5px;
  1703. height: 20px;
  1704. }
  1705. .scroll::-webkit-scrollbar-button {
  1706. width: 0px;
  1707. height: 0px;
  1708. }
  1709. .scroll::-webkit-scrollbar-thumb {
  1710. border-radius: 5px;
  1711. box-shadow: inset 0 0 0 5px #aaa;
  1712. border: .02rem solid transparent;
  1713. }
  1714. .scroll::-webkit-scrollbar-track {
  1715. display: block;
  1716. background: rgba(0, 0, 0, 0.1);
  1717. }
  1718. </style>