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