chat.vue 63 KB

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