chat.vue 68 KB

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