chat.vue 64 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488
  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. },
  1353. /************关闭会话*******************/
  1354. websocketclose(e) {
  1355. console.log('websocket 关闭会话: ' + e.code, e)
  1356. this.goBack();
  1357. },
  1358. /*************数据发送***************** */
  1359. websocketsend(data) {
  1360. this.websock.send(data);
  1361. },
  1362. /***************************************/
  1363. //socket重连
  1364. reconnect() {
  1365. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  1366. return
  1367. }
  1368. this.lockReconnect = true;
  1369. this.reconnectData && clearTimeout(this.reconnectData);
  1370. this.reconnectData = setTimeout(() => {
  1371. this.initWebSocket();
  1372. console.log('-----socket重连-----');
  1373. this.lockReconnect = false;
  1374. }, 3000)
  1375. },
  1376. /*************************************/
  1377. //心跳检测
  1378. heatBeat() {
  1379. this.timeoutObj && clearTimeout(this.timeoutObj);
  1380. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  1381. this.timeoutObj = setTimeout(() => {
  1382. // console.log('发送', {type: 'ping'});
  1383. this.websocketsend(JSON.stringify({type: 'ping'})) //根据后台要求发送
  1384. this.serverTimeoutObj = setTimeout(() => {
  1385. // console.log('------心跳检测close-------')
  1386. this.websock.close(); //如果 5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  1387. }, 5000);
  1388. }, this.timeout)
  1389. },
  1390. /******************消息发送数据处理********************/
  1391. sendMessage() {
  1392. let str = this.information;
  1393. let formatStr = str.replace(/\n/g, '<br/>');
  1394. // 给机器人发送文本消息
  1395. if (this.machineAndAtl == 10) {
  1396. //给机器人发送文本消息-本地储存
  1397. let datas = {
  1398. time: '',
  1399. chat: this.turnFace(this.shieldingKeyword(formatStr)),
  1400. imgUrl: this.img,
  1401. type: 'user'
  1402. }
  1403. this.chatCont.push(datas)
  1404. //消息发送-机器人
  1405. this.websocketsend(JSON.stringify({
  1406. type: 'toRobot',
  1407. data: {
  1408. groups_id: '1',
  1409. robot_name: this.shieldingKeyword(formatStr),
  1410. webTime: this.webTime,
  1411. robotgroups_id: '1',
  1412. }
  1413. }))
  1414. } else if (this.machineAndAtl == 100) { //人工聊天
  1415. // 人工聊天超时隐藏
  1416. this.willOverTime = false;
  1417. // 发送给客服消息-本地储存
  1418. this.customerSviceChat.push({
  1419. time: '',
  1420. content: this.turnFace(this.shieldingKeyword(formatStr)),
  1421. imgUrl: this.img,
  1422. type: 'user',
  1423. });
  1424. //消息发送-客服
  1425. this.websocketsend(JSON.stringify({
  1426. type: 'chatMessage',
  1427. data: {
  1428. from_name: this.user_info.name,
  1429. from_avatar: this.user_info.avatar,
  1430. from_id: this.user_info.id,
  1431. content: JSON.stringify({
  1432. text: formatStr,
  1433. img: this.img,
  1434. type: 'user'
  1435. }),
  1436. webTime: this.webTime,
  1437. to_id: this.service.kf_id,
  1438. to_name: this.service.kf_name,
  1439. sensitiveNumber: this.sensitiveNumber,
  1440. conversationId: this.service.conversationId
  1441. }
  1442. }))
  1443. this.tokNum++;
  1444. // console.log(this.tokNum,"我发的消息");
  1445. }
  1446. // 发送之后清空发送数据
  1447. this.img = '';
  1448. this.information = '';
  1449. //高度自动向上滑动
  1450. this.automaticRolling();
  1451. },
  1452. /*************设置token加密***************** */
  1453. setApiToken(name, controller,modules) {
  1454. return this.$md5.hex_md5(name + 'customer-service' + controller + modules)
  1455. },
  1456. /*************跳转人工客服***************** */
  1457. jumpService(id, name) {
  1458. this.jumpArtl = true;
  1459. this.closeByServer = false;
  1460. this.group = id;
  1461. //人工会话登陆
  1462. let data = {
  1463. 'type': 'userInit',
  1464. data: {
  1465. 'uid': this.user_info.id,
  1466. 'name': this.user_info.name,
  1467. 'avatar': this.user_info.avatar,
  1468. 'group': this.group
  1469. }
  1470. }
  1471. this.websock.send(JSON.stringify(data));
  1472. // 客服类型名称
  1473. this.jumpName = name;
  1474. },
  1475. /*************机器智能回答问题***************** */
  1476. answers(idx) {
  1477. let obj = {
  1478. 'robot_addTime': this.problem[idx].robot_addTime,
  1479. 'robot_content': this.problem[idx].robot_content,
  1480. 'type': 'machine'
  1481. }
  1482. this.information = this.problem[idx].robot_name
  1483. this.sendMessage();
  1484. this.automaticRolling();
  1485. },
  1486. /**************匿名注册**************** */
  1487. registered() {
  1488. let token = localStorage.getItem('token');
  1489. let appuid = this.$public.getQueryString('appuid');
  1490. let tutype = this.$public.getQueryString('tutype');
  1491. if (appuid && tutype >= 1) {
  1492. token = localStorage.getItem('token');
  1493. } else if (!appuid && tutype < 1) {
  1494. token = localStorage.getItem('token');
  1495. } else {
  1496. token = '';
  1497. }
  1498. let data = {
  1499. token: token != null ? token : '',
  1500. appid: this.$public.getQueryString('appid'),
  1501. appuid: this.$public.getQueryString('appuid'),
  1502. }
  1503. // console.log(data,'参数')
  1504. // let obj = {
  1505. // headers: {
  1506. // 'Content-Type': 'application/x-www-form-urlencoded',
  1507. // "apiToken": this.setApiToken('autoreg', 'register', this.currTime, 'index')
  1508. // }
  1509. // }
  1510. this.$http.post('/index/register/autoReg', data).then(res => {
  1511. if(res.data.code == 0){
  1512. this.$message({
  1513. showClose: true,
  1514. message: res.data.msg,
  1515. type: 'error'
  1516. });
  1517. }
  1518. if (res.data.code == 1) {
  1519. this.user_info = res.data.data;
  1520. // console.log(this.user_info,"用户信息")
  1521. localStorage.setItem('uid', res.data.data.id)
  1522. // 游客 token
  1523. localStorage.setItem("token", res.data.data.token);
  1524. localStorage.setItem("tutype", res.data.tutype);
  1525. setTimeout(() => {
  1526. //关闭加载条
  1527. this.allLoadingClose();
  1528. // 初始化websocket
  1529. this.initWebSocket();
  1530. }, 2000);
  1531. }
  1532. });
  1533. },
  1534. /***********聊天滑动的时候滑动滚动条到底部******************* */
  1535. automaticRolling() {
  1536. this.$nextTick(() => {
  1537. let msg = document.getElementById('main') // 获取对象
  1538. msg.scrollTop = msg.scrollHeight // 滚动高度
  1539. })
  1540. },
  1541. /**************获取敏感词**************** */
  1542. getSensitive() {
  1543. let obj = {
  1544. headers: {
  1545. 'Content-Type': 'application/x-www-form-urlencoded',
  1546. "apiToken": this.setApiToken('sensitivewords', 'index','index')
  1547. }
  1548. };
  1549. let data = {
  1550. userToken: ''
  1551. }
  1552. this.$axios.post('/api/index/index/sensitiveWords', '', obj).then(res => {
  1553. if (res.data.code == 1) {
  1554. // console.log(res.data.data);
  1555. res.data.data.userSensitive.forEach(res => {
  1556. this.sensitive.push(res.sensitivewords_word)
  1557. })
  1558. }
  1559. })
  1560. },
  1561. /**********判定是否是JSON格式*********** */
  1562. isJSON(str) {
  1563. if (typeof str == 'string') {
  1564. try {
  1565. JSON.parse(str);
  1566. return true;
  1567. } catch (e) {
  1568. //console.log(e);
  1569. return false;
  1570. }
  1571. }
  1572. },
  1573. },
  1574. /**************页面加载中挂载**************** */
  1575. mounted() {
  1576. let self = this;
  1577. this.frceArr = frce.frce;
  1578. this.$axios.get('api/index/index/systime?t=' + new Date()).then(res => {
  1579. if (res.data.code == 1) {
  1580. // 获取系统时间
  1581. let date = res.data.data.time.split(" ");
  1582. date[0] = (new Date(date[0].replace(/-/g, '/')).getTime()) / 1000;
  1583. // this.currTime = date[0];
  1584. this.hourse = date[1];
  1585. this.logo = res.data.data.logo;
  1586. // 获取机器智能问题
  1587. this.getProblem();
  1588. // 匿名注册
  1589. this.registered();
  1590. // 获取聊天次数
  1591. this.getChatNum();
  1592. // 获取敏感词
  1593. this.getSensitive();
  1594. }
  1595. })
  1596. this.paste();
  1597. },
  1598. beforeDestroy(){
  1599. },
  1600. destroyed() {
  1601. this.websock.close() //离开路由之后断开websocket连接
  1602. this.lockReconnect = true;
  1603. clearTimeout(this.reconnectData); //离开清除 timeout
  1604. clearTimeout(this.timeoutObj); //离开清除 timeout
  1605. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  1606. },
  1607. computed: {
  1608. inforLeng() {
  1609. return this.information.length;
  1610. }
  1611. },
  1612. watch: {
  1613. inforLeng(val) {
  1614. if (val > 0) {
  1615. this.sendCol = true;
  1616. } else {
  1617. this.sendCol = false;
  1618. }
  1619. }
  1620. }
  1621. }
  1622. </script>
  1623. <style scoped>
  1624. .chatBox {
  1625. width: 700px;
  1626. position: relative;
  1627. }
  1628. .el-header {
  1629. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1630. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1631. }
  1632. .tit {
  1633. height: 100%;
  1634. line-height: 80px;
  1635. text-align: left;
  1636. padding-left: 20px;
  1637. }
  1638. .el-col span {
  1639. font-size: 18px;
  1640. color: #FFFFFF;
  1641. }
  1642. .imgBox {
  1643. text-align: right;
  1644. }
  1645. .imgBox img {
  1646. margin-right: 20px;
  1647. }
  1648. .imgBox img:nth-last-child(1) {
  1649. margin-right: 0
  1650. }
  1651. .el-main {
  1652. background: #fff;
  1653. width: 63%;
  1654. padding: 0;
  1655. }
  1656. .el-aside {
  1657. background: #F5F5F5;
  1658. width: 37%;
  1659. overflow: hidden;
  1660. }
  1661. .cationer{
  1662. height: 570px;
  1663. }
  1664. .cationer, .artificial {
  1665. display: flex;
  1666. justify-content: space-between;
  1667. /* align-items: center; */
  1668. }
  1669. .rt {
  1670. width: 100%;
  1671. box-sizing: inherit;
  1672. }
  1673. .artificial {
  1674. /* width: 150px; */
  1675. /* padding:0 20px; */
  1676. margin-top: 23px;
  1677. margin-bottom: 9px;
  1678. vertical-align: middle;
  1679. /* flex-direction: column;*/
  1680. }
  1681. .infor div {
  1682. margin-bottom: 3px;
  1683. }
  1684. .infor div span, .autograph span {
  1685. color: #999999;
  1686. font-size: 14px;
  1687. font-weight: 400;
  1688. }
  1689. .infor div span:nth-child(2), .autograph span:nth-child(2) {
  1690. color: #666666;
  1691. margin-left: 4px;
  1692. }
  1693. .headPortrait {
  1694. width: 46%;
  1695. height: 100px;
  1696. }
  1697. .headPortrait img {
  1698. width: 100%;
  1699. height: 100%;
  1700. }
  1701. .autograph {
  1702. margin-bottom: 11px;
  1703. }
  1704. .advent {
  1705. border-top: 1px solid #DDDDDD;
  1706. padding: 20px;
  1707. }
  1708. .advent img {
  1709. margin-top: 25px;
  1710. width: 100%;
  1711. }
  1712. .pd {
  1713. padding: 20px;
  1714. }
  1715. .pd20 {
  1716. padding: 0 20px;
  1717. }
  1718. /* 会话 */
  1719. .conversationBox {
  1720. margin-top: 13px;
  1721. margin-bottom: 13px;
  1722. }
  1723. .timer {
  1724. text-align: center;
  1725. margin: 10px 0;
  1726. color: #999999;
  1727. font-size: 12px;
  1728. }
  1729. .headImg {
  1730. width: 40px;
  1731. height: 40px;
  1732. margin-right: 13px;
  1733. }
  1734. .headImg img {
  1735. display: inline-block;
  1736. width: 40px;
  1737. height: 40px;
  1738. }
  1739. .conversation .cont, .customer .cont {
  1740. background: #ffffff;
  1741. padding: 9px 8px 12px 10px;
  1742. display: inline-block;
  1743. border: 1px solid rgba(223, 223, 223, 1);
  1744. border-radius: 5px;
  1745. position: relative;
  1746. max-width: 270px;
  1747. }
  1748. .left::after {
  1749. position: absolute;
  1750. content: "";
  1751. display: inline-block;
  1752. left: -4px;
  1753. top: 5px;
  1754. width: 5px;
  1755. height: 9px;
  1756. background: #fff;
  1757. -webkit-transform: skewX(30deg);
  1758. transform: skewX(30deg);
  1759. /* z-index: -1; */
  1760. border-left: 1px solid #dfdfdf;
  1761. border-top: 1px solid #dfdfdf;
  1762. }
  1763. div.noafter::after {
  1764. content: '';
  1765. width: 0;
  1766. height: 0;;
  1767. display: inline;
  1768. position: relative;
  1769. border: 0;
  1770. }
  1771. .conversation .cont div, .customer .cont div {
  1772. color: #666666;
  1773. font-size: 16px;
  1774. }
  1775. .customer {
  1776. justify-content: space-between;
  1777. }
  1778. .customer .cont {
  1779. margin-right: 13px;
  1780. border: 0;
  1781. background: #5EA0F7;
  1782. max-width: 260px;
  1783. word-wrap: break-word;
  1784. word-break: normal;
  1785. }
  1786. .customer .cont div {
  1787. color: #FFFFFF;
  1788. }
  1789. .right::after {
  1790. position: absolute;
  1791. content: "";
  1792. display: inline-block;
  1793. right: -2px;
  1794. top: 6px;
  1795. width: 5px;
  1796. height: 9px;
  1797. background: #5ea0f7;
  1798. -webkit-transform: skewX(-30deg);
  1799. transform: skewX(-30deg);
  1800. border-left: 1px solid #5ea0f7;
  1801. border-top: 1px solid #5ea0f7;
  1802. }
  1803. .col {
  1804. color: #999999;
  1805. }
  1806. .change {
  1807. color: #5ea0f7;
  1808. }
  1809. .questionList, .changeService {
  1810. margin: 10px;
  1811. border: 1px solid rgba(223, 223, 223, 1);
  1812. border-radius: 5px;
  1813. }
  1814. .questionList div, .changeService div {
  1815. height: 40px;
  1816. line-height: 40px;
  1817. padding-left: 15px;
  1818. }
  1819. .questionList div span {
  1820. color: #5EA0F7;
  1821. font-size: 14px;
  1822. }
  1823. .questionList section:nth-child(odd), .changeService div:nth-child(odd) {
  1824. background: #F6F6F6;
  1825. }
  1826. .changeService div span {
  1827. font-size: 14px;
  1828. }
  1829. .changeService div span:nth-child(1) {
  1830. margin-right: 5px;
  1831. }
  1832. .col6 {
  1833. color: #666666 !important;
  1834. }
  1835. .colE5 {
  1836. color: #5EA0F7;
  1837. }
  1838. .promptBox {
  1839. display: flex;
  1840. justify-content: center;
  1841. height: 26px;
  1842. margin: 10px 0 10px;
  1843. /* line-height: 26px; */
  1844. }
  1845. .promptBoxH {
  1846. display: flex;
  1847. justify-content: center;
  1848. height: 50px;
  1849. margin: 10px 0 10px;
  1850. /* line-height: 26px; */
  1851. }
  1852. .prompt {
  1853. line-height: 25px;
  1854. text-align: center;
  1855. background: #DDDDDD;
  1856. border-radius: 30px;
  1857. width: 140px;
  1858. color: #FFFFFF;
  1859. font-size: 12px;
  1860. }
  1861. .help {
  1862. width: 90%;
  1863. }
  1864. .help .prompt {
  1865. width: 100%;
  1866. }
  1867. /* 评论 */
  1868. .evaluate {
  1869. height: 101px;
  1870. padding: 19px 0 16px;
  1871. background: rgba(255, 255, 255, 1);
  1872. border: 1px solid rgba(223, 223, 223, 1);
  1873. border-radius: 10px;
  1874. margin-top: 15px;
  1875. text-align: center;
  1876. position: relative;
  1877. box-sizing: border-box;
  1878. }
  1879. .evaluate span {
  1880. font-size: 14px;
  1881. color: #666666;
  1882. }
  1883. .nopd {
  1884. padding: 0;
  1885. }
  1886. .nopd i{
  1887. margin-left: 10px;
  1888. width: 8px;
  1889. height: 8px;
  1890. background: #cdcdcd;
  1891. background: #81d981;
  1892. display: inline-block;
  1893. border-radius: 50%;
  1894. }
  1895. .evaluate .btn {
  1896. display: block;
  1897. background: #F04992;
  1898. border-radius: 10px;
  1899. margin-top: 10px;
  1900. color: #FFFFFF;
  1901. height: 36px;
  1902. line-height: 36px;
  1903. width: 100px;
  1904. position: absolute;
  1905. bottom: 16px;
  1906. left: 35%;
  1907. cursor: pointer;
  1908. }
  1909. /* 聊天框 */
  1910. .chatting {
  1911. width: 100%;
  1912. background: rgba(255, 255, 255, 1);
  1913. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1914. height: 100px;
  1915. padding: 10px 20px;
  1916. }
  1917. .informationBox {
  1918. height: 450px;
  1919. overflow: auto;
  1920. }
  1921. .expression, .photo {
  1922. display: inline-block;
  1923. width: 18px;
  1924. height: 18px;
  1925. background: url("./../assets/st-img/expression.png") no-repeat;
  1926. background-size: 100% 100%;
  1927. cursor: pointer;
  1928. margin-right: 18px;
  1929. }
  1930. .expression:hover {
  1931. background: url("./../assets/st-img/expressionHover.png") no-repeat;
  1932. background-size: 100% 100%;
  1933. }
  1934. .photo {
  1935. background: url("./../assets/st-img/photo.png") no-repeat;
  1936. background-size: 100% 100%;
  1937. }
  1938. .photo:hover {
  1939. background: url("./../assets/st-img/photoHover.png") no-repeat;
  1940. background-size: 100% 100%;
  1941. }
  1942. textarea {
  1943. height: 30px;
  1944. width: 300px;
  1945. border: 0;
  1946. -webkit-user-select: auto;
  1947. user-select: auto;
  1948. -o-user-select: auto;
  1949. -ms-user-select: auto;
  1950. resize: none;
  1951. outline: none;
  1952. padding-top: 10px;
  1953. overflow: hidden;
  1954. }
  1955. .sendOut {
  1956. width: 80px;
  1957. height: 44px;
  1958. line-height: 40px;
  1959. border: 1px solid rgba(221, 221, 221, 1);
  1960. border-radius: 5px;
  1961. text-align: center;
  1962. margin-left: 20px;
  1963. }
  1964. .sendOut span {
  1965. color: #CCCCCC;
  1966. font-size: 16px;
  1967. }
  1968. .chattingBox {
  1969. margin-top: 12px;
  1970. }
  1971. /* 评论弹框 */
  1972. .zzBox {
  1973. position: absolute;
  1974. width: 100%;
  1975. height: 100%;
  1976. background: rgba(0, 0, 0, 0.3);
  1977. top: 0;
  1978. left: 0;
  1979. }
  1980. .box-card, .proving {
  1981. width: 494px;
  1982. height: 300px;
  1983. position: absolute;
  1984. left: 50%;
  1985. top: 50%;
  1986. transform: translate(-50%, -50%);
  1987. z-index: 999;
  1988. border-radius: 10px;
  1989. padding: 20px 20px 30px 50px;
  1990. box-sizing: border-box;
  1991. }
  1992. .proving {
  1993. padding: 20px 20px 30px 47px;
  1994. }
  1995. .close{
  1996. text-align: right;
  1997. cursor: pointer;
  1998. }
  1999. .close i{
  2000. display: inline-block;
  2001. width: 18px;
  2002. height: 18px;
  2003. background: url("./../assets/st-img/close.png") no-repeat;
  2004. background-size: 100% 100%;
  2005. }
  2006. .box-card .tit {
  2007. text-align: center;
  2008. padding-right: 65px;
  2009. margin-bottom: 40px;
  2010. }
  2011. .box-card .tit span {
  2012. font-size: 18px;
  2013. color: #666666;
  2014. }
  2015. .selIcon {
  2016. padding-right: 30px;
  2017. margin-bottom: 30px;
  2018. }
  2019. .selIcon div {
  2020. text-align: center;
  2021. cursor: pointer;
  2022. }
  2023. .selIcon div i {
  2024. display: block;
  2025. width: 44px;
  2026. height: 44px;
  2027. background: url("./../assets/st-img/satisfied.png") no-repeat;
  2028. background-size: 100% 100%;
  2029. margin-bottom: 10px;
  2030. }
  2031. .selIcon div span {
  2032. /* display: block; */
  2033. }
  2034. .selIcon div .comm {
  2035. background: url("./../assets/st-img/comm2.png") no-repeat;
  2036. }
  2037. .selIcon div .sfd {
  2038. background: url("./../assets/st-img/Satisfied2.png") no-repeat;
  2039. }
  2040. .selIcon div .comm2 {
  2041. background: url("./../assets/st-img/comm.png") no-repeat;
  2042. }
  2043. .selIcon div .notSfd {
  2044. background: url("./../assets/st-img/notSatisfied2.png")
  2045. }
  2046. .selIcon div .notSfd2 {
  2047. background: url("./../assets/st-img/notSatisfied.png")
  2048. }
  2049. .levMsg {
  2050. padding-right: 30px;
  2051. margin-bottom: 20px;
  2052. }
  2053. .sure {
  2054. text-align: center;
  2055. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  2056. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  2057. border-radius: 10px;
  2058. width: 100px;
  2059. height: 48px;
  2060. line-height: 48px;
  2061. color: #fff;
  2062. position: absolute;
  2063. bottom: 30px;
  2064. left: 37%;
  2065. cursor: pointer;
  2066. }
  2067. /* 验证框 */
  2068. .logo {
  2069. text-align: center;
  2070. margin-bottom: 20px;
  2071. }
  2072. .logo span {
  2073. font-size: 38px;
  2074. font-weight: bold;
  2075. color: #5EA0F7;
  2076. font-family: Microsoft YaHei;
  2077. }
  2078. .logo span:nth-child(1) {
  2079. color: #F04992;
  2080. }
  2081. .formBox {
  2082. padding: 0 27px 0 0;
  2083. }
  2084. .formBox .el-input {
  2085. margin-bottom: 21px;
  2086. }
  2087. .formBox .phone .el-input, .formBox .email .el-input {
  2088. margin-bottom: 0;
  2089. }
  2090. .formBox .phone, .formBox .email {
  2091. margin-bottom: 10px;
  2092. }
  2093. .vertion {
  2094. vertical-align: middle;
  2095. /* margin-bottom: 28px; */
  2096. }
  2097. .vertion .el-input {
  2098. width: 250px;
  2099. margin-right: 15px;
  2100. display: inline-block;
  2101. }
  2102. .vertion span {
  2103. display: inline-block;
  2104. width: 128px;
  2105. height: 40px;;
  2106. vertical-align: middle;
  2107. background: rgba(241, 225, 224, 1);
  2108. }
  2109. .formBox .sure {
  2110. bottom: 21px;
  2111. }
  2112. .el-card__body .tit {
  2113. line-height: 25px;
  2114. }
  2115. .chatting .el-button {
  2116. border: none;
  2117. padding: 0;
  2118. border-radius: 0
  2119. }
  2120. .emoticon {
  2121. width: 30px;
  2122. height: 30px;
  2123. display: inline-block;
  2124. }
  2125. .pointer {
  2126. cursor: pointer;
  2127. }
  2128. .ly:hover {
  2129. border-bottom: 1px solid #5EA0F7;
  2130. /* 高亮效果 */
  2131. filter: brightness(0.9);
  2132. }
  2133. .gl:hover {
  2134. filter: brightness(0.9);
  2135. }
  2136. .seek:hover {
  2137. background: #860c60
  2138. }
  2139. .sendCol {
  2140. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  2141. }
  2142. .netSendCol {
  2143. cursor: not-allowed;
  2144. }
  2145. /* 修改滚动条 */
  2146. ::-webkit-scrollbar-button {
  2147. background: transparent;
  2148. border: 0;
  2149. }
  2150. /* 顶部三个图标 */
  2151. .imgBox i {
  2152. display: inline-block;
  2153. width: 25px;
  2154. height: 25px;
  2155. margin-right: 20px;
  2156. background: url("./../assets/st-img/pj.png") no-repeat;
  2157. background-size: 100% 100%;
  2158. vertical-align: middle;
  2159. }
  2160. .imgBox .sy {
  2161. background: url("./../assets/st-img/sy.png") no-repeat;
  2162. }
  2163. .imgBox .sq {
  2164. background: url("./../assets/st-img/sq.png") no-repeat;
  2165. }
  2166. /* .sc:hover{
  2167. background: url("./../assets/st-img/pjhover.png") no-repeat;
  2168. }
  2169. .sy:hover{
  2170. background: url("./../assets/st-img/sy2.png")no-repeat;
  2171. }
  2172. .sq:hover{
  2173. background: url("./../assets/st-img/sq2.png") no-repeat;
  2174. } */
  2175. i.scActy {
  2176. background: #1654D1 url("./../assets/st-img/pjhover.png") no-repeat;
  2177. width: 33px;
  2178. height: 33px;
  2179. background-position: 5px;
  2180. }
  2181. /* .imgBox .syActy{
  2182. background:#1654D1 url("./../assets/st-img/jzsy.png") no-repeat;
  2183. width: 33px;
  2184. height: 33px;
  2185. background-position: 5px;
  2186. }
  2187. .imgBox .sqActy{
  2188. background: #1654D1 url("./../assets/st-img/sq2.png") no-repeat;
  2189. width: 33px;
  2190. height: 33px;
  2191. transform: rotate(180deg);
  2192. background-position: 5px;
  2193. } */
  2194. .tips {
  2195. font-size: 12px;
  2196. color: #F04992;
  2197. }
  2198. #main {
  2199. position: relative;
  2200. }
  2201. .retract {
  2202. position: absolute;
  2203. right: 0;
  2204. top: 290px;
  2205. z-index: 999;
  2206. }
  2207. /* 滚动条样式 */
  2208. .scroll::-webkit-scrollbar {
  2209. border: 5px solid #fff;
  2210. }
  2211. .scroll::-webkit-scrollbar {
  2212. width: 5px;
  2213. height: 20px;
  2214. }
  2215. .scroll::-webkit-scrollbar-button {
  2216. width: 0px;
  2217. height: 0px;
  2218. }
  2219. .scroll::-webkit-scrollbar-thumb {
  2220. border-radius: 5px;
  2221. box-shadow: inset 0 0 0 5px #aaa;
  2222. border: .02rem solid transparent;
  2223. }
  2224. .scroll::-webkit-scrollbar-track {
  2225. display: block;
  2226. background: rgba(0, 0, 0, 0.1);
  2227. }
  2228. #logo {
  2229. margin-right: 10px;
  2230. width: 40px;
  2231. height: 40px;
  2232. line-height: 40px;
  2233. display: inline-block;
  2234. border-radius: 50%;
  2235. vertical-align: sub;
  2236. position: relative;
  2237. top: 10px;
  2238. }
  2239. .duty {
  2240. display: inline-block;
  2241. width: 60px;
  2242. white-space: nowrap;
  2243. overflow: hidden;
  2244. text-overflow: ellipsis;
  2245. vertical-align: bottom;
  2246. }
  2247. </style>