chat.vue 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594
  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">
  8. <img id="logo" :src="url + logo" alt="">
  9. <span>智能客服</span>
  10. <span style="margin-left: 5px;"><img src="./../assets/st-img/on_icon.png" alt=""></span>
  11. </el-col>
  12. <el-col class="tit nopd" v-else-if="machineAndAtl == 100">
  13. <img id="logo" :src="url + logo" alt="">
  14. <span v-if="service">{{service.serverInfo.name}}</span>
  15. <span v-if="service_on" style="margin-left: 5px;"><img src="./../assets/st-img/on_icon.png"
  16. alt=""></span>
  17. <span v-if="!service_on" style="margin-left: 5px;"><img src="./../assets/st-img/off_icon.png"
  18. alt=""></span>
  19. </el-col>
  20. <el-col>
  21. <div class="imgBox">
  22. <!-- <el-button v-if="!service_on" size="mini" type="primary" @click="exit" style="margin-right: 10px;">退出聊天</el-button>-->
  23. <el-button v-if="machineAndAtl == 100" size="mini" type="primary" @click="exit"
  24. style="margin-right: 10px;">退出聊天
  25. </el-button>
  26. <i v-if="(selNum + tokNum) + hisLength > chatNum" @click="ejectEvl(10)" class="sc pointer"
  27. :class="selType?'scActy':''"></i>
  28. <div v-if="showleaveIcon" style="float: right" class="pointer" @click="leaveMsg()">
  29. <span style="font-size: 25px; color: #b3c1e7; vertical-align: middle;" @click="back()"
  30. class="el-icon-chat-line-round"></span>
  31. </div>
  32. <div v-if="!showleaveIcon" style="float: right; cursor: not-allowed">
  33. <span style="font-size: 25px; color: #d6d1c4; vertical-align: middle;"
  34. class="el-icon-chat-line-round"></span>
  35. </div>
  36. </div>
  37. </el-col>
  38. </el-row>
  39. </el-header>
  40. <div class="cationer">
  41. <!--****************************** 聊天会话框模块 *****************************-->
  42. <el-main>
  43. <!-- 广告展示隐藏按钮 -->
  44. <div class="retract pointer" @click="retract()">
  45. <img src="./../assets/st-img/retract.png" alt="" v-if="retractShow">
  46. <img src="./../assets/st-img/retract2.png" alt="" v-else>
  47. </div>
  48. <el-row class="pd informationBox scroll" id="main">
  49. <!-------------------机器人聊天板块 ----------------------->
  50. <div v-if="machineAndAtl == 10">
  51. <!--··············· 欢迎语 ············-->
  52. <div id="welcome" class="conversationBox">
  53. <div class="row" v-for="(item,index) in machine" :key="index">
  54. <div class="conversation row">
  55. <div class="headImg">
  56. <img src="./../assets/st-img/headAdvent.png" alt="">
  57. </div>
  58. <div class="cont left">
  59. <div v-html="item"></div>
  60. </div>
  61. </div>
  62. <div style="width:66px;"></div>
  63. </div>
  64. </div>
  65. <!--··········· 快捷问题回答模块 ············-->
  66. <div class="questionList" v-if="questionShow">
  67. <section v-for="(item,idx) in problem" :key="item.id">
  68. <div @click="answers(idx)">
  69. <span class="pointer gl">{{item.robot_name}}</span>
  70. </div>
  71. </section>
  72. <section>
  73. <div>
  74. <span class="col6">上面问题都不是</span>
  75. <span class="pointer ly" @click="changeService()">转人工客服</span>
  76. </div>
  77. </section>
  78. </div>
  79. <!--················ 和机器人会话发送消息 ·············-->
  80. <div v-for="item in chatCont" :key="item.id">
  81. <!-- 用户发文本信息 -->
  82. <div class="conversationBox" v-if="item.type =='user'">
  83. <div class="timer">{{item.time}}</div>
  84. <div class="customer row allAlignment">
  85. <div style="width:66px;"></div>
  86. <div class="row">
  87. <!-- 显示内容 -->
  88. <div v-if="item.chat" class="cont right">
  89. <div v-html="item.chat"></div>
  90. </div>
  91. <div v-else class=" right noafter" style="width:200px;margin-right:10px; ">
  92. <div slot="file">
  93. <img class="el-upload-list__item-thumbnail"
  94. @click="handlePictureCardPreview(url+item.imgUrl)"
  95. style="width:100%;height:auto;border-radius: 10px;"
  96. :src="url+item.imgUrl" alt="">
  97. </div>
  98. </div>
  99. <!-- 图片放大 -->
  100. <el-dialog :visible.sync="dialogVisible">
  101. <img width="100%" :src="dialogImageUrl" alt="">
  102. </el-dialog>
  103. <!-- 头像 -->
  104. <div class="headImg">
  105. <img :src="require('@/assets/st-img/timg.jpg') " alt="">
  106. </div>
  107. </div>
  108. </div>
  109. </div>
  110. <!-- 机器人无法回答转人工 -->
  111. <div class="conversationBox" v-if="item.type == 1001">
  112. <div class=" row">
  113. <div class="conversation row">
  114. <div class="headImg">
  115. <img src="./../assets/st-img/headAdvent.png" alt="">
  116. </div>
  117. <div class="cont left">
  118. <div>您的问题暂时无法处理</div>
  119. <div>
  120. <span class="col">问题没有解决?</span>
  121. <span class="change pointer ly"
  122. @click="changeService()">转人工客服</span>
  123. </div>
  124. </div>
  125. </div>
  126. <div style="width:66px;"></div>
  127. </div>
  128. </div>
  129. <!-- 机器人回答 -->
  130. <div class="conversationBox" v-else-if='item.type == "service"'>
  131. <div class="row">
  132. <div class="conversation row">
  133. <div class="headImg">
  134. <img src="./../assets/st-img/headAdvent.png" alt="">
  135. </div>
  136. <div class="cont left">
  137. <div>{{item.cont}}</div>
  138. </div>
  139. </div>
  140. <div style="width:66px;"></div>
  141. </div>
  142. </div>
  143. <!-- 快捷问题回答 -->
  144. <div class="conversationBox" v-else-if="item.type == 'machine'">
  145. <div class="timer">
  146. {{item.robot_addTime}}
  147. </div>
  148. <div class=" row">
  149. <div class="conversation row">
  150. <div class="headImg">
  151. <img src="./../assets/st-img/headAdvent.png" alt="">
  152. </div>
  153. <div class="cont left">
  154. <div>{{item.robot_content}}</div>
  155. <div>
  156. <span class="col">问题没有解决</span>
  157. <span class="change pointer ly"
  158. @click="changeService()">转人工客服</span>
  159. </div>
  160. </div>
  161. </div>
  162. <div style="width:66px;"></div>
  163. </div>
  164. </div>
  165. <!-- 转接客服列表 -->
  166. <div class="changeService" v-else-if="item.type == 'artService'">
  167. <div v-for="(itemList,idx) in serviceList" :key="idx">
  168. <span class="col6">人工客服:</span>
  169. <span class="colE5 pointer gl" @click="jumpService(itemList.id, itemList.name)">{{itemList.name}}</span>
  170. </div>
  171. </div>
  172. <div v-if="item.type == 'tips'">
  173. <div class="promptBox" v-if="item.str == 'resigtermsg'">
  174. <div class="prompt help">
  175. <span>本次会话已关闭,如需继续咨询请重新连接客服</span>
  176. </div>
  177. </div>
  178. </div>
  179. </div>
  180. <!--············· 各种消息提示框 ··············-->
  181. <!-- 客服不在线帮助提示框 -->
  182. <div class="promptBox" v-if="artAndLeave==100">
  183. <div class="prompt help">
  184. <span>{{jumpName + Onlinemsg}}</span>
  185. <span class="colE5 ly pointer" @click="leaveMsg()">留言</span>
  186. </div>
  187. </div>
  188. <!-- 客服会话超时 -->
  189. <!-- <div class="promptBox" v-if="resigtermsg">-->
  190. <!-- <div class="prompt help">-->
  191. <!-- <span>客服已经关闭会话,如需继续咨询请重新连接客服</span>-->
  192. <!-- </div>-->
  193. <!-- </div>-->
  194. <!-- 排队等待 -->
  195. <div class="evaluate" v-if="waitingMsg">
  196. <span>{{waitingText}}</span>
  197. <el-button type="primary" style="margin: 10px auto; display: block;"
  198. @click="closedWating">退出排队
  199. </el-button>
  200. </div>
  201. </div>
  202. <!--············ 和人工会话聊天模块 ··············-->
  203. <div v-if="machineAndAtl == 100">
  204. <!--历史消息-->
  205. <div v-for="(item,index) in hisSviceChat" :key="index">
  206. <!-- 客服信息 -->
  207. <div class="conversationBox" v-if="item.from_id.startsWith('KF')">
  208. <div class="timer">{{item.time_line | formatDate}}</div>
  209. <div class="row">
  210. <div class="conversation row">
  211. <div class="headImg">
  212. <img :src="serviceImg?url+serviceImg:require('@/assets/st-img/kf.png')"
  213. alt="">
  214. </div>
  215. <div class="cont left">
  216. <div v-if="item.content != ''" v-html="item.content.text"></div>
  217. <div v-if="item.content.img != ''" slot="file">
  218. <img class="el-upload-list__item-thumbnail"
  219. @click="handlePictureCardPreview(url+item.content.img)"
  220. style="width:100%;height:auto;border-radius: 10px;"
  221. :src="url+item.content.img" alt="">
  222. </div>
  223. </div>
  224. </div>
  225. <div style="width:66px;"></div>
  226. </div>
  227. </div>
  228. <!-- 用户信息 -->
  229. <div class="conversationBox" v-else>
  230. <div>
  231. <div class="timer">{{item.time_line | formatDate}}</div>
  232. <div class="customer row allAlignment">
  233. <div style="width:66px;"></div>
  234. <div class="row">
  235. <div class="cont right">
  236. <div v-if="item.content != ''" v-html="item.content.text"></div>
  237. <div v-if="item.content.img != ''" slot="file">
  238. <img class="el-upload-list__item-thumbnail"
  239. @click="handlePictureCardPreview(url+item.content.img)"
  240. style="width:100%;height:auto;border-radius: 10px;"
  241. :src="url+item.content.img" alt="">
  242. </div>
  243. </div>
  244. <div class="headImg">
  245. <img :src="require('@/assets/st-img/timg.jpg') " alt="">
  246. </div>
  247. </div>
  248. </div>
  249. </div>
  250. </div>
  251. </div>
  252. <!-- 人工客服回复消息 -->
  253. <div v-for="item in customerSviceChat" :key="item.id">
  254. <div class="conversationBox" v-if="item.type == 'service' ">
  255. <div class="timer" v-html="item.time"></div>
  256. <div class="row">
  257. <div class="conversation row">
  258. <div class="headImg">
  259. <img :src="serviceImg?url+serviceImg:require('@/assets/st-img/kf.png')"
  260. alt="">
  261. </div>
  262. <div class="cont left">
  263. <div v-if="item.content != ''" v-html="item.content"></div>
  264. <div v-else slot="file">
  265. <img class="el-upload-list__item-thumbnail"
  266. @click="handlePictureCardPreview(url+item.imgUrl)"
  267. style="width:100%;height:auto;border-radius: 10px;"
  268. :src="url+item.imgUrl" alt="">
  269. </div>
  270. </div>
  271. </div>
  272. <div style="width:66px;"></div>
  273. </div>
  274. </div>
  275. <!-- 用户发送文本消息 -->
  276. <div class="conversationBox" v-if="item.type == 'user' ">
  277. <div>
  278. <div class="timer">{{item.time}}</div>
  279. <div class="customer row allAlignment">
  280. <div style="width:66px;"></div>
  281. <div class="row">
  282. <div class="cont right">
  283. <div v-if="item.content != ''" v-html="item.content"></div>
  284. <div v-else slot="file">
  285. <img class="el-upload-list__item-thumbnail"
  286. @click="handlePictureCardPreview(url+item.imgUrl)"
  287. style="width:100%;height:auto;border-radius: 10px;"
  288. :src="url+item.imgUrl" alt="">
  289. </div>
  290. </div>
  291. <div class="headImg">
  292. <img :src="require('@/assets/st-img/timg.jpg') " alt="">
  293. </div>
  294. </div>
  295. </div>
  296. </div>
  297. </div>
  298. <div v-if="item.type == 'system' ">
  299. <!-- 客服会话转接 -->
  300. <div class="promptBox" v-if="item.str == 'changeKeFu'">
  301. <div class="prompt help">
  302. <span>会话转接成功</span>
  303. </div>
  304. </div>
  305. <!-- 历史会话 -->
  306. <div class="promptBox" v-if="item.str == 'historyMsg'">
  307. <div class="prompt help">
  308. <span>{{historyMsgtext}}</span>
  309. </div>
  310. </div>
  311. </div>
  312. <!-- 点击图片放大 -->
  313. <el-dialog :visible.sync="dialogVisible">
  314. <img width="100%" :src="dialogImageUrl" alt="">
  315. </el-dialog>
  316. </div>
  317. <!-- 评价 -->
  318. <div class="evaluate" @click="ejectEvl(10)" v-if="consult">
  319. <span>欢迎你的咨询,请对我们的服务做出评价</span>
  320. <span class="btn seek">评价</span>
  321. </div>
  322. <div class="promptBox" v-if="comtSuccess">
  323. <div class="prompt help">
  324. <span>您对我们的服务评价为: {{comtCount}}。非常感谢!</span>
  325. </div>
  326. </div>
  327. <!-- 客服会话超时 -->
  328. <div class="promptBox" v-if="willOverTime">
  329. <div class="prompt help">
  330. <span>{{overTimeMsg}}</span>
  331. </div>
  332. </div>
  333. </div>
  334. <!-- 发送消息音频提示 -->
  335. <audio id="send" src="../../static/send.wav"></audio>
  336. <!-- 接收消息音频提示 -->
  337. <audio id="receive" src="../../static/receive.wav"></audio>
  338. </el-row>
  339. <!--·········· 文本编辑框 ···········-->
  340. <el-row class="chatting">
  341. <el-col>
  342. <!-- 发送图和表情按钮 -->
  343. <div style="height:18px; display:flex;">
  344. <el-popover id="pop" placement="top-start" width="200" trigger="hover">
  345. <ul>
  346. <li class="emoticon" v-for="(item,index) in frceArr" :key="item.id">
  347. <img class="pointer" :src="require(`@/assets/st-img/${index}.gif`)"
  348. @click="memeImg(index)" alt="">
  349. </li>
  350. </ul>
  351. <el-button class="expression" slot="reference"></el-button>
  352. </el-popover>
  353. <el-upload class="avatar-uploader" action="/api/index/upload/uploadImg"
  354. :on-success="handleAvatarSuccess"
  355. :before-upload="beforeAvatarUpload"
  356. :on-error='handError'
  357. list-type='no' accept="image/jpeg,image/jpg,image/png,image/svg">
  358. <!-- <img v-if="imageUrl" :src="imageUrl" class="avatar"> -->
  359. <i slot="default" class=" photo"></i>
  360. </el-upload>
  361. </div>
  362. <div class="row center allAlignment chattingBox">
  363. <div style="width:300px;">
  364. <el-input
  365. type="textarea"
  366. maxlength="450"
  367. show-word-limit
  368. class="scroll"
  369. id="information"
  370. v-model.trim="information"
  371. autofocus
  372. placeholder="请输入你的问题:"
  373. @keyup.enter.native="listenEnter($event)">
  374. </el-input>
  375. </div>
  376. <div>
  377. <!-- 准备修改 -->
  378. <div @click="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?sendInfo():''):''"
  379. class="sendOut pointer"
  380. :class="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?'sendCol':'netSendCol'):'netSendCol'">
  381. <span class="">发送</span>
  382. </div>
  383. </div>
  384. </div>
  385. </el-col>
  386. </el-row>
  387. </el-main>
  388. <el-aside width='255px' v-if="retractShow">
  389. <el-row class="rt">
  390. <div v-if="machineAndAtl == 10">
  391. <el-col :span='24' class="artificial pd20">
  392. <div class="infor">
  393. <div>
  394. <span>姓名:</span>
  395. <span>智能客服</span>
  396. </div>
  397. <div>
  398. <span>工号:</span>
  399. <span>001</span>
  400. </div>
  401. <div>
  402. <span>性别:</span>
  403. <span>保密</span>
  404. </div>
  405. <div>
  406. <span>职务:</span>
  407. <span>咨询客服</span>
  408. </div>
  409. </div>
  410. <div class="headPortrait">
  411. <img :src="require('@/assets/st-img/headPortrait.png')" alt="">
  412. </div>
  413. </el-col>
  414. <el-col class="autograph pd20">
  415. <div>
  416. <span>个性签名:</span>
  417. <span></span>
  418. </div>
  419. </el-col>
  420. </div>
  421. <div v-if="machineAndAtl == 100">
  422. <el-col :span='24' class="artificial pd20">
  423. <div class="infor">
  424. <div>
  425. <span>姓名:</span>
  426. <span v-if="service.serverInfo"
  427. :title="service.serverInfo.name ? service.serverInfo.name : '001客服' ">{{ service.serverInfo.name ? service.serverInfo.name : '001客服' }}</span>
  428. </div>
  429. <div>
  430. <span>工号:</span>
  431. <span :title="service.serverInfo ? service.serverInfo.job_name : '001'">{{service.serverInfo ? service.serverInfo.job_name : '001'}}</span>
  432. </div>
  433. <div>
  434. <span>性别:</span>
  435. <span :title="service.serverInfo ? service.serverInfo.gender : '保密'">{{service.serverInfo ? service.serverInfo.gender : '保密'}}</span>
  436. </div>
  437. <div>
  438. <span>职务:</span>
  439. <span class="duty"
  440. :title="service.serverInfo ? service.serverInfo.groupname : '咨询客服'">{{service.serverInfo ? service.serverInfo.groupname : '咨询客服'}}</span>
  441. </div>
  442. </div>
  443. <div class="headPortrait">
  444. <img :src="service.serverInfo ? service.serverInfo.avatar ? (url+service.serverInfo.avatar) :require('@/assets/st-img/kf.png') : require('@/assets/st-img/kf.png')"
  445. alt="">
  446. </div>
  447. </el-col>
  448. <el-col class="autograph pd20">
  449. <div>
  450. <span>个性签名:</span>
  451. <span :title="service.serverInfo ? service.serverInfo.signature :'' ">{{service.serverInfo ? service.serverInfo.signature :'' }}</span>
  452. </div>
  453. </el-col>
  454. </div>
  455. <el-col class="advent" v-for="imgs in advert" :key="imgs.id">
  456. <a :href="'http://'+imgs.advertisement_url" target="_blank" rel="noopener noreferrer">
  457. <img :src="url + imgs.advertisement_img" alt="">
  458. </a>
  459. </el-col>
  460. </el-row>
  461. </el-aside>
  462. </div>
  463. <!-- 评价框 -->
  464. <el-card id="box_card" class="box-card" v-if="evlShow">
  465. <div class="close"><i @click="closeEvl()"></i></div>
  466. <div class="tit">
  467. <span>感谢您的咨询,请对我们的服务做出评价</span>
  468. </div>
  469. <div class="selIcon row allAlignment">
  470. <div @click="chage(1)">
  471. <i :class="changeIcon == 10? '':'sfd'"></i>
  472. <span>满意</span>
  473. </div>
  474. <div @click="chage(2)">
  475. <i class="comm" :class="changeIcon == 100?'comm2':''"></i>
  476. <span>一般</span>
  477. </div>
  478. <div @click="chage(3)">
  479. <i class="notSfd" :class="changeIcon == 1000?'notSfd2':''"></i>
  480. <span>不满意</span>
  481. </div>
  482. </div>
  483. <div class="sure" @click="evaluateSure()">
  484. <span>确定</span>
  485. </div>
  486. </el-card>
  487. <div class="zzBox" v-if="zzShow"></div>
  488. <el-dialog
  489. :close-on-click-modal="true"
  490. :close-on-press-escape="true"
  491. title="是否发送图片"
  492. :visible.sync="dialogPaste"
  493. width="35%">
  494. <el-image :src="pasteUrl" :fit="fit"></el-image>
  495. <span slot="footer" class="dialog-footer">
  496. <el-button @click="dialogPaste = false">取 消</el-button>
  497. <el-button type="primary" style="color: #333" @click="handleClose()">确 定</el-button>
  498. </span>
  499. </el-dialog>
  500. </div>
  501. </div>
  502. </template>
  503. <script>
  504. import '../css/index.css';
  505. import frce from '../assets/frce.js';
  506. import fk from '../assets/st-img/kf.png'
  507. export default {
  508. data() {
  509. return {
  510. textarea: '',//备注
  511. evlShow: false, // 评价框显示
  512. zzShow: false, // 遮罩层显示
  513. vertion: '',//图形验证码
  514. provShow: true, // 验证框显示
  515. changeIcon: 10,
  516. name: '', // 验证框姓名model
  517. phone: '',// 验证框电话model
  518. email: '',// 验证框邮箱model
  519. frceArr: [], //表情包代码
  520. information: '',//发送的文本信息
  521. sendCol: false, // 发送按钮切换样式
  522. selType: false, //图标选中样式 true为选中,false为未选中
  523. selNum: 0, // 服务端消息数量
  524. tokNum: 0, // 用户端消息数量
  525. // syType : false,
  526. // sqType : false,
  527. error: false,
  528. emlError: false,
  529. artAndLeave: 0, // 默认为100,转人工为10,人工不在转留言为100
  530. chatCont: [], // 机器人会话数据
  531. imageUrl: [],//上传图片
  532. img: '', //上传的单个图片路径
  533. dialogVisible: false, //图片放大
  534. dialogImageUrl: '', // 放大的图片
  535. dialogUrl: false,
  536. serviceInfor: '', //客服信息
  537. websock: null, //会话初始值
  538. // currTime: "", //获取系统时间
  539. apiToken: '',//系统Token
  540. machine: [], //机器会话信息
  541. advert: '', // 广告语
  542. problem: '', //机器智能问题
  543. macNotPro: false, //机器人问题无法解决显示
  544. answer: [], //解答问题的答案
  545. questionShow: true, // 问题显示
  546. consult: false, //评价模块显示
  547. type: 1001, //自增
  548. jumpArtl: false, // 跳转人工客服状态
  549. group: '', //客服组
  550. userConversation: {}, //用户当前会话
  551. machineAndAtl: 10, //默认为机器人,100为人工
  552. satisfaction: 1, //评价满意度,1为满意,2为一般,3为不满意
  553. url: 'http://kfadmin.bocai186.com', // 域名地址
  554. // url: 'http://192.168.2.187:8090', // 域名地址
  555. user_info: '', // 用户信息
  556. // 人工客服信息
  557. service: '',
  558. serviceList: [], //后台推送的人工客服列表
  559. customerWelCome: '', // 客服欢迎语
  560. customerSviceChat: [], // 客服会话信息
  561. hisSviceChat: [],
  562. serviceImg: '',
  563. timerVote: '', //存储上一次时间
  564. curtTimer: '',//当前时间
  565. returnTimer: '',//返回当前时间
  566. // isConnection:true,//人工分组列表开关
  567. chatNum: '', // 会话数量
  568. comtSuccess: false, // 评论发送成功显示
  569. comtCount: '', // 评论成功返回的满意度
  570. retractShow: true, // 展开侧边栏
  571. sensitive: [], //敏感词1
  572. senType: false,//敏感词状态
  573. sensitiveNumber: 0,//敏感词次数
  574. doubSensitive: [],//重复的敏感词
  575. senInfo: '', //敏感词数据
  576. hourse: '', //返回时间,小时
  577. closeByServer: false, //客服关闭会话
  578. serverNotOnlin: false, //客服掉线
  579. willOverTime: false, //超时关闭会话
  580. overTimeMsg: '', // 超时提示内容
  581. allLoading: true, //整个页面加载中
  582. webTime: '',//网络时间
  583. changeKeFu: false, //客服转接
  584. historyMsg: false, // 是否展示历史信息
  585. historyMsgtext: "", // 历史信息内容提示
  586. /*****************websockt心跳变量*******************/
  587. reconnectData: null,
  588. lockReconnect: false, //避免重复连接,因为onerror之后会立即触发 onclose
  589. timeout: 10000, //10s一次心跳检测
  590. timeoutObj: null,
  591. serverTimeoutObj: null,
  592. logo: '', // logo 图片
  593. Onlinemsg: "", // 系统留言信息
  594. showleaveIcon: true, // 留言按钮触发条件
  595. jumpName: '', // 根据类型提示售后服务名称
  596. waitingMsg: false, // 是否显示等待排队
  597. waitingText: "", // 等待内容
  598. service_on: true, // 现在状态
  599. avatarImg: fk,
  600. dialogPaste: false,
  601. pasteUrl: '',//截屏图片
  602. fit: 'contain', // 图片样式
  603. resigtermsg: false, //提示重连
  604. evaluateNum: false,
  605. jumps: false,
  606. customerTime: "",
  607. helloNum: true, // 欢迎语限制
  608. hisLength:0, // 历史数量
  609. }
  610. },
  611. filters: {
  612. /**
  613. * 时间戳转日期自定义时间格式
  614. * timeStamp:时间戳
  615. * custom:转换日期时定义年月日用是什么符号隔开
  616. * isDtae:0=月份、1=日期、3=时间
  617. */
  618. formatDate: function (value, custom = '', isDtae = 3) {
  619. let timeStamp = value;
  620. var date = new Date();
  621. date.setTime(timeStamp * 1000);
  622. var y = date.getFullYear();
  623. var m = date.getMonth() + 1;
  624. m = m < 10 ? ('0' + m) : m;
  625. var d = date.getDate();
  626. d = d < 10 ? ('0' + d) : d;
  627. var h = date.getHours();
  628. h = h < 10 ? ('0' + h) : h;
  629. var minute = date.getMinutes();
  630. var second = date.getSeconds();
  631. minute = minute < 10 ? ('0' + minute) : minute;
  632. second = second < 10 ? ('0' + second) : second;
  633. if (isDtae == 0) {
  634. return y + custom + m //+'student';
  635. } else if (isDtae == 1) {
  636. return y + custom + m + custom + d;
  637. } else if (isDtae == 3) {
  638. return h + ':' + minute;
  639. } else {
  640. return y + '-' + m + '-' + d + ' ' + h + ':' + minute //+ ':' + second;
  641. }
  642. }
  643. },
  644. methods: {
  645. /******************qq截图粘贴---获取剪切板数据*****************/
  646. getClipboardData(e) {
  647. // 添加到事件对象中的访问系统剪贴板的接口
  648. let clipboardData = e.clipboardData,
  649. i = 0,
  650. items, item, types;
  651. if (clipboardData) {
  652. items = clipboardData.items;
  653. if (!items) {
  654. return;
  655. }
  656. item = items[0];
  657. // 保存在剪贴板中的数据类型
  658. types = clipboardData.types || [];
  659. for (; i < types.length; i++) {
  660. if (types[i] === 'Files') {
  661. item = items[i];
  662. break;
  663. }
  664. }
  665. // 判断是否为图片数据
  666. if (item && item.kind === 'file' && item.type.match(/^image\//i)) {
  667. this.imgReader(item);
  668. }
  669. }
  670. },
  671. /**********qq截图粘贴---获取剪切板图片信息进行转换blob***********/
  672. imgReader(item) {
  673. let _this = this;
  674. var blob = item.getAsFile(), reader = new FileReader();
  675. // 读取文件后将其显示在网页中
  676. reader.onload = function (e) {
  677. var img = new Image();
  678. img.src = e.target.result;
  679. _this.dialogPaste = true;
  680. _this.pasteUrl = e.target.result;
  681. // console.log(img.src)
  682. //document.body.appendChild( img );
  683. };
  684. // 读取文件
  685. reader.readAsDataURL(blob);
  686. },
  687. /***qq截图粘贴************/
  688. paste() {
  689. document.getElementById('information').addEventListener('paste', this.getClipboardData)
  690. },
  691. /*****发送截图******/
  692. handleClose(done) {
  693. this.dialogPaste = false;
  694. let blob = this.$public.dataURItoBlob(this.pasteUrl)
  695. let self = this;
  696. var formData = new FormData();
  697. formData.append("file", blob);
  698. self.upImg(formData);
  699. },
  700. upImg(formData) {
  701. let self = this;
  702. // 数据结构请求
  703. this.$axios.post('/api/index/upload/uploadImg', formData).then(res => {
  704. // console.log(res.data.data)
  705. // console.log(res.data.data.src);
  706. let str = this.information;
  707. let formatStr = str.replace(/\n/g, '<br/>');
  708. if (res.data.code == 1) {
  709. let isFirst = true;
  710. let str = this.information;
  711. let formatStr = str.replace(/\n/g, '<br/>');
  712. // 给机器人发送文本消息
  713. if (this.machineAndAtl == 10) {
  714. //给机器人发送文本消息-本地储存
  715. let datas = {
  716. time: '',
  717. chat: this.turnFace(this.shieldingKeyword(formatStr)),
  718. imgUrl: res.data.data.src,
  719. type: 'user'
  720. }
  721. this.chatCont.push(datas)
  722. //消息发送-机器人
  723. this.websocketsend(JSON.stringify({
  724. type: 'toRobot',
  725. data: {
  726. groups_id: '1',
  727. robot_name: this.shieldingKeyword(formatStr),
  728. webTime: '',
  729. robotgroups_id: '1',
  730. }
  731. }))
  732. } else if (this.machineAndAtl == 100) { //人工聊天
  733. // 人工聊天超时隐藏
  734. this.willOverTime = false;
  735. //发送给客服消息-本地储存
  736. this.customerSviceChat.push({
  737. time: '',
  738. content: this.turnFace(this.shieldingKeyword(formatStr)),
  739. imgUrl: res.data.data.src,
  740. type: 'user',
  741. });
  742. //消息发送-客服
  743. this.websocketsend(JSON.stringify({
  744. type: 'chatMessage',
  745. data: {
  746. from_name: this.user_info.name,
  747. from_avatar: this.user_info.avatar,
  748. from_id: this.user_info.id,
  749. content: JSON.stringify({
  750. text: formatStr,
  751. img: res.data.data.src,
  752. type: 'user'
  753. }),
  754. webTime: '',
  755. to_id: this.service.kf_id,
  756. to_name: this.service.kf_name,
  757. sensitiveNumber: this.sensitiveNumber,
  758. conversationId: this.service.conversationId
  759. }
  760. }))
  761. this.tokNum++;
  762. }
  763. // 发送之后清空发送数据
  764. this.img = '';
  765. this.information = '';
  766. //高度自动向上滑动
  767. this.automaticRolling();
  768. }
  769. })
  770. },
  771. // 退出聊天
  772. exit() {
  773. this.websocketsend(JSON.stringify({
  774. type: 'kfCloseUser',
  775. data: {
  776. to_id: this.service.kf_id,
  777. kf_id: this.user_info.id,
  778. group_id: this.service.serverInfo.group,
  779. conversationId: this.service.conversationId,
  780. type: 6,
  781. }
  782. }))
  783. // this.goBack();
  784. this.machineAndAtl = 10;
  785. const loading = this.$loading({
  786. lock: true,
  787. text: '本次会话正在关闭',
  788. spinner: 'el-icon-loading',
  789. });
  790. setTimeout(() => {
  791. loading.close();
  792. }, 4000);
  793. },
  794. // 关闭评价框按钮
  795. closeEvl() {
  796. this.evlShow = false;
  797. this.zzShow = false;
  798. },
  799. // 消息发送
  800. sendAudio() {
  801. let send = document.getElementById('send')
  802. send.play()
  803. },
  804. // 消息接收
  805. receiveAudio() {
  806. let receive = document.getElementById('receive')
  807. receive.play();
  808. },
  809. // 回车提交
  810. listenEnter(event) {
  811. let text = document.getElementById('information');
  812. if (event.keyCode == 13 && event.ctrlKey == true) {
  813. text.value = text.value + '\n'
  814. } else if (event.keyCode == 13) {
  815. if (this.information == "") {
  816. text.value = '';
  817. return false
  818. } else {
  819. this.sendInfo();
  820. event.preventDefault()
  821. }
  822. }
  823. },
  824. // 切换留言板返回
  825. back() {
  826. document.getElementById('information').removeEventListener('paste', this.getClipboardData)
  827. this.$emit('value', 100)
  828. },
  829. /******************文字信息转表情******************/
  830. turnFace(data) {
  831. let str = data.match(/\#\[.*?\]\//g);
  832. let arr = Array.from(new Set(str));
  833. arr.forEach(e => {
  834. let imgsrc = '';
  835. for (let i = 0; i < this.frceArr.length; i++) {
  836. let expText = e.slice(1, e.length - 1);
  837. if (expText == this.frceArr[i]) {
  838. imgsrc = '<img class="hover" src="' + require(`@/assets/st-img/${i}.gif`) + '"/>'
  839. break;
  840. }
  841. }
  842. data = data.replace(new RegExp(`\\#\\[${e.substring(2, e.length - 2)}\\]\\/`, 'g'), imgsrc);
  843. })
  844. return data;
  845. },
  846. // 关闭加载中
  847. allLoadingClose() {
  848. this.allLoading = false;
  849. },
  850. /**************切换显示客服信息**************** */
  851. retract() {
  852. this.retractShow = !this.retractShow;
  853. },
  854. /***************发送图片***************/
  855. beforeAvatarUpload(file) {
  856. let self = this
  857. const isJPG = file.type == 'image/jpeg' || 'image/jpg' || 'image/png' || 'image/svg';
  858. const isLt2M = file.size / 1024 / 1024 < 2;
  859. if (!isJPG) {
  860. this.$message.error('上传只能是图片格式!');
  861. return false;
  862. }
  863. if (!isLt2M) {
  864. this.$message.error('上传图片大小不能超过 2MB!');
  865. return false;
  866. }
  867. //对图片进行压缩
  868. const imgSize = file.size / 1024 / 1024;
  869. if (imgSize > 0.5) {
  870. const _this = this
  871. return new Promise(resolve => {
  872. const reader = new FileReader()
  873. const image = new Image()
  874. image.onload = (imageEvent) => {
  875. const canvas = document.createElement('canvas');
  876. const context = canvas.getContext('2d');
  877. const width = image.width * 0.4;
  878. const height = image.height * 0.4;
  879. canvas.width = width;
  880. canvas.height = height;
  881. context.clearRect(0, 0, width, height);
  882. context.drawImage(image, 0, 0, width, height);
  883. const dataUrl = canvas.toDataURL(file.type);
  884. const blobData = _this.dataURItoBlob(dataUrl, file.type);
  885. resolve(blobData)
  886. }
  887. reader.onload = (e => {
  888. image.src = e.target.result;
  889. });
  890. reader.readAsDataURL(file);
  891. })
  892. }
  893. },
  894. dataURItoBlob(dataURI, type) {
  895. var binary = atob(dataURI.split(',')[1]);
  896. var array = [];
  897. for (var i = 0; i < binary.length; i++) {
  898. array.push(binary.charCodeAt(i));
  899. }
  900. return new Blob([new Uint8Array(array)], {type: type});
  901. },
  902. handError(err, file, fileList) {
  903. // 获取当前发送时间
  904. // console.log(err, '上传图片报错!')
  905. },
  906. /***************传输成功之后返回图片*************** */
  907. handleAvatarSuccess(res, file) {
  908. // console.log(res)
  909. this.dialogUrl = true;
  910. this.img = res.data.src;
  911. this.sendMessage();
  912. },
  913. /***************图片放大*************** */
  914. handlePictureCardPreview(url) {
  915. this.dialogImageUrl = url;
  916. this.dialogVisible = true;
  917. },
  918. /***************弹出评价框*************** */
  919. ejectEvl(type) {
  920. if (this.comtSuccess) return;
  921. this.changeIcon = 10;
  922. if (type == 10) {
  923. this.evlShow = true
  924. }
  925. this.zzShow = true;
  926. },
  927. /***************传入父组件进行组件切换*************** */
  928. leaveMsg() {
  929. this.$emit('value', 100)
  930. },
  931. //回到初始页面
  932. goBack(type) {
  933. if (type === 1) {
  934. this.artAndLeave = 0;
  935. this.chatCont = [];
  936. } else {
  937. this.closeByServer = true;
  938. this.machineAndAtl = 10;
  939. this.macNotPro = false;
  940. this.jumpArtl = false;
  941. this.willOverTime = false;
  942. this.waitingMsg = false;
  943. this.time = '';
  944. this.returnTimer = '';
  945. this.service_on = true;
  946. this.historyMsg = false,
  947. // this.automaticRolling();
  948. this.customerSviceChat = [];
  949. this.reconnect();
  950. this.selNum = 0;
  951. this.tokNum = 0;
  952. }
  953. },
  954. /*******发送消息按钮*******/
  955. sendInfo() {
  956. this.closeByServer = false;
  957. this.artAndLeave = 0;
  958. this.jumpArtl = false;
  959. this.dialogUrl = false;
  960. this.sendMessage();
  961. this.sendAudio();
  962. },
  963. /***************改变评价框的满意度*************** */
  964. chage(type) {
  965. this.satisfaction = type;
  966. if (type == 1) {
  967. this.comtCount = '满意'
  968. this.changeIcon = 10;
  969. } else if (type == 2) {
  970. this.comtCount = '一般'
  971. this.changeIcon = 100;
  972. } else {
  973. this.comtCount = '不满意'
  974. this.changeIcon = 1000;
  975. }
  976. },
  977. /***************图标样式切换*************** */
  978. select(type) {
  979. if (type == 1) {
  980. this.selType = !this.selType;
  981. } else if (type == 2) {
  982. this.syType = !this.syType;
  983. } else {
  984. this.sqType = !this.sqType;
  985. }
  986. },
  987. /***************评价确认*************** */
  988. evaluateSure() {
  989. this.websocketsend(JSON.stringify({
  990. type: 'evaluate',
  991. data: {
  992. evaluate_id: this.satisfaction,
  993. conversationId: this.service.conversationId,
  994. evaluate_content: this.textarea
  995. }
  996. }))
  997. this.evlShow = false;
  998. this.zzShow = false;
  999. this.textarea = '';
  1000. this.consult = false;
  1001. if (this.changeIcon == 10) {
  1002. this.comtCount = '满意'
  1003. }
  1004. },
  1005. /***************验证框确认*************** */
  1006. yySure() {
  1007. this.provShow = false;
  1008. this.zzShow = false;
  1009. },
  1010. /***************转人工客服列表*************** */
  1011. changeService() {
  1012. // if(!this.isConnection) return
  1013. this.$axios.post('/api/index/groups/index', {}, {
  1014. headers: {
  1015. 'Content-Type': 'application/x-www-form-urlencoded',
  1016. 'apiToken': this.setApiToken('index', 'groups', 'index')
  1017. }
  1018. }).then(res => {
  1019. if (res.data.code == 1) {
  1020. this.serviceList = res.data.data;
  1021. this.chatCont.push({
  1022. 'type': 'artService'
  1023. })
  1024. this.automaticRolling();
  1025. }
  1026. })
  1027. // this.isConnection = false;
  1028. },
  1029. /***************表情点击*************** */
  1030. memeImg(i) {
  1031. //当表情被点击
  1032. this.information = this.information + "#" + this.frceArr[i] + "/";
  1033. },
  1034. /***************失去焦点做正则验证*************** */
  1035. sureInfor(type) {
  1036. if (type == 1) {
  1037. if (!/^1[34578]\d{9}$/.test(this.phone)) {
  1038. this.error = true;
  1039. this.phone = '';
  1040. } else {
  1041. this.error = false;
  1042. }
  1043. } else if (type == 10) {
  1044. if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) {
  1045. this.emlError = true;
  1046. this.email = '';
  1047. } else {
  1048. this.emlError = false;
  1049. }
  1050. }
  1051. },
  1052. /***************获取热点智能问题*************** */
  1053. getProblem() {
  1054. this.$axios.post('/api/index/robot/index', {groups_id: 1, robotgroups_id: 1}, {
  1055. headers: {
  1056. 'Content-Type': 'application/x-www-form-urlencoded',
  1057. 'apiToken': this.setApiToken('index', 'robot', 'index')
  1058. }
  1059. }).then(res => {
  1060. if (res.data.code == 1) {
  1061. this.problem = res.data.data;
  1062. }
  1063. })
  1064. },
  1065. /*****************获取聊天次数*******************/
  1066. getChatNum() {
  1067. this.$axios.post('/api/index/evaluate/minRound', '', {
  1068. headers: {
  1069. 'Content-Type': 'application/x-www-form-urlencoded',
  1070. 'apiToken': this.setApiToken('minround', 'evaluate', 'index')
  1071. }
  1072. }).then(res => {
  1073. if (res.data.code == 1) {
  1074. this.chatNum = res.data.data.systemconfig_data
  1075. }
  1076. })
  1077. },
  1078. /*****************屏蔽关键字******************/
  1079. shieldingKeyword(data) {
  1080. //将敏感词组用|转换字符串
  1081. let snstive = this.sensitive.join('|');
  1082. //console.log(snstive);
  1083. this.sensitiveNumber = 0;
  1084. //匹配出会话中的敏感词
  1085. return data.replace(eval('/' + snstive + '/g'), (res) => {
  1086. var str = '';
  1087. for (var i = 0; i < res.length; i++) {
  1088. str += '*';
  1089. }
  1090. this.sensitiveNumber++;
  1091. return str;
  1092. })
  1093. },
  1094. /*---------------------------------------------------------------------------------*/
  1095. /**************初始化WebSocket****************/
  1096. initWebSocket() {
  1097. let _this = this;
  1098. let apiToken = this.$md5.hex_md5('customer-service' + window.location.origin);
  1099. this.websock = new WebSocket('ws://103.108.43.176:9101?apiToken=' + apiToken);
  1100. // this.websock = new WebSocket('ws://192.168.2.187:9101?apiToken=' + apiToken);
  1101. this.websock.debug = true;
  1102. // 数据接收
  1103. this.websock.onmessage = this.websocketonmessage;
  1104. // 连接建立之后
  1105. this.websock.onopen = this.websocketonopen;
  1106. // 连接建立失败重连
  1107. this.websock.onerror = this.websocketonerror;
  1108. // 关闭会话
  1109. this.websock.onclose = this.websocketclose;
  1110. },
  1111. /****************连接建立成功***************/
  1112. websocketonopen() {
  1113. console.log('链接成功');
  1114. // 如果有传 group_id 直接跳转人工客服
  1115. let group_id = this.$public.getQueryString("group_id");
  1116. if (group_id) {
  1117. this.jumpService(group_id);
  1118. }
  1119. //心跳检测
  1120. this.heatBeat()
  1121. },
  1122. /*************连接建立失败重连***************** */
  1123. websocketonerror(e) {
  1124. console.log('连接建立失败重连:', e)
  1125. this.goBack(1);
  1126. },
  1127. /**************数据接收***************** */
  1128. websocketonmessage(e) {
  1129. let redata = e
  1130. if (e.data) {
  1131. redata = JSON.parse(e.data);
  1132. }
  1133. //心跳检测
  1134. this.heatBeat();
  1135. // 心跳检测
  1136. if (redata.message_type == "ping") {
  1137. this.websock.send('{"type":"pong"}')
  1138. return false;
  1139. }
  1140. if (redata.type == 'pong') return false;
  1141. if (redata.type != 'pong' || redata.message_type != "ping") {
  1142. console.log(redata)
  1143. }
  1144. // 欢迎语
  1145. if (redata.message_type == 'helloMessage') {
  1146. if(this.helloNum){
  1147. this.machine.push(redata.data.content);
  1148. }
  1149. }
  1150. // 广告语
  1151. if (redata.message_type == 'advertisement') {
  1152. this.helloNum = false
  1153. this.advert = redata.data;
  1154. }
  1155. // 评价
  1156. if (redata.message_type == 'getEvaluate') {
  1157. this.consult = true;
  1158. }
  1159. //返回的会话时间
  1160. if (redata.message_type == 'webTime') {
  1161. //处理会话时间大于两分钟显示会话时间并且储存本次会话时间
  1162. if (this.machineAndAtl == 100) {
  1163. let num = this.customerTime;
  1164. // console.log(this.customerSviceChat[num]);
  1165. if (this.customerSviceChat[num].type == "user") {
  1166. if (this.webTime) {
  1167. let newTime = redata.data.webTime.split(":");
  1168. let oldTime = this.webTime.split(":");
  1169. // console.log(newTime[1] - oldTime[1] >= 2 , newTime[0]> oldTime[0])
  1170. // console.log(newTime[1] - oldTime[1] >= 2 , newTime[0]> oldTime[0])
  1171. if (newTime[1] - oldTime[1] >= 2 || newTime[0]> oldTime[0]) {
  1172. this.$set(this.customerSviceChat[num], 'time', redata.data.webTime);
  1173. this.webTime = redata.data.webTime;
  1174. }else{
  1175. this.$set(this.customerSviceChat[num], 'time', '');
  1176. }
  1177. } else {
  1178. this.$set(this.customerSviceChat[num], 'time',redata.data.webTime);
  1179. }
  1180. } else {
  1181. this.$set(this.customerSviceChat[this.customerTime], 'time', redata.data.webTime);
  1182. }
  1183. //console.log(this.customerSviceChat)
  1184. }
  1185. }
  1186. //会话超时提示
  1187. if (redata.message_type == 'overtime') {
  1188. console.log('接收会话超时');
  1189. }
  1190. // 链接客服信息
  1191. if (redata.message_type == 'connect') {
  1192. const loading = this.$loading({
  1193. lock: true,
  1194. text: '正在连接人工客服,请稍候',
  1195. spinner: 'el-icon-loading',
  1196. });
  1197. setTimeout(() => {
  1198. let server = {};
  1199. if (redata.data) {
  1200. server = redata.data
  1201. } else {
  1202. server = {
  1203. conversationId: redata.data.conversationId,
  1204. kf_id: redata.data.kf_id,
  1205. kf_name: "",
  1206. serverInfo: {
  1207. avatar: this.avatarImg,
  1208. client_id: "",
  1209. group: "",
  1210. id: "",
  1211. intime: "",
  1212. job_name: "",
  1213. name: "tank",
  1214. signature: "",
  1215. status: 0,
  1216. task: 0,
  1217. }
  1218. }
  1219. }
  1220. // this.webTime = ''
  1221. this.artAndLeave = 10;
  1222. this.machineAndAtl = 100;
  1223. // console.log(server, '============客服信息')
  1224. this.service = server;
  1225. // console.log();
  1226. this.serviceImg = server.serverInfo.avatar;
  1227. if (server.serverInfo.gender == 1) {
  1228. server.serverInfo.gender = "男"
  1229. } else if (server.serverInfo.gender == 2) {
  1230. server.serverInfo.gender = "女"
  1231. } else {
  1232. server.serverInfo.gender = "保密"
  1233. }
  1234. this.serviceImg = server.serverInfo.avatar;
  1235. this.consult = false;
  1236. this.evlShow = false;
  1237. this.comtSuccess = false;
  1238. this.showleaveIcon = false;
  1239. this.waitingMsg = false;
  1240. this.selNum = this.selNum;
  1241. this.tokNum = this.tokNum;
  1242. this.service_on = true;
  1243. this.closeByServer = false;
  1244. // console.log(redata.data.evaluate_id,"评价数量")
  1245. if (redata.data.evaluate_id > 0) {
  1246. this.evaluateNum = true;
  1247. }
  1248. loading.close();
  1249. }, 2000);
  1250. }
  1251. // 暂无客服
  1252. if (redata.message_type == 'wait') {
  1253. let content = JSON.parse(redata.data.content)
  1254. this.artAndLeave = 100;
  1255. // console.log("暂无客服")
  1256. // this.chatCont.push({type:"tips",str:"artAndLeave100"})
  1257. }
  1258. //接收客服会话
  1259. if (redata.message_type == 'chatMessage') {
  1260. // 接收提示音
  1261. this.receiveAudio();
  1262. //会话大于两分钟显示
  1263. let timer = ''
  1264. let contType = this.isJSON(redata.data.content);
  1265. let content = {};
  1266. if (contType == false) {
  1267. content.text = redata.data.content;
  1268. timer = ''
  1269. } else {
  1270. content = JSON.parse(redata.data.content)
  1271. if (this.webTime == '') {
  1272. timer = redata.data.time;
  1273. this.webTime = redata.data.time;
  1274. } else {
  1275. let timeStamp = this.webTime.split(":");
  1276. let rdtime = redata.data.time.split(":");
  1277. if (timeStamp[0] < rdtime[0] || (timeStamp[0] == rdtime[0] && rdtime[1] -timeStamp[1] >=2)) {
  1278. timer = redata.data.time;
  1279. }else{
  1280. timer = ''
  1281. }
  1282. }
  1283. //存储会话超时间
  1284. this.webTime = redata.data.time;
  1285. }
  1286. let obj = {
  1287. time: timer,
  1288. content: content.text ? this.turnFace(content.text) : '',
  1289. imgUrl: content.img ? content.img : '',
  1290. type: 'service'
  1291. }
  1292. this.customerSviceChat.push(obj);
  1293. // console.log(this.customerSviceChat);
  1294. this.selNum++;
  1295. this.automaticRolling();
  1296. }
  1297. //接收机器会话
  1298. if (redata.message_type == 'robotMessage') {
  1299. if (redata.data.content == 'error') {
  1300. let _this = this;
  1301. this.chatCont.push({type: 1001})
  1302. this.automaticRolling();
  1303. } else {
  1304. this.chatCont.push({
  1305. 'robot_content': redata.data.content,
  1306. 'type': 'machine'
  1307. })
  1308. this.automaticRolling();
  1309. }
  1310. let num = this.chatCont.length - 2;
  1311. if (this.webTime) {
  1312. if (redata.data.time.split(":")[1] - this.webTime.split(":")[1] > 2) {
  1313. this.$set(this.chatCont[num], 'time', redata.data.time);
  1314. this.webTime = redata.data.time;
  1315. } else {
  1316. this.$set(this.chatCont[num], 'time', '');
  1317. }
  1318. } else {
  1319. this.webTime = redata.data.time = redata.data.time;
  1320. this.$set(this.chatCont[num], 'time', redata.data.time);
  1321. }
  1322. }
  1323. // 没有客服上线.
  1324. if (redata.message_type == 'notice') {
  1325. this.artAndLeave = 100;
  1326. this.automaticRolling();
  1327. this.machineAndAtl = 10;
  1328. this.jumpArtl = false;
  1329. // console.log(redata.content);
  1330. this.Onlinemsg = redata.content;
  1331. this.$alert(this.jumpName + this.Onlinemsg,'系统提示', {
  1332. confirmButtonText: '确定',
  1333. dangerouslyUseHTMLString: true
  1334. });
  1335. }
  1336. // 客服关闭会话.
  1337. if (redata.message_type == 'closeBysever') {
  1338. this.jumps = false;
  1339. this.machineAndAtl = 10;
  1340. this.selNum = 0;
  1341. this.showleaveIcon = true;
  1342. this.chatCont = []
  1343. this.chatCont.push({type: 'tips', str: 'resigtermsg'})
  1344. // 关闭清除历史信息
  1345. this.hisSviceChat = [];
  1346. this.customerSviceChat = [];
  1347. this.selNum = 0;
  1348. this.tokNum = 0;
  1349. }
  1350. // 客服掉线.
  1351. if (redata.message_type == 'serviceoffline') {
  1352. this.serviceNotOnlineText = redata.msg;
  1353. this.service_on = false;
  1354. this.serverNotOnlin = true;
  1355. this.chatCont = []
  1356. this.chatCont.push({type: "tips", str: "serverNotOnlin"})
  1357. this.closeByServer = true;
  1358. }
  1359. // 客服转接
  1360. if (redata.message_type == 'changeKeFuSuccess') {
  1361. this.changeKeFu = true;
  1362. // this.goBack();
  1363. this.customerSviceChat.push({type: 'system', str: 'changeKeFu'})
  1364. this.consult = false;
  1365. }
  1366. // 客服会话超时
  1367. if (redata.message_type == 'overtime') {
  1368. this.willOverTime = true;
  1369. this.automaticRolling();
  1370. // this.goBack();
  1371. this.overTimeMsg = redata.data.content;
  1372. }
  1373. // 客服等待排队
  1374. if (redata.message_type == "inqueue") {
  1375. this.jumps = true;
  1376. this.waitingMsg = true;
  1377. this.automaticRolling();
  1378. this.waitingText = redata.content;
  1379. }
  1380. // 客服不在线请稍后再试
  1381. if (redata.message_type == 'kfNotOnlin') {
  1382. this.service_on = false;
  1383. }
  1384. // 评价返回
  1385. if (redata.message_type == "evaluate") {
  1386. if (redata.data.status == 1) {
  1387. this.comtSuccess = true;
  1388. }
  1389. }
  1390. // 历史信息
  1391. if (redata.message_type == 'toOld') {
  1392. let obj = redata;
  1393. this.historyMsgtext = obj.data.content;
  1394. obj.data.chatLog.forEach(res => {
  1395. let content = JSON.parse(res.content)
  1396. res.content = content;
  1397. if (content.text) {
  1398. content.text = this.turnFace(content.text)
  1399. res.content = content
  1400. }
  1401. this.hisSviceChat.push(res)
  1402. })
  1403. this.customerSviceChat.push({type: 'system', str: 'historyMsg'})
  1404. this.hisLength =obj.data.chatLog.length
  1405. }
  1406. // 退出排队
  1407. if (redata.message_type == 'cancelqueueret') {
  1408. this.jumps = false;
  1409. }
  1410. },
  1411. closedWating() {
  1412. this.jumps = true;
  1413. this.waitingMsg = false;
  1414. let data = {
  1415. "type": "cancelqueue",
  1416. "data": {
  1417. "uid": localStorage.getItem('uid')
  1418. }
  1419. }
  1420. this.websock.send(JSON.stringify(data));
  1421. },
  1422. /************关闭会话*******************/
  1423. websocketclose(e) {
  1424. console.log('websocket 关闭会话: ' + e.code, e)
  1425. this.goBack();
  1426. },
  1427. /*************数据发送***************** */
  1428. websocketsend(data) {
  1429. this.websock.send(data);
  1430. },
  1431. /***************************************/
  1432. //socket重连
  1433. reconnect() {
  1434. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  1435. return
  1436. }
  1437. this.lockReconnect = true;
  1438. this.reconnectData && clearTimeout(this.reconnectData);
  1439. this.reconnectData = setTimeout(() => {
  1440. this.initWebSocket();
  1441. console.log('-----socket重连-----');
  1442. this.lockReconnect = false;
  1443. }, 3000)
  1444. },
  1445. /*************************************/
  1446. //心跳检测
  1447. heatBeat() {
  1448. this.timeoutObj && clearTimeout(this.timeoutObj);
  1449. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  1450. this.timeoutObj = setTimeout(() => {
  1451. // console.log('发送', {type: 'ping'});
  1452. this.websocketsend(JSON.stringify({type: 'ping'})) //根据后台要求发送
  1453. this.serverTimeoutObj = setTimeout(() => {
  1454. // console.log('------心跳检测close-------')
  1455. this.websock.close(); //如果 5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  1456. }, 5000);
  1457. }, this.timeout)
  1458. },
  1459. /******************消息发送数据处理********************/
  1460. sendMessage() {
  1461. let str = this.information;
  1462. let formatStr = str.replace(/\n/g, '<br/>');
  1463. if (str.length > 450) {
  1464. this.$message.error('输入内容不能大于450个字符');
  1465. this.information = '';
  1466. return false;
  1467. }
  1468. // 给机器人发送文本消息
  1469. if (this.machineAndAtl == 10) {
  1470. //给机器人发送文本消息-本地储存
  1471. let datas = {
  1472. time: '',
  1473. chat: this.turnFace(this.shieldingKeyword(formatStr)),
  1474. imgUrl: this.img,
  1475. type: 'user'
  1476. }
  1477. this.chatCont.push(datas)
  1478. //消息发送-机器人
  1479. this.websocketsend(JSON.stringify({
  1480. type: 'toRobot',
  1481. data: {
  1482. groups_id: '1',
  1483. robot_name: this.shieldingKeyword(formatStr),
  1484. webTime: this.webTime,
  1485. robotgroups_id: '1',
  1486. }
  1487. }))
  1488. } else if (this.machineAndAtl == 100) { //人工聊天
  1489. // 人工聊天超时隐藏
  1490. this.willOverTime = false;
  1491. // 发送给客服消息-本地储存
  1492. this.customerSviceChat.push({
  1493. time: '',
  1494. content: this.turnFace(this.shieldingKeyword(formatStr)),
  1495. imgUrl: this.img,
  1496. type: 'user',
  1497. });
  1498. //储存本次发送下标
  1499. this.customerTime = this.customerSviceChat.length - 1;
  1500. //消息发送-客服
  1501. this.websocketsend(JSON.stringify({
  1502. type: 'chatMessage',
  1503. data: {
  1504. from_name: this.user_info.name,
  1505. from_avatar: this.user_info.avatar,
  1506. from_id: this.user_info.id,
  1507. content: JSON.stringify({
  1508. text: formatStr,
  1509. img: this.img,
  1510. type: 'user'
  1511. }),
  1512. webTime: this.webTime,
  1513. to_id: this.service.kf_id,
  1514. to_name: this.service.kf_name,
  1515. sensitiveNumber: this.sensitiveNumber,
  1516. conversationId: this.service.conversationId
  1517. }
  1518. }))
  1519. this.tokNum++;
  1520. // console.log(this.tokNum,"我发的消息");
  1521. }
  1522. // 发送之后清空发送数据
  1523. this.img = '';
  1524. this.information = '';
  1525. //高度自动向上滑动
  1526. this.automaticRolling();
  1527. },
  1528. /*************设置token加密***************** */
  1529. setApiToken(name, controller, modules) {
  1530. return this.$md5.hex_md5(name + 'customer-service' + controller + modules)
  1531. },
  1532. /*************跳转人工客服***************** */
  1533. jumpService(id, name) {
  1534. if (this.jumps) {
  1535. this.$alert('请先退出排队,再进行操作。', '提示信息', {
  1536. confirmButtonText: '确定',
  1537. });
  1538. return false
  1539. }
  1540. this.jumpArtl = true;
  1541. this.closeByServer = false;
  1542. this.group = id;
  1543. //人工会话登陆
  1544. let data = {
  1545. 'type': 'userInit',
  1546. data: {
  1547. 'uid': this.user_info.id,
  1548. 'name': this.user_info.name,
  1549. 'avatar': this.user_info.avatar,
  1550. 'group': this.group
  1551. }
  1552. }
  1553. this.websock.send(JSON.stringify(data));
  1554. // 客服类型名称
  1555. this.jumpName = name;
  1556. },
  1557. /*************机器智能回答问题***************** */
  1558. answers(idx) {
  1559. let obj = {
  1560. 'robot_addTime': this.problem[idx].robot_addTime,
  1561. 'robot_content': this.problem[idx].robot_content,
  1562. 'type': 'machine'
  1563. }
  1564. this.information = this.problem[idx].robot_name
  1565. this.sendMessage();
  1566. this.automaticRolling();
  1567. },
  1568. /**************匿名注册**************** */
  1569. registered() {
  1570. let token = localStorage.getItem('token');
  1571. let appuid = this.$public.getQueryString('appuid');
  1572. let tutype = localStorage.getItem('tutype');
  1573. if (appuid && tutype >= 1) {
  1574. token = localStorage.getItem('token');
  1575. } else if (!appuid && tutype < 1) {
  1576. token = localStorage.getItem('token');
  1577. } else {
  1578. token = '';
  1579. }
  1580. let data = {
  1581. token: token != null ? token : '',
  1582. appid: this.$public.getQueryString('appid'),
  1583. appuid: this.$public.getQueryString('appuid'),
  1584. }
  1585. this.$http.post('/index/register/autoReg', data).then(res => {
  1586. if (res.data.code == 0) {
  1587. this.$message({
  1588. showClose: true,
  1589. message: res.data.msg,
  1590. type: 'error'
  1591. });
  1592. }
  1593. if (res.data.code == 1) {
  1594. this.user_info = res.data.data;
  1595. // console.log(this.user_info,"用户信息")
  1596. localStorage.setItem('uid', res.data.data.id)
  1597. // 游客 token
  1598. localStorage.setItem("token", res.data.data.token);
  1599. localStorage.setItem("tutype", res.data.tutype);
  1600. setTimeout(() => {
  1601. //关闭加载条
  1602. this.allLoadingClose();
  1603. // 初始化websocket
  1604. this.initWebSocket();
  1605. }, 2000);
  1606. }
  1607. });
  1608. },
  1609. /***********聊天滑动的时候滑动滚动条到底部******************* */
  1610. automaticRolling() {
  1611. this.$nextTick(() => {
  1612. let msg = document.getElementById('main') // 获取对象
  1613. msg.scrollTop = msg.scrollHeight // 滚动高度
  1614. })
  1615. },
  1616. /**************获取敏感词**************** */
  1617. getSensitive() {
  1618. let obj = {
  1619. headers: {
  1620. 'Content-Type': 'application/x-www-form-urlencoded',
  1621. "apiToken": this.setApiToken('sensitivewords', 'index', 'index')
  1622. }
  1623. };
  1624. let data = {
  1625. userToken: ''
  1626. }
  1627. this.$axios.post('/api/index/index/sensitiveWords', '', obj).then(res => {
  1628. if (res.data.code == 1) {
  1629. // console.log(res.data.data);
  1630. res.data.data.userSensitive.forEach(res => {
  1631. this.sensitive.push(res.sensitivewords_word)
  1632. })
  1633. }
  1634. })
  1635. },
  1636. /**********判定是否是JSON格式*********** */
  1637. isJSON(str) {
  1638. if (typeof str == 'string') {
  1639. try {
  1640. JSON.parse(str);
  1641. return true;
  1642. } catch (e) {
  1643. //console.log(e);
  1644. return false;
  1645. }
  1646. }
  1647. },
  1648. },
  1649. /**************页面加载中挂载**************** */
  1650. mounted() {
  1651. let self = this;
  1652. this.frceArr = frce.frce;
  1653. this.$axios.get('api/index/index/systime?t=' + new Date()).then(res => {
  1654. if (res.data.code == 1) {
  1655. // 获取系统时间
  1656. let date = res.data.data.time.split(" ");
  1657. date[0] = (new Date(date[0].replace(/-/g, '/')).getTime()) / 1000;
  1658. // this.currTime = date[0];
  1659. this.hourse = date[1];
  1660. this.logo = res.data.data.logo;
  1661. // 获取机器智能问题
  1662. this.getProblem();
  1663. // 匿名注册
  1664. this.registered();
  1665. // 获取聊天次数
  1666. this.getChatNum();
  1667. // 获取敏感词
  1668. this.getSensitive();
  1669. }
  1670. })
  1671. this.paste();
  1672. },
  1673. beforeDestroy() {
  1674. },
  1675. destroyed() {
  1676. this.websock.close() //离开路由之后断开websocket连接
  1677. this.lockReconnect = true;
  1678. clearTimeout(this.reconnectData); //离开清除 timeout
  1679. clearTimeout(this.timeoutObj); //离开清除 timeout
  1680. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  1681. },
  1682. computed: {
  1683. inforLeng() {
  1684. return this.information.length;
  1685. }
  1686. },
  1687. watch: {
  1688. inforLeng(val) {
  1689. if (val > 0) {
  1690. this.sendCol = true;
  1691. } else {
  1692. this.sendCol = false;
  1693. }
  1694. }
  1695. }
  1696. }
  1697. </script>
  1698. <style scoped>
  1699. #welcome .row {
  1700. margin-bottom: 5px;
  1701. }
  1702. .chatBox {
  1703. width: 700px;
  1704. position: relative;
  1705. }
  1706. .el-header {
  1707. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1708. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1709. }
  1710. .tit {
  1711. height: 100%;
  1712. line-height: 80px;
  1713. text-align: left;
  1714. padding-left: 20px;
  1715. }
  1716. .el-col span {
  1717. font-size: 18px;
  1718. color: #FFFFFF;
  1719. }
  1720. .imgBox {
  1721. text-align: right;
  1722. }
  1723. .imgBox img {
  1724. margin-right: 20px;
  1725. }
  1726. .imgBox img:nth-last-child(1) {
  1727. margin-right: 0
  1728. }
  1729. .el-main {
  1730. background: #fff;
  1731. width: 63%;
  1732. padding: 0;
  1733. }
  1734. .el-aside {
  1735. background: #F5F5F5;
  1736. width: 37%;
  1737. overflow: hidden;
  1738. }
  1739. .cationer {
  1740. height: 570px;
  1741. }
  1742. .cationer, .artificial {
  1743. display: flex;
  1744. justify-content: space-between;
  1745. /* align-items: center; */
  1746. }
  1747. .rt {
  1748. width: 100%;
  1749. box-sizing: inherit;
  1750. }
  1751. .artificial {
  1752. /* width: 150px; */
  1753. /* padding:0 20px; */
  1754. margin-top: 23px;
  1755. margin-bottom: 9px;
  1756. vertical-align: middle;
  1757. /* flex-direction: column;*/
  1758. }
  1759. .infor div {
  1760. margin-bottom: 3px;
  1761. }
  1762. .infor div span, .autograph span {
  1763. color: #999999;
  1764. font-size: 14px;
  1765. font-weight: 400;
  1766. }
  1767. .infor div span:nth-child(2), .autograph span:nth-child(2) {
  1768. color: #666666;
  1769. margin-left: 4px;
  1770. }
  1771. .headPortrait {
  1772. width: 46%;
  1773. height: 100px;
  1774. }
  1775. .headPortrait img {
  1776. width: 100%;
  1777. height: 100%;
  1778. }
  1779. .autograph {
  1780. margin-bottom: 11px;
  1781. }
  1782. .advent {
  1783. border-top: 1px solid #DDDDDD;
  1784. padding: 20px;
  1785. }
  1786. .advent img {
  1787. margin-top: 25px;
  1788. width: 100%;
  1789. }
  1790. .pd {
  1791. padding: 20px;
  1792. }
  1793. .pd20 {
  1794. padding: 0 20px;
  1795. }
  1796. /* 会话 */
  1797. .conversationBox {
  1798. margin-top: 13px;
  1799. margin-bottom: 13px;
  1800. }
  1801. .timer {
  1802. text-align: center;
  1803. margin: 10px 0;
  1804. color: #999999;
  1805. font-size: 12px;
  1806. }
  1807. .headImg {
  1808. width: 40px;
  1809. height: 40px;
  1810. margin-right: 13px;
  1811. }
  1812. .headImg img {
  1813. display: inline-block;
  1814. width: 40px;
  1815. height: 40px;
  1816. }
  1817. .conversation .cont, .customer .cont {
  1818. background: #ffffff;
  1819. padding: 9px 8px 12px 10px;
  1820. display: inline-block;
  1821. border: 1px solid rgba(223, 223, 223, 1);
  1822. border-radius: 5px;
  1823. position: relative;
  1824. max-width: 260px;
  1825. word-wrap: break-word;
  1826. word-break: normal;
  1827. }
  1828. .left::after {
  1829. position: absolute;
  1830. content: "";
  1831. display: inline-block;
  1832. left: -4px;
  1833. top: 5px;
  1834. width: 5px;
  1835. height: 9px;
  1836. background: #fff;
  1837. -webkit-transform: skewX(30deg);
  1838. transform: skewX(30deg);
  1839. /* z-index: -1; */
  1840. border-left: 1px solid #dfdfdf;
  1841. border-top: 1px solid #dfdfdf;
  1842. }
  1843. div.noafter::after {
  1844. content: '';
  1845. width: 0;
  1846. height: 0;;
  1847. display: inline;
  1848. position: relative;
  1849. border: 0;
  1850. }
  1851. .conversation .cont div, .customer .cont div {
  1852. color: #666666;
  1853. font-size: 16px;
  1854. }
  1855. .customer {
  1856. justify-content: space-between;
  1857. }
  1858. .customer .cont {
  1859. margin-right: 13px;
  1860. border: 0;
  1861. background: #5EA0F7;
  1862. max-width: 260px;
  1863. word-wrap: break-word;
  1864. word-break: normal;
  1865. }
  1866. .customer .cont div {
  1867. color: #FFFFFF;
  1868. }
  1869. .right::after {
  1870. position: absolute;
  1871. content: "";
  1872. display: inline-block;
  1873. right: -2px;
  1874. top: 6px;
  1875. width: 5px;
  1876. height: 9px;
  1877. background: #5ea0f7;
  1878. -webkit-transform: skewX(-30deg);
  1879. transform: skewX(-30deg);
  1880. border-left: 1px solid #5ea0f7;
  1881. border-top: 1px solid #5ea0f7;
  1882. }
  1883. .col {
  1884. color: #999999;
  1885. }
  1886. .change {
  1887. color: #5ea0f7;
  1888. }
  1889. .questionList, .changeService {
  1890. margin: 10px;
  1891. border: 1px solid rgba(223, 223, 223, 1);
  1892. border-radius: 5px;
  1893. }
  1894. .questionList div, .changeService div {
  1895. height: 40px;
  1896. line-height: 40px;
  1897. padding-left: 15px;
  1898. }
  1899. .questionList div span {
  1900. color: #5EA0F7;
  1901. font-size: 14px;
  1902. }
  1903. .questionList section:nth-child(odd), .changeService div:nth-child(odd) {
  1904. background: #F6F6F6;
  1905. }
  1906. .changeService div span {
  1907. font-size: 14px;
  1908. }
  1909. .changeService div span:nth-child(1) {
  1910. margin-right: 5px;
  1911. }
  1912. .col6 {
  1913. color: #666666 !important;
  1914. }
  1915. .colE5 {
  1916. color: #5EA0F7;
  1917. }
  1918. .promptBox {
  1919. display: flex;
  1920. justify-content: center;
  1921. height: 26px;
  1922. margin: 10px 0 10px;
  1923. /* line-height: 26px; */
  1924. }
  1925. .promptBoxH {
  1926. display: flex;
  1927. justify-content: center;
  1928. height: 50px;
  1929. margin: 10px 0 10px;
  1930. /* line-height: 26px; */
  1931. }
  1932. .prompt {
  1933. line-height: 25px;
  1934. text-align: center;
  1935. background: #DDDDDD;
  1936. border-radius: 30px;
  1937. width: 140px;
  1938. color: #FFFFFF;
  1939. font-size: 12px;
  1940. }
  1941. .help {
  1942. width: 90%;
  1943. }
  1944. .help .prompt {
  1945. width: 100%;
  1946. }
  1947. /* 评论 */
  1948. .evaluate {
  1949. height: 101px;
  1950. padding: 19px 0 16px;
  1951. background: rgba(255, 255, 255, 1);
  1952. border: 1px solid rgba(223, 223, 223, 1);
  1953. border-radius: 10px;
  1954. margin-top: 15px;
  1955. text-align: center;
  1956. position: relative;
  1957. box-sizing: border-box;
  1958. }
  1959. .evaluate span {
  1960. font-size: 14px;
  1961. color: #666666;
  1962. }
  1963. .nopd {
  1964. padding: 0;
  1965. }
  1966. .nopd i {
  1967. margin-left: 10px;
  1968. width: 8px;
  1969. height: 8px;
  1970. background: #cdcdcd;
  1971. background: #81d981;
  1972. display: inline-block;
  1973. border-radius: 50%;
  1974. }
  1975. .evaluate .btn {
  1976. display: block;
  1977. background: #F04992;
  1978. border-radius: 10px;
  1979. margin-top: 10px;
  1980. color: #FFFFFF;
  1981. height: 36px;
  1982. line-height: 36px;
  1983. width: 100px;
  1984. position: absolute;
  1985. bottom: 16px;
  1986. left: 35%;
  1987. cursor: pointer;
  1988. }
  1989. /* 聊天框 */
  1990. .chatting {
  1991. width: 100%;
  1992. background: rgba(255, 255, 255, 1);
  1993. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1994. height: 100px;
  1995. padding: 10px 20px;
  1996. }
  1997. .informationBox {
  1998. height: 450px;
  1999. overflow-y: auto;
  2000. overflow-x: hidden;
  2001. }
  2002. .expression, .photo {
  2003. display: inline-block;
  2004. width: 18px;
  2005. height: 18px;
  2006. background: url("./../assets/st-img/expression.png") no-repeat;
  2007. background-size: 100% 100%;
  2008. cursor: pointer;
  2009. margin-right: 18px;
  2010. }
  2011. .expression:hover {
  2012. background: url("./../assets/st-img/expressionHover.png") no-repeat;
  2013. background-size: 100% 100%;
  2014. }
  2015. .photo {
  2016. background: url("./../assets/st-img/photo.png") no-repeat;
  2017. background-size: 100% 100%;
  2018. }
  2019. .photo:hover {
  2020. background: url("./../assets/st-img/photoHover.png") no-repeat;
  2021. background-size: 100% 100%;
  2022. }
  2023. textarea {
  2024. height: 40px;
  2025. width: 300px;
  2026. border: 0;
  2027. -webkit-user-select: auto;
  2028. user-select: auto;
  2029. -o-user-select: auto;
  2030. -ms-user-select: auto;
  2031. resize: none;
  2032. outline: none;
  2033. padding-top: 10px;
  2034. overflow-y: auto;
  2035. }
  2036. .sendOut {
  2037. width: 80px;
  2038. height: 44px;
  2039. line-height: 40px;
  2040. border: 1px solid rgba(221, 221, 221, 1);
  2041. border-radius: 5px;
  2042. text-align: center;
  2043. margin-left: 20px;
  2044. margin-top: 25px;
  2045. }
  2046. .sendOut span {
  2047. color: #CCCCCC;
  2048. font-size: 16px;
  2049. }
  2050. .chattingBox {
  2051. margin-top: 12px;
  2052. }
  2053. /* 评论弹框 */
  2054. .zzBox {
  2055. position: absolute;
  2056. width: 100%;
  2057. height: 100%;
  2058. background: rgba(0, 0, 0, 0.3);
  2059. top: 0;
  2060. left: 0;
  2061. }
  2062. .box-card, .proving {
  2063. width: 494px;
  2064. height: 300px;
  2065. position: absolute;
  2066. left: 50%;
  2067. top: 50%;
  2068. transform: translate(-50%, -50%);
  2069. z-index: 999;
  2070. border-radius: 10px;
  2071. padding: 20px 20px 30px 50px;
  2072. box-sizing: border-box;
  2073. }
  2074. .proving {
  2075. padding: 20px 20px 30px 47px;
  2076. }
  2077. .close {
  2078. text-align: right;
  2079. cursor: pointer;
  2080. }
  2081. .close i {
  2082. display: inline-block;
  2083. width: 18px;
  2084. height: 18px;
  2085. background: url("./../assets/st-img/close.png") no-repeat;
  2086. background-size: 100% 100%;
  2087. }
  2088. .box-card .tit {
  2089. text-align: center;
  2090. padding-right: 65px;
  2091. margin-bottom: 40px;
  2092. }
  2093. .box-card .tit span {
  2094. font-size: 18px;
  2095. color: #666666;
  2096. }
  2097. .selIcon {
  2098. padding-right: 30px;
  2099. margin-bottom: 30px;
  2100. }
  2101. .selIcon div {
  2102. text-align: center;
  2103. cursor: pointer;
  2104. }
  2105. .selIcon div i {
  2106. display: block;
  2107. width: 44px;
  2108. height: 44px;
  2109. background: url("./../assets/st-img/satisfied.png") no-repeat;
  2110. background-size: 100% 100%;
  2111. margin-bottom: 10px;
  2112. }
  2113. .selIcon div span {
  2114. /* display: block; */
  2115. }
  2116. .selIcon div .comm {
  2117. background: url("./../assets/st-img/comm2.png") no-repeat;
  2118. }
  2119. .selIcon div .sfd {
  2120. background: url("./../assets/st-img/Satisfied2.png") no-repeat;
  2121. }
  2122. .selIcon div .comm2 {
  2123. background: url("./../assets/st-img/comm.png") no-repeat;
  2124. }
  2125. .selIcon div .notSfd {
  2126. background: url("./../assets/st-img/notSatisfied2.png")
  2127. }
  2128. .selIcon div .notSfd2 {
  2129. background: url("./../assets/st-img/notSatisfied.png")
  2130. }
  2131. .levMsg {
  2132. padding-right: 30px;
  2133. margin-bottom: 20px;
  2134. }
  2135. .sure {
  2136. text-align: center;
  2137. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  2138. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  2139. border-radius: 10px;
  2140. width: 100px;
  2141. height: 48px;
  2142. line-height: 48px;
  2143. color: #fff;
  2144. position: absolute;
  2145. bottom: 30px;
  2146. left: 37%;
  2147. cursor: pointer;
  2148. }
  2149. /* 验证框 */
  2150. .logo {
  2151. text-align: center;
  2152. margin-bottom: 20px;
  2153. }
  2154. .logo span {
  2155. font-size: 38px;
  2156. font-weight: bold;
  2157. color: #5EA0F7;
  2158. font-family: Microsoft YaHei;
  2159. }
  2160. .logo span:nth-child(1) {
  2161. color: #F04992;
  2162. }
  2163. .formBox {
  2164. padding: 0 27px 0 0;
  2165. }
  2166. .formBox .el-input {
  2167. margin-bottom: 21px;
  2168. }
  2169. .formBox .phone .el-input, .formBox .email .el-input {
  2170. margin-bottom: 0;
  2171. }
  2172. .formBox .phone, .formBox .email {
  2173. margin-bottom: 10px;
  2174. }
  2175. .vertion {
  2176. vertical-align: middle;
  2177. /* margin-bottom: 28px; */
  2178. }
  2179. .vertion .el-input {
  2180. width: 250px;
  2181. margin-right: 15px;
  2182. display: inline-block;
  2183. }
  2184. .vertion span {
  2185. display: inline-block;
  2186. width: 128px;
  2187. height: 40px;;
  2188. vertical-align: middle;
  2189. background: rgba(241, 225, 224, 1);
  2190. }
  2191. .formBox .sure {
  2192. bottom: 21px;
  2193. }
  2194. .el-card__body .tit {
  2195. line-height: 25px;
  2196. }
  2197. .chatting .el-button {
  2198. border: none;
  2199. padding: 0;
  2200. border-radius: 0
  2201. }
  2202. .emoticon {
  2203. width: 30px;
  2204. height: 30px;
  2205. display: inline-block;
  2206. }
  2207. .pointer {
  2208. cursor: pointer;
  2209. }
  2210. .ly:hover {
  2211. border-bottom: 1px solid #5EA0F7;
  2212. /* 高亮效果 */
  2213. filter: brightness(0.9);
  2214. }
  2215. .gl:hover {
  2216. filter: brightness(0.9);
  2217. }
  2218. .seek:hover {
  2219. background: #860c60
  2220. }
  2221. .sendCol {
  2222. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  2223. }
  2224. .netSendCol {
  2225. cursor: not-allowed;
  2226. }
  2227. /* 修改滚动条 */
  2228. ::-webkit-scrollbar-button {
  2229. background: transparent;
  2230. border: 0;
  2231. }
  2232. /* 顶部三个图标 */
  2233. .imgBox i {
  2234. display: inline-block;
  2235. width: 25px;
  2236. height: 25px;
  2237. margin-right: 20px;
  2238. background: url("./../assets/st-img/pj.png") no-repeat;
  2239. background-size: 100% 100%;
  2240. vertical-align: middle;
  2241. }
  2242. .imgBox .sy {
  2243. background: url("./../assets/st-img/sy.png") no-repeat;
  2244. }
  2245. .imgBox .sq {
  2246. background: url("./../assets/st-img/sq.png") no-repeat;
  2247. }
  2248. /* .sc:hover{
  2249. background: url("./../assets/st-img/pjhover.png") no-repeat;
  2250. }
  2251. .sy:hover{
  2252. background: url("./../assets/st-img/sy2.png")no-repeat;
  2253. }
  2254. .sq:hover{
  2255. background: url("./../assets/st-img/sq2.png") no-repeat;
  2256. } */
  2257. i.scActy {
  2258. background: #1654D1 url("./../assets/st-img/pjhover.png") no-repeat;
  2259. width: 33px;
  2260. height: 33px;
  2261. background-position: 5px;
  2262. }
  2263. /* .imgBox .syActy{
  2264. background:#1654D1 url("./../assets/st-img/jzsy.png") no-repeat;
  2265. width: 33px;
  2266. height: 33px;
  2267. background-position: 5px;
  2268. }
  2269. .imgBox .sqActy{
  2270. background: #1654D1 url("./../assets/st-img/sq2.png") no-repeat;
  2271. width: 33px;
  2272. height: 33px;
  2273. transform: rotate(180deg);
  2274. background-position: 5px;
  2275. } */
  2276. .tips {
  2277. font-size: 12px;
  2278. color: #F04992;
  2279. }
  2280. #main {
  2281. position: relative;
  2282. }
  2283. .retract {
  2284. position: absolute;
  2285. right: 0;
  2286. top: 290px;
  2287. z-index: 999;
  2288. }
  2289. /* 滚动条样式 */
  2290. .scroll::-webkit-scrollbar {
  2291. border: 5px solid #fff;
  2292. }
  2293. .scroll::-webkit-scrollbar {
  2294. width: 5px;
  2295. height: 20px;
  2296. }
  2297. .scroll::-webkit-scrollbar-button {
  2298. width: 0px;
  2299. height: 0px;
  2300. }
  2301. .scroll::-webkit-scrollbar-thumb {
  2302. border-radius: 5px;
  2303. box-shadow: inset 0 0 0 5px #aaa;
  2304. border: .02rem solid transparent;
  2305. }
  2306. .scroll::-webkit-scrollbar-track {
  2307. display: block;
  2308. background: rgba(0, 0, 0, 0.1);
  2309. }
  2310. #logo {
  2311. margin-right: 10px;
  2312. width: 40px;
  2313. height: 40px;
  2314. line-height: 40px;
  2315. display: inline-block;
  2316. border-radius: 50%;
  2317. vertical-align: sub;
  2318. position: relative;
  2319. top: 10px;
  2320. }
  2321. .duty {
  2322. display: inline-block;
  2323. width: 60px;
  2324. white-space: nowrap;
  2325. overflow: hidden;
  2326. text-overflow: ellipsis;
  2327. vertical-align: bottom;
  2328. }
  2329. </style>