chat.vue 64 KB

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