chat.vue 68 KB

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