chat.vue 68 KB

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