chat.vue 48 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913
  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"><span>智能客服</span></el-col>
  8. <el-col class="tit nopd" v-else-if="machineAndAtl == 100"><span v-if="service">{{service.serverInfo.name}}</span>
  9. </el-col>
  10. <el-col>
  11. <div class="imgBox">
  12. <i v-if="selNum > chatNum" @click="ejectEvl(10)" class="sc pointer"
  13. :class="selType?'scActy':''"></i>
  14. <div style="float: right" class="pointer" @click="leaveMsg()">
  15. <span style="font-size: 25px; color: #b3c1e7; margin-top: 13px;" @click="back()"
  16. class="el-icon-chat-line-round"></span>
  17. </div>
  18. <!-- <i class="sy pointer" @click="select(2)" :class="syType?'syActy':''"></i>
  19. <i class="sq pointer" @click="select(3)" :class="sqType?'sqActy':''"></i>-->
  20. </div>
  21. </el-col>
  22. </el-row>
  23. </el-header>
  24. <div class="cationer">
  25. <!--****************************** 聊天会话框模块 *****************************-->
  26. <el-main>
  27. <!-- 广告展示隐藏按钮 -->
  28. <div class="retract pointer" @click="retract()">
  29. <img src="./../assets/st-img/retract.png" alt="" v-if="retractShow">
  30. <img src="./../assets/st-img/retract2.png" alt="" v-else>
  31. </div>
  32. <el-row class="pd informationBox scroll" id="main">
  33. <!-------------------机器人聊天板块 ----------------------->
  34. <div v-if="machineAndAtl == 10">
  35. <!--··············· 欢迎语 ············-->
  36. <div class="conversationBox" v-if="machine != ''">
  37. <div class=" row">
  38. <div class="conversation row">
  39. <div class="headImg">
  40. <img src="./../assets/st-img/headAdvent.png" alt="">
  41. </div>
  42. <div class="cont left">
  43. <div>{{machine.content}}</div>
  44. </div>
  45. </div>
  46. <div style="width:66px;"></div>
  47. </div>
  48. </div>
  49. <!--··········· 快捷问题回答模块 ············-->
  50. <div class="questionList" v-if="questionShow">
  51. <section v-for="(item,idx) in problem" :key="item.id">
  52. <div @click="answers(idx)">
  53. <span class="pointer gl">{{item.robot_name}}</span>
  54. </div>
  55. </section>
  56. <section>
  57. <div>
  58. <span class="col6">上面问题都不是</span>
  59. <span class="pointer ly" @click="changeService()">转人工客服</span>
  60. </div>
  61. </section>
  62. </div>
  63. <!--················ 和机器人会话发送消息 ·············-->
  64. <div v-for="item in chatCont" :key="item.id">
  65. <!-- 用户发文本信息 -->
  66. <div class="conversationBox" v-if="item.type =='user'">
  67. <div class="timer">{{item.time}}</div>
  68. <div class="customer row allAlignment">
  69. <div style="width:66px;"></div>
  70. <div class="row">
  71. <!-- 显示内容 -->
  72. <div v-if="item.chat" class="cont right">
  73. <div v-html="item.chat"></div>
  74. </div>
  75. <div v-else class=" right noafter" style="width:200px;margin-right:10px; ">
  76. <div slot="file">
  77. <img class="el-upload-list__item-thumbnail"
  78. @click="handlePictureCardPreview(url+item.imgUrl)"
  79. style="width:100%;height:auto;border-radius: 10px;"
  80. :src="url+item.imgUrl" alt="">
  81. </div>
  82. </div>
  83. <!-- 图片放大 -->
  84. <el-dialog :visible.sync="dialogVisible">
  85. <img width="100%" :src="dialogImageUrl" alt="">
  86. </el-dialog>
  87. <!-- 头像 -->
  88. <div class="headImg">
  89. <img :src="user_info.avatar" alt="">
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. <!-- 机器人无法回答转人工 -->
  95. <div class="conversationBox" v-if="item.type == 1001">
  96. <div class=" row">
  97. <div class="conversation row">
  98. <div class="headImg">
  99. <img src="./../assets/st-img/headAdvent.png" alt="">
  100. </div>
  101. <div class="cont left">
  102. <div>您的问题暂时无法处理</div>
  103. <div>
  104. <span class="col">问题没有解决?</span>
  105. <span class="change pointer ly"
  106. @click="changeService()">转人工客服</span>
  107. </div>
  108. </div>
  109. </div>
  110. <div style="width:66px;"></div>
  111. </div>
  112. </div>
  113. <!-- 机器人回答 -->
  114. <div class="conversationBox" v-else-if='item.type == "service"'>
  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>{{item.cont}}</div>
  122. </div>
  123. </div>
  124. <div style="width:66px;"></div>
  125. </div>
  126. </div>
  127. <!-- 快捷问题回答 -->
  128. <div class="conversationBox" v-else-if="item.type == 'machine'">
  129. <div class="timer">
  130. {{item.robot_addTime}}
  131. </div>
  132. <div class=" row">
  133. <div class="conversation row">
  134. <div class="headImg">
  135. <img src="./../assets/st-img/headAdvent.png" alt="">
  136. </div>
  137. <div class="cont left">
  138. <div>{{item.robot_content}}</div>
  139. <div>
  140. <span class="col">问题没有解决</span>
  141. <span class="change pointer ly"
  142. @click="changeService()">转人工客服</span>
  143. </div>
  144. </div>
  145. </div>
  146. <div style="width:66px;"></div>
  147. </div>
  148. </div>
  149. <!-- 转接客服列表 -->
  150. <div class="changeService" v-else-if="item.type == 'artService'">
  151. <div v-for="(itemList,idx) in serviceList" :key="idx">
  152. <span class="col6">人工客服:</span>
  153. <span class="colE5 pointer gl" @click="jumpService(itemList.id)">{{itemList.name}}</span>
  154. </div>
  155. </div>
  156. </div>
  157. <!--············· 各种消息提示框 ··············-->
  158. <!-- 客服不在线帮助提示框 -->
  159. <div class="promptBox" v-if="artAndLeave == 100">
  160. <div class="prompt help">
  161. <span>当前客服不在线,如需帮助请</span>
  162. <span class="colE5 ly pointer" @click="leaveMsg()">留言</span>
  163. </div>
  164. </div>
  165. </div>
  166. <!--············ 和人工会话聊天模块 ··············-->
  167. <div v-if="machineAndAtl == 100">
  168. <!-- 人工客服回复消息 -->
  169. <div v-for="item in customerSviceChat" :key="item.id">
  170. <!-- tem.cont != '' -->
  171. <div class="conversationBox" v-if="item.type == 'service' ">
  172. <div class="timer"> {{item.time}}</div>
  173. <div class=" row">
  174. <div class="conversation row">
  175. <div class="headImg">
  176. <img :src="serviceImg?url+serviceImg:require('@/assets/st-img/kf.png')"
  177. alt="">
  178. </div>
  179. <div class="cont left">
  180. <div v-if="item.content != ''" v-html="item.content"></div>
  181. <div v-else slot="file">
  182. <img class="el-upload-list__item-thumbnail"
  183. @click="handlePictureCardPreview(url+item.imgUrl)"
  184. style="width:100%;height:auto;border-radius: 10px;"
  185. :src="url+item.imgUrl" alt="">
  186. </div>
  187. </div>
  188. </div>
  189. <div style="width:66px;"></div>
  190. </div>
  191. </div>
  192. <!-- 用户发送文本消息 -->
  193. <div class="conversationBox" v-if="item.type == 'user' ">
  194. <div>
  195. <div class="timer">{{item.time}}</div>
  196. <div class="customer row allAlignment">
  197. <div style="width:66px;"></div>
  198. <div class="row">
  199. <div class="cont right">
  200. <div v-if="item.content != ''" v-html="item.content"></div>
  201. <div v-else slot="file">
  202. <img class="el-upload-list__item-thumbnail"
  203. @click="handlePictureCardPreview(url+item.imgUrl)"
  204. style="width:100%;height:auto;border-radius: 10px;"
  205. :src="url+item.imgUrl" alt="">
  206. </div>
  207. </div>
  208. <div class="headImg">
  209. <img :src="user_info.avatar" alt="">
  210. </div>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. <!-- 点击图片放大 -->
  216. <el-dialog :visible.sync="dialogVisible">
  217. <img width="100%" :src="dialogImageUrl" alt="">
  218. </el-dialog>
  219. </div>
  220. <!-- 评价 -->
  221. <div class="evaluate" @click="ejectEvl(10)" v-if="consult">
  222. <span>欢迎你的咨询,请对我们的服务做出评价</span>
  223. <span class="btn seek">评价</span>
  224. </div>
  225. <div class="promptBox " v-if="comtSuccess">
  226. <div class="prompt help">
  227. <span>您对我们的服务评价为: {{comtCount}}。非常感谢!</span>
  228. </div>
  229. </div>
  230. </div>
  231. </el-row>
  232. <!--·········· 文本编辑框 ···········-->
  233. <el-row class="chatting">
  234. <el-col>
  235. <!-- 发送图和表情按钮 -->
  236. <div style="height:18px; display:flex;">
  237. <el-popover placement="top-start" width="200" trigger="hover"
  238. style="margin-top: -2px;">
  239. <ul>
  240. <li class="emoticon" v-for="(item,index) in frceArr" :key="item.id">
  241. <img class="pointer" :src="require(`@/assets/st-img/${index}.gif`)"
  242. @click="memeImg(index)" alt="">
  243. </li>
  244. </ul>
  245. <el-button class="expression" slot="reference"></el-button>
  246. </el-popover>
  247. <el-upload class="avatar-uploader" action="/api/index/upload/uploadImg"
  248. :on-success="handleAvatarSuccess"
  249. :before-upload="beforeAvatarUpload"
  250. :on-error='handError'
  251. list-type='no' accept="image/jpeg,image/jpg,image/png,image/svg">
  252. <!-- <img v-if="imageUrl" :src="imageUrl" class="avatar"> -->
  253. <i slot="default" class=" photo"></i>
  254. </el-upload>
  255. </div>
  256. <div class="row center allAlignment chattingBox">
  257. <div style="height:44px;width:300px;">
  258. <textarea name=""
  259. id=""
  260. v-model="information"
  261. cols="30"
  262. rows="1"
  263. placeholder="请输入你的问题:"
  264. @keyup.enter.exact="listenEnter"
  265. @keyup.ctrl.enter="lineFeed()"
  266. >
  267. </textarea>
  268. </div>
  269. <div>
  270. <!-- 准备修改 -->
  271. <div @click="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?sendInfo():''):''"
  272. class="sendOut pointer"
  273. :class="sendCol?(!closeByServer||artAndLeave==0||artAndLeave==100?'sendCol':'netSendCol'):'netSendCol'">
  274. <span class="">发送</span>
  275. </div>
  276. </div>
  277. </div>
  278. </el-col>
  279. </el-row>
  280. </el-main>
  281. <el-aside width='255px' v-if="retractShow">
  282. <el-row class="rt">
  283. <el-col :span='24' class="artificial pd20">
  284. <div class="infor">
  285. <div v-if="machineAndAtl == 10">
  286. <span>姓名:</span>
  287. <span>{{service.kf_name ? service.kf_name : '智能客服' }}</span>
  288. </div>
  289. <div v-else-if="machineAndAtl == 100">
  290. <span>姓名:</span>
  291. <span v-if="service">{{ service.serverInfo.name ? service.serverInfo.name : '001客服' }}</span>
  292. </div>
  293. <div>
  294. <span>工号:</span>
  295. <span>{{service.serverInfo ? service.serverInfo.job_name : '001'}}</span>
  296. </div>
  297. <div>
  298. <span>性别:</span>
  299. <span>保密</span>
  300. </div>
  301. <div>
  302. <span>职务:</span>
  303. <span>咨询客服</span>
  304. </div>
  305. </div>
  306. <div class="headPortrait">
  307. <img :src="service.serverInfo?(url+service.serverInfo.avatar):require('@/assets/st-img/kf.png')"
  308. alt="">
  309. </div>
  310. </el-col>
  311. <el-col class="autograph pd20">
  312. <div>
  313. <span>个性签名:</span>
  314. <span>{{service.serverInfo ? service.serverInfo.signature :'' }}</span>
  315. </div>
  316. </el-col>
  317. <el-col class="advent" v-for="imgs in advert" :key="imgs.id">
  318. <a :href="'http://'+imgs.advertisement_url" target="_blank" rel="noopener noreferrer">
  319. <img :src="url + imgs.advertisement_img" alt="">
  320. </a>
  321. </el-col>
  322. </el-row>
  323. </el-aside>
  324. </div>
  325. <!-- 评价框 -->
  326. <el-card class="box-card" v-if="evlShow">
  327. <!-- <div class="close" @click="closeEvl(10)"> -->
  328. <!-- <i></i> -->
  329. <!-- </div> -->
  330. <div class="tit">
  331. <span>感谢您的咨询,请对我们的服务做出评价</span>
  332. </div>
  333. <div class="selIcon row allAlignment">
  334. <div @click="chage(1)">
  335. <i :class="changeIcon == 10? '':'sfd'"></i>
  336. <span>满意</span>
  337. </div>
  338. <div @click="chage(2)">
  339. <i class="comm" :class="changeIcon == 100?'comm2':''"></i>
  340. <span>一般</span>
  341. </div>
  342. <div @click="chage(3)">
  343. <i class="notSfd" :class="changeIcon == 1000?'notSfd2':''"></i>
  344. <span>不满意</span>
  345. </div>
  346. </div>
  347. <div class="levMsg">
  348. <el-input type="textarea" rows="6" placeholder="评价备注" v-model="textarea">
  349. </el-input>
  350. </div>
  351. <div class="sure" @click="evaluateSure()">
  352. <span>确定</span>
  353. </div>
  354. </el-card>
  355. <div class="zzBox" v-if="zzShow"></div>
  356. </div>
  357. </div>
  358. </template>
  359. <script>
  360. import '../css/index.css';
  361. import frce from '../assets/frce.js';
  362. export default {
  363. data() {
  364. return {
  365. textarea: '',//备注
  366. evlShow: false, // 评价框显示
  367. zzShow: false, // 遮罩层显示
  368. vertion: '',//图形验证码
  369. provShow: true, // 验证框显示
  370. changeIcon: 10,
  371. name: '', // 验证框姓名model
  372. phone: '',// 验证框电话model
  373. email: '',// 验证框邮箱model
  374. frceArr: [], //表情包代码
  375. information: '',//发送的文本信息
  376. sendCol: false, // 发送按钮切换样式
  377. selType: false, //图标选中样式 true为选中,false为未选中
  378. selNum: 0, // 自增当达到某个条件显示图片
  379. // syType : false,
  380. // sqType : false,
  381. error: false,
  382. emlError: false,
  383. artAndLeave: 0, // 默认为100,转人工为10,人工不在转留言为100
  384. chatCont: [], // 客户会话数据
  385. imageUrl: [],//上传图片
  386. img: '', //上传的单个图片路径
  387. dialogVisible: false, //图片放大
  388. dialogImageUrl: '', // 放大的图片
  389. dialogUrl: false,
  390. serviceInfor: '', //客服信息
  391. websock: null, //会话初始值
  392. currTime: "", //获取系统时间
  393. apiToken: '',//系统Token
  394. machine: '', //机器会话信息
  395. advert: '', // 广告语
  396. problem: '', //机器智能问题
  397. macNotPro: false, //机器人问题无法解决显示
  398. answer: [], //解答问题的答案
  399. questionShow: true, // 问题显示
  400. consult: false, //评价模块显示
  401. type: 1001, //自增
  402. jumpArtl: false, // 跳转人工客服状态
  403. group: '', //客服组
  404. userConversation: {}, //用户当前会话
  405. machineAndAtl: 10, //默认为机器人,100为人工
  406. satisfaction: 1, //评价满意度,1为满意,2为一般,3为不满意
  407. url: 'http://kfadmin.bocai186.com', // 域名地址
  408. //url :'http://192.168.2.186:8090', // 域名地址
  409. user_info: '', // 用户信息
  410. // 人工客服信息
  411. service: '',
  412. serviceList: [], //后台推送的人工客服列表
  413. customerWelCome: '', // 客服欢迎语
  414. customerSviceChat: [], // 客服会话信息
  415. serviceImg: '',
  416. timerVote: '', //存储上一次时间
  417. curtTimer: '',//当前时间
  418. returnTimer: '',//返回当前时间
  419. // isConnection:true,//人工分组列表开关
  420. chatNum: '', // 会话数量
  421. comtSuccess: false, // 评论发送成功显示
  422. comtCount: '', // 评论成功返回的满意度
  423. retractShow: true, // 展开侧边栏
  424. sensitive: [], //敏感词1
  425. senType: false,//敏感词状态
  426. sensitiveNumber: 0,//敏感词次数
  427. doubSensitive: [],//重复的敏感词
  428. senInfo: '', //敏感词数据
  429. // sensitiveWordsNumber:0,
  430. hourse: '', //返回时间,小时
  431. closeByServer: false, //客服关闭会话
  432. serverNotOnlin: false, //客服掉线
  433. willOverTime: '', //超时关闭会话
  434. allLoading: true, //整个页面加载中
  435. webTime: '',//网络时间
  436. /*****************websockt心跳变量*******************/
  437. reconnectData: null,
  438. lockReconnect: false, //避免重复连接,因为onerror之后会立即触发 onclose
  439. timeout: 10000, //10s一次心跳检测
  440. timeoutObj: null,
  441. serverTimeoutObj: null,
  442. }
  443. },
  444. methods: {
  445. // 回车提交
  446. listenEnter(){
  447. this.sendInfo();
  448. },
  449. // ctrl+center 换行
  450. lineFeed(){
  451. this.information = this.information + '\n'
  452. },
  453. // 切换留言板返回
  454. back(){
  455. this.$emit('value',100)
  456. },
  457. /******************文字信息转表情******************/
  458. turnFace(data) {
  459. let str = data.match(/\#\[.*?\]\//g);
  460. let arr = Array.from(new Set(str));
  461. arr.forEach(e => {
  462. let imgsrc = '';
  463. for (let i = 0; i < this.frceArr.length; i++) {
  464. let expText = e.slice(1, e.length - 1);
  465. if (expText == this.frceArr[i]) {
  466. imgsrc = '<img class="hover" src="' + require(`@/assets/st-img/${i}.gif`) + '"/>'
  467. break;
  468. }
  469. }
  470. data = data.replace(new RegExp(`\\#\\[${e.substring(2, e.length - 2)}\\]\\/`, 'g'), imgsrc);
  471. })
  472. return data;
  473. },
  474. // 关闭加载中
  475. allLoadingClose() {
  476. this.allLoading = false;
  477. },
  478. /**************切换显示客服信息**************** */
  479. retract() {
  480. this.retractShow = !this.retractShow;
  481. },
  482. /***************发送图片***************/
  483. beforeAvatarUpload(file) {
  484. let self = this
  485. const isJPG = file.type == 'image/jpeg' || 'image/jpg' || 'image/png' || 'image/svg';
  486. const isLt2M = file.size / 1024 / 1024 < 2;
  487. if (!isJPG) {
  488. this.$message.error('上传只能是图片格式!');
  489. }
  490. if (!isLt2M) {
  491. this.$message.error('上传图片大小不能超过 2MB!');
  492. }
  493. //对图片进行压缩
  494. const imgSize = file.size / 1024 / 1024;
  495. if (imgSize > 0.5) {
  496. const _this = this
  497. return new Promise(resolve => {
  498. const reader = new FileReader()
  499. const image = new Image()
  500. image.onload = (imageEvent) => {
  501. const canvas = document.createElement('canvas');
  502. const context = canvas.getContext('2d');
  503. const width = image.width * 0.4;
  504. const height = image.height * 0.4;
  505. canvas.width = width;
  506. canvas.height = height;
  507. context.clearRect(0, 0, width, height);
  508. context.drawImage(image, 0, 0, width, height);
  509. const dataUrl = canvas.toDataURL(file.type);
  510. const blobData = _this.dataURItoBlob(dataUrl, file.type);
  511. resolve(blobData)
  512. }
  513. reader.onload = (e => {
  514. image.src = e.target.result;
  515. });
  516. reader.readAsDataURL(file);
  517. })
  518. }
  519. },
  520. dataURItoBlob(dataURI, type) {
  521. var binary = atob(dataURI.split(',')[1]);
  522. var array = [];
  523. for (var i = 0; i < binary.length; i++) {
  524. array.push(binary.charCodeAt(i));
  525. }
  526. return new Blob([new Uint8Array(array)], {type: type});
  527. },
  528. handError(err, file, fileList) {
  529. // 获取当前发送时间
  530. },
  531. /***************传输成功之后返回图片*************** */
  532. handleAvatarSuccess(res, file) {
  533. // console.log(res)
  534. this.dialogUrl = true;
  535. this.img = res.data.src;
  536. this.sendMessage();
  537. },
  538. /***************图片放大*************** */
  539. handlePictureCardPreview(url) {
  540. this.dialogImageUrl = url;
  541. this.dialogVisible = true;
  542. },
  543. /***************弹出评价框*************** */
  544. ejectEvl(type) {
  545. if (this.comtSuccess) return;
  546. this.changeIcon = 10;
  547. if (type == 10) {
  548. this.evlShow = true
  549. }
  550. this.zzShow = true;
  551. },
  552. /***************传入父组件进行组件切换*************** */
  553. leaveMsg() {
  554. this.$emit('value', 100)
  555. },
  556. //回到初始页面
  557. goBack(type) {
  558. if (type === 1) {
  559. this.artAndLeave = 0;
  560. this.chatCont = [];
  561. }else {
  562. this.machineAndAtl = 10;
  563. this.macNotPro = false;
  564. this.jumpArtl = false;
  565. this.time = '';
  566. this.returnTimer = '';
  567. // this.automaticRolling();
  568. this.initWebSocket();
  569. this.customerSviceChat = [];
  570. this.reconnect();
  571. }
  572. },
  573. /*******发送消息按钮*******/
  574. sendInfo() {
  575. this.closeByServer = false;
  576. this.artAndLeave = 0;
  577. this.jumpArtl = false;
  578. this.dialogUrl = false;
  579. this.sendMessage();
  580. },
  581. /***************改变评价框的满意度*************** */
  582. chage(type) {
  583. this.satisfaction = type;
  584. if (type == 1) {
  585. this.comtCount = '满意'
  586. this.changeIcon = 10;
  587. } else if (type == 2) {
  588. this.comtCount = '一般'
  589. this.changeIcon = 100;
  590. } else {
  591. this.comtCount = '不满意'
  592. this.changeIcon = 1000;
  593. }
  594. },
  595. /***************图标样式切换*************** */
  596. select(type) {
  597. if (type == 1) {
  598. this.selType = !this.selType;
  599. } else if (type == 2) {
  600. this.syType = !this.syType;
  601. } else {
  602. this.sqType = !this.sqType;
  603. }
  604. },
  605. /***************评价确认*************** */
  606. evaluateSure() {
  607. // 参数
  608. let params = {
  609. 'evaluateId': this.satisfaction,
  610. 'conversationId': this.service.conversationId,
  611. 'evaluateContent': this.textarea
  612. }
  613. this.$axios.get('/api/index/evaluate/putEvaluate', {
  614. params,
  615. headers: {
  616. 'Content-Type': 'application/x-www-form-urlencoded',
  617. 'apiToken': this.setApiToken('putevaluate', 'evaluate', this.currTime, 'index')
  618. }
  619. }).then(res => {
  620. if (res.data.code == 1) {
  621. this.evlShow = false;
  622. this.zzShow = false;
  623. this.textarea = '';
  624. this.comtSuccess = true;
  625. if (this.changeIcon == 10) {
  626. this.comtCount = '满意'
  627. }
  628. }
  629. })
  630. },
  631. /***************验证框确认*************** */
  632. yySure() {
  633. this.provShow = false;
  634. this.zzShow = false;
  635. },
  636. /***************转人工客服列表*************** */
  637. changeService() {
  638. // if(!this.isConnection) return
  639. this.$axios.post('/api/index/groups/index', {}, {
  640. headers: {
  641. 'Content-Type': 'application/x-www-form-urlencoded',
  642. 'apiToken': this.setApiToken('index', 'groups', this.currTime, 'index')
  643. }
  644. }).then(res => {
  645. if (res.data.code == 1) {
  646. this.serviceList = res.data.data;
  647. this.chatCont.push({
  648. 'type': 'artService'
  649. })
  650. this.automaticRolling();
  651. }
  652. })
  653. // this.isConnection = false;
  654. },
  655. /***************表情点击*************** */
  656. memeImg(i) {
  657. //当表情被点击
  658. this.information = this.information + "#" + this.frceArr[i] + "/";
  659. },
  660. /***************失去焦点做正则验证*************** */
  661. sureInfor(type) {
  662. if (type == 1) {
  663. if (!/^1[34578]\d{9}$/.test(this.phone)) {
  664. this.error = true;
  665. this.phone = '';
  666. } else {
  667. this.error = false;
  668. }
  669. } else if (type == 10) {
  670. if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) {
  671. this.emlError = true;
  672. this.email = '';
  673. } else {
  674. this.emlError = false;
  675. }
  676. }
  677. },
  678. /***************获取热点智能问题*************** */
  679. getProblem() {
  680. this.$axios.post('/api/index/robot/index', {groups_id: 1, robotgroups_id: 1}, {
  681. headers: {
  682. 'Content-Type': 'application/x-www-form-urlencoded',
  683. 'apiToken': this.setApiToken('index', 'robot', this.currTime, 'index')
  684. }
  685. }).then(res => {
  686. if (res.data.code == 1) {
  687. this.problem = res.data.data
  688. }
  689. })
  690. },
  691. /*****************获取聊天次数*******************/
  692. getChatNum() {
  693. this.$axios.post('/api/index/evaluate/minRound', '', {
  694. headers: {
  695. 'Content-Type': 'application/x-www-form-urlencoded',
  696. 'apiToken': this.setApiToken('minround', 'evaluate', this.currTime, 'index')
  697. }
  698. }).then(res => {
  699. if (res.data.code == 1) {
  700. this.chatNum = res.data.data.systemconfig_data
  701. }
  702. })
  703. },
  704. /*****************屏蔽关键字******************/
  705. shieldingKeyword(data) {
  706. //将敏感词组用|转换字符串
  707. let snstive = this.sensitive.join('|');
  708. //console.log(snstive);
  709. this.sensitiveNumber = 0;
  710. //匹配出会话中的敏感词
  711. return data.replace(eval('/' + snstive + '/g'), (res) => {
  712. var str = '';
  713. for (var i = 0; i < res.length; i++) {
  714. str += '*';
  715. }
  716. this.sensitiveNumber++;
  717. return str;
  718. })
  719. },
  720. /*---------------------------------------------------------------------------------*/
  721. /**************初始化WebSocket****************/
  722. initWebSocket() {
  723. let _this = this;
  724. let apiToken = this.$md5.hex_md5('customer-service' + this.currTime + window.location.origin);
  725. this.websock = new WebSocket('ws://103.108.43.176:9101?apiToken=' + apiToken);
  726. //this.websock = new WebSocket('ws://192.168.2.186:9101?apiToken=' + apiToken);
  727. // 数据接收
  728. this.websock.onmessage = this.websocketonmessage;
  729. // 连接建立之后
  730. this.websock.onopen = this.websocketonopen;
  731. // 连接建立失败重连
  732. this.websock.onerror = this.websocketonerror;
  733. // 关闭会话
  734. this.websock.onclose = this.websocketonclose;
  735. },
  736. /****************连接建立成功***************/
  737. websocketonopen() {
  738. console.log('链接成功');
  739. //心跳检测
  740. this.heatBeat()
  741. },
  742. /*************连接建立失败重连***************** */
  743. websocketonerror() {
  744. console.log('连接建立失败重连');
  745. this.goBack(1);
  746. },
  747. /**************数据接收***************** */
  748. websocketonmessage(e) {
  749. let redata = e
  750. if(e.data){
  751. redata = JSON.parse(e.data);
  752. }
  753. //心跳检测
  754. this.heatBeat()
  755. console.log(redata)
  756. // 欢迎语
  757. if (redata.message_type == 'helloMessage') {
  758. this.machine = redata.data;
  759. }
  760. // 广告语
  761. if (redata.message_type == 'advertisement') {
  762. this.advert = redata.data;
  763. }
  764. // 评价
  765. if (redata.message_type == 'getEvaluate') {
  766. this.consult = true;
  767. }
  768. //返回的会话时间
  769. if (redata.message_type == 'webTime') {
  770. //处理会话时间大于两分钟显示会话时间并且储存本次会话时间
  771. if (this.machineAndAtl == 100) {
  772. let num = this.customerSviceChat.length - 1;
  773. if (this.customerSviceChat[num].type == "user") {
  774. if (redata.data.webTime.split(":")[1] - this.webTime.split(":")[1] > 2) {
  775. this.$set(this.customerSviceChat[num], 'time', redata.data.webTime);
  776. this.webTime = redata.data.webTime;
  777. } else {
  778. this.$set(this.customerSviceChat[num], 'time', '');
  779. }
  780. }
  781. }
  782. }
  783. //会话超时提示
  784. if (redata.message_type == 'overtime') {
  785. console.log('接收会话超时');
  786. }
  787. // 链接客服信息
  788. if (redata.message_type == 'connect') {
  789. this.artAndLeave = 10;
  790. this.machineAndAtl = 100;
  791. this.service = redata.data;
  792. console.log(this.service, '============客服信息')
  793. this.serviceImg = redata.data.serverInfo.avatar;
  794. }
  795. // 暂无客服
  796. if (redata.message_type == 'wait') {
  797. let content = JSON.parse(redata.data.content)
  798. this.artAndLeave = 100;
  799. }
  800. //接收客服会话
  801. if (redata.message_type == 'chatMessage') {
  802. //存储会话超时间
  803. this.webTime = redata.data.time;
  804. //会话大于两分钟显示
  805. let timer = ''
  806. if (this.returnTimer == '') {
  807. timer = redata.data.time;
  808. this.returnTimer = redata.data.time
  809. } else {
  810. let timeStamp = this.returnTimer.split(":");
  811. let rdtime = redata.data.time.split(":");
  812. if (timeStamp[0] == rdtime[0]) {
  813. if ((rdtime[1] - timeStamp[1]) < 2) {
  814. timer = ''
  815. } else {
  816. timer = redata.data.time;
  817. }
  818. }
  819. }
  820. //
  821. let contType = this.isJSON(redata.data.content);
  822. let content = {};
  823. if (contType == false) {
  824. content.text = redata.data.content
  825. } else {
  826. content = JSON.parse(redata.data.content)
  827. }
  828. let obj = {
  829. time: timer,
  830. content: content.text ? this.turnFace(content.text) : '',
  831. imgUrl: content.img ? content.img : '',
  832. type: 'service'
  833. }
  834. this.customerSviceChat.push(obj);
  835. // console.log(this.customerSviceChat);
  836. this.selNum++;
  837. this.automaticRolling();
  838. }
  839. //接收机器会话
  840. if (redata.message_type == 'robotMessage') {
  841. if (redata.data.content == 'error') {
  842. let _this = this;
  843. this.chatCont.push({type: 1001})
  844. this.automaticRolling();
  845. } else {
  846. this.chatCont.push({
  847. 'robot_content': redata.data.content,
  848. 'type': 'machine'
  849. })
  850. this.automaticRolling();
  851. }
  852. let num = this.chatCont.length - 2;
  853. if (this.webTime) {
  854. if (redata.data.time.split(":")[1] - this.webTime.split(":")[1] > 2) {
  855. this.$set(this.chatCont[num], 'time', redata.data.time);
  856. this.webTime = redata.data.time;
  857. } else {
  858. this.$set(this.chatCont[num], 'time', '');
  859. }
  860. } else {
  861. this.webTime = redata.data.time;
  862. this.$set(this.chatCont[num], 'time', redata.data.time);
  863. }
  864. }
  865. // 没有客服上线.
  866. if (redata.message_type == 'notice') {
  867. this.artAndLeave = 100;
  868. this.automaticRolling();
  869. this.machineAndAtl = 10;
  870. this.jumpArtl = false;
  871. }
  872. // 客服关闭会话.
  873. if (redata.message_type == 'closeBysever') {
  874. this.goBack(1);
  875. this.lockReconnect = true;
  876. clearTimeout(this.reconnectData); //离开清除 timeout
  877. clearTimeout(this.timeoutObj); //离开清除 timeout
  878. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  879. }
  880. // 客服掉线.
  881. if (redata.message_type == 'serviceoffline') {
  882. this.serverNotOnlin = true;
  883. this.closeByServer = true;
  884. this.automaticRolling();
  885. }
  886. // 超时.
  887. if (redata.message_type == 'overtime') {
  888. this.willOverTime = redata.data.content;
  889. this.automaticRolling();
  890. }
  891. },
  892. /************关闭会话*******************/
  893. websocketonclose(e) {
  894. console.log('断开会话', e);
  895. this.goBack();
  896. },
  897. /*************数据发送***************** */
  898. websocketsend(data) {
  899. this.websock.send(data);
  900. },
  901. /***************************************/
  902. //socket重连
  903. reconnect() {
  904. console.log('=========重连==============')
  905. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  906. return
  907. }
  908. this.lockReconnect = true;
  909. this.reconnectData && clearTimeout(this.reconnectData);
  910. this.reconnectData = setTimeout(() => {
  911. this.initWebSocket();
  912. this.lockReconnect = false;
  913. }, 5000)
  914. },
  915. /*************************************/
  916. //心跳检测
  917. heatBeat() {
  918. this.timeoutObj && clearTimeout(this.timeoutObj);
  919. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  920. this.timeoutObj = setTimeout(() => {
  921. console.log('发送', {type: 'ping'});
  922. this.websocketsend(JSON.stringify({type: 'ping'})) //根据后台要求发送
  923. this.serverTimeoutObj = setTimeout(() => {
  924. this.websock.close(); //如果 5秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  925. }, 5000);
  926. }, this.timeout)
  927. },
  928. /******************消息发送数据处理********************/
  929. sendMessage() {
  930. // 给机器人发送文本消息
  931. if (this.machineAndAtl == 10) {
  932. //给机器人发送文本消息-本地储存
  933. let datas = {
  934. time: '',
  935. chat: this.turnFace(this.shieldingKeyword(this.information)),
  936. imgUrl: this.img,
  937. type: 'user'
  938. }
  939. this.chatCont.push(datas)
  940. //消息发送-机器人
  941. this.websocketsend(JSON.stringify({
  942. type: 'toRobot',
  943. data: {
  944. groups_id: '1',
  945. robot_name: this.shieldingKeyword(this.information),
  946. webTime: this.webTime,
  947. robotgroups_id: '1',
  948. }
  949. }))
  950. } else if (this.machineAndAtl == 100) { //人工聊天
  951. //发送给客服消息-本地储存
  952. this.customerSviceChat.push({
  953. time: '',
  954. content: this.turnFace(this.shieldingKeyword(this.information)),
  955. imgUrl: this.img,
  956. type: 'user',
  957. });
  958. //消息发送-客服
  959. this.websocketsend(JSON.stringify({
  960. type: 'chatMessage',
  961. data: {
  962. from_name: this.user_info.name,
  963. from_avatar: this.user_info.avatar,
  964. from_id: this.user_info.id,
  965. content: JSON.stringify({
  966. text: this.information,
  967. img: this.img,
  968. type: 'user'
  969. }),
  970. webTime: this.webTime,
  971. to_id: this.service.kf_id,
  972. to_name: this.service.kf_name,
  973. sensitiveNumber: this.sensitiveNumber,
  974. conversationId: this.service.conversationId
  975. }
  976. }))
  977. }
  978. // 发送之后清空发送数据
  979. this.img = '';
  980. this.information = '';
  981. //高度自动向上滑动
  982. this.automaticRolling();
  983. },
  984. /*************设置token加密***************** */
  985. setApiToken(name, controller, time, modules) {
  986. return this.$md5.hex_md5(name + 'customer-service' + controller + time + modules)
  987. },
  988. /*************跳转人工客服***************** */
  989. jumpService(id) {
  990. this.jumpArtl = true;
  991. this.closeByServer = false;
  992. this.group = id;
  993. //人工会话登陆
  994. let data = {
  995. 'type': 'userInit',
  996. data: {
  997. 'uid': this.user_info.id,
  998. 'name': this.user_info.name,
  999. 'avatar': this.user_info.avatar,
  1000. 'group': this.group
  1001. }
  1002. }
  1003. this.websock.send(JSON.stringify(data));
  1004. },
  1005. /*************机器智能回答问题***************** */
  1006. answers(idx) {
  1007. let obj = {
  1008. 'robot_addTime': this.problem[idx].robot_addTime,
  1009. 'robot_content': this.problem[idx].robot_content,
  1010. 'type': 'machine'
  1011. }
  1012. this.information = this.problem[idx].robot_name
  1013. this.sendMessage();
  1014. this.automaticRolling();
  1015. },
  1016. /**************匿名注册**************** */
  1017. registered() {
  1018. let token = sessionStorage.getItem('token');
  1019. let data = {
  1020. token: token != null ? token : '',//
  1021. appid: this.$public.getQueryString('appid'),//
  1022. appuid: this.$public.getQueryString('appuid'),//
  1023. }
  1024. let obj = {
  1025. headers: {
  1026. "apiToken": this.setApiToken('autoreg', 'register', this.currTime, 'index')
  1027. }
  1028. }
  1029. this.$axios.post('/api/index/register/autoReg', data, obj).then(res => {
  1030. if (res.data.code == 1) {
  1031. this.user_info = res.data.data;
  1032. sessionStorage.setItem("token", res.data.data.token);
  1033. }
  1034. })
  1035. },
  1036. /***********聊天滑动的时候滑动滚动条到底部******************* */
  1037. automaticRolling() {
  1038. this.$nextTick(() => {
  1039. let msg = document.getElementById('main') // 获取对象
  1040. msg.scrollTop = msg.scrollHeight // 滚动高度
  1041. })
  1042. },
  1043. /**************获取敏感词**************** */
  1044. getSensitive() {
  1045. let obj = {
  1046. headers: {
  1047. 'Content-Type': 'application/x-www-form-urlencoded',
  1048. "apiToken": this.setApiToken('sensitivewords', 'index', this.currTime, 'index')
  1049. }
  1050. };
  1051. let data = {
  1052. userToken: ''
  1053. }
  1054. this.$axios.post('/api/index/index/sensitiveWords', '', obj).then(res => {
  1055. if (res.data.code == 1) {
  1056. console.log(res.data.data);
  1057. res.data.data.userSensitive.forEach(res => {
  1058. this.sensitive.push(res.sensitivewords_word)
  1059. })
  1060. }
  1061. })
  1062. },
  1063. /**********判定是否是JSON格式*********** */
  1064. isJSON(str) {
  1065. if (typeof str == 'string') {
  1066. try {
  1067. JSON.parse(str);
  1068. return true;
  1069. } catch (e) {
  1070. //console.log(e);
  1071. return false;
  1072. }
  1073. }
  1074. },
  1075. },
  1076. /**************页面加载中挂载**************** */
  1077. mounted() {
  1078. let self = this;
  1079. this.frceArr = frce.frce;
  1080. this.$axios.get('api/index/index/systime?t=' + new Date()).then(res => {
  1081. if (res.data.code == 1) {
  1082. // 获取系统时间
  1083. let date = res.data.data.time.split(" ");
  1084. date[0] = (new Date(date[0].replace(/-/g, '/')).getTime()) / 1000;
  1085. this.currTime = date[0];
  1086. this.hourse = date[1];
  1087. // 获取机器智能问题
  1088. this.getProblem();
  1089. // 匿名注册
  1090. this.registered();
  1091. setTimeout(() => {
  1092. //关闭加载条
  1093. this.allLoadingClose();
  1094. // 初始化websocket
  1095. this.initWebSocket();
  1096. }, 2000);
  1097. // 获取聊天次数
  1098. this.getChatNum();
  1099. // 获取敏感词
  1100. this.getSensitive();
  1101. }
  1102. })
  1103. },
  1104. // 组件挂载阶段
  1105. destroyed() {
  1106. this.websock.close() //离开路由之后断开websocket连接
  1107. this.lockReconnect = true;
  1108. clearTimeout(this.reconnectData); //离开清除 timeout
  1109. clearTimeout(this.timeoutObj); //离开清除 timeout
  1110. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  1111. },
  1112. computed: {
  1113. inforLeng() {
  1114. return this.information.length;
  1115. }
  1116. },
  1117. watch: {
  1118. inforLeng(val) {
  1119. if (val > 0) {
  1120. this.sendCol = true;
  1121. } else {
  1122. this.sendCol = false;
  1123. }
  1124. }
  1125. }
  1126. }
  1127. </script>
  1128. <style scoped>
  1129. .chatBox {
  1130. width: 700px;
  1131. position: relative;
  1132. }
  1133. .el-header {
  1134. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1135. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1136. }
  1137. .tit {
  1138. height: 100%;
  1139. line-height: 80px;
  1140. text-align: left;
  1141. padding-left: 20px;
  1142. }
  1143. .el-col span {
  1144. font-size: 18px;
  1145. color: #FFFFFF;
  1146. }
  1147. .imgBox {
  1148. text-align: right;
  1149. }
  1150. .imgBox img {
  1151. margin-right: 20px;
  1152. }
  1153. .imgBox img:nth-last-child(1) {
  1154. margin-right: 0
  1155. }
  1156. .el-main {
  1157. background: #fff;
  1158. width: 63%;
  1159. padding: 0;
  1160. }
  1161. .el-aside {
  1162. background: #F5F5F5;
  1163. width: 37%;
  1164. }
  1165. .cationer, .artificial {
  1166. display: flex;
  1167. justify-content: space-between;
  1168. /* align-items: center; */
  1169. }
  1170. .rt {
  1171. width: 100%;
  1172. box-sizing: inherit;
  1173. }
  1174. .artificial {
  1175. /* width: 150px; */
  1176. /* padding:0 20px; */
  1177. margin-top: 23px;
  1178. margin-bottom: 9px;
  1179. vertical-align: middle;
  1180. /* flex-direction: column;*/
  1181. }
  1182. .infor div {
  1183. margin-bottom: 3px;
  1184. }
  1185. .infor div span, .autograph span {
  1186. color: #999999;
  1187. font-size: 14px;
  1188. font-weight: 400;
  1189. }
  1190. .infor div span:nth-child(2), .autograph span:nth-child(2) {
  1191. color: #666666;
  1192. margin-left: 4px;
  1193. }
  1194. .headPortrait {
  1195. width: 46%;
  1196. height: 100px;
  1197. }
  1198. .headPortrait img {
  1199. width: 100%;
  1200. height: 100%;
  1201. }
  1202. .autograph {
  1203. margin-bottom: 11px;
  1204. }
  1205. .advent {
  1206. border-top: 1px solid #DDDDDD;
  1207. padding: 20px;
  1208. }
  1209. .advent img {
  1210. width: 100%;
  1211. height: 350px;
  1212. }
  1213. .pd {
  1214. padding: 20px;
  1215. }
  1216. .pd20 {
  1217. padding: 0 20px;
  1218. }
  1219. /* 会话 */
  1220. .conversationBox {
  1221. margin-top: 13px;
  1222. margin-bottom: 13px;
  1223. }
  1224. .timer {
  1225. text-align: center;
  1226. margin: 10px 0;
  1227. color: #999999;
  1228. font-size: 12px;
  1229. }
  1230. .headImg {
  1231. width: 40px;
  1232. height: 40px;
  1233. margin-right: 13px;
  1234. }
  1235. .headImg img {
  1236. display: inline-block;
  1237. width: 40px;
  1238. height: 40px;
  1239. }
  1240. .conversation .cont, .customer .cont {
  1241. background: #ffffff;
  1242. padding: 9px 8px 12px 10px;
  1243. display: inline-block;
  1244. border: 1px solid rgba(223, 223, 223, 1);
  1245. border-radius: 5px;
  1246. position: relative;
  1247. max-width: 270px;
  1248. }
  1249. .left::after {
  1250. position: absolute;
  1251. content: "";
  1252. display: inline-block;
  1253. left: -4px;
  1254. top: 5px;
  1255. width: 5px;
  1256. height: 9px;
  1257. background: #fff;
  1258. -webkit-transform: skewX(30deg);
  1259. transform: skewX(30deg);
  1260. /* z-index: -1; */
  1261. border-left: 1px solid #dfdfdf;
  1262. border-top: 1px solid #dfdfdf;
  1263. }
  1264. div.noafter::after {
  1265. content: '';
  1266. width: 0;
  1267. height: 0;;
  1268. display: inline;
  1269. position: relative;
  1270. border: 0;
  1271. }
  1272. .conversation .cont div, .customer .cont div {
  1273. color: #666666;
  1274. font-size: 16px;
  1275. }
  1276. .customer {
  1277. justify-content: space-between;
  1278. }
  1279. .customer .cont {
  1280. margin-right: 13px;
  1281. border: 0;
  1282. background: #5EA0F7;
  1283. max-width: 260px;
  1284. word-wrap: break-word;
  1285. word-break: normal;
  1286. }
  1287. .customer .cont div {
  1288. color: #FFFFFF;
  1289. }
  1290. .right::after {
  1291. position: absolute;
  1292. content: "";
  1293. display: inline-block;
  1294. right: -2px;
  1295. top: 6px;
  1296. width: 5px;
  1297. height: 9px;
  1298. background: #5ea0f7;
  1299. -webkit-transform: skewX(-30deg);
  1300. transform: skewX(-30deg);
  1301. border-left: 1px solid #5ea0f7;
  1302. border-top: 1px solid #5ea0f7;
  1303. }
  1304. .col {
  1305. color: #999999;
  1306. }
  1307. .change {
  1308. color: #5ea0f7;
  1309. }
  1310. .questionList, .changeService {
  1311. margin: 10px;
  1312. border: 1px solid rgba(223, 223, 223, 1);
  1313. border-radius: 5px;
  1314. }
  1315. .questionList div, .changeService div {
  1316. height: 40px;
  1317. line-height: 40px;
  1318. padding-left: 15px;
  1319. }
  1320. .questionList div span {
  1321. color: #5EA0F7;
  1322. font-size: 14px;
  1323. }
  1324. .questionList section:nth-child(odd), .changeService div:nth-child(odd) {
  1325. background: #F6F6F6;
  1326. }
  1327. .changeService div span {
  1328. font-size: 14px;
  1329. }
  1330. .changeService div span:nth-child(1) {
  1331. margin-right: 5px;
  1332. }
  1333. .col6 {
  1334. color: #666666 !important;
  1335. }
  1336. .colE5 {
  1337. color: #5EA0F7;
  1338. }
  1339. .promptBox {
  1340. display: flex;
  1341. justify-content: center;
  1342. height: 26px;
  1343. margin: 10px 0 10px;
  1344. /* line-height: 26px; */
  1345. }
  1346. .promptBoxH {
  1347. display: flex;
  1348. justify-content: center;
  1349. height: 50px;
  1350. margin: 10px 0 10px;
  1351. /* line-height: 26px; */
  1352. }
  1353. .prompt {
  1354. line-height: 25px;
  1355. text-align: center;
  1356. background: #DDDDDD;
  1357. border-radius: 30px;
  1358. width: 140px;
  1359. color: #FFFFFF;
  1360. font-size: 12px;
  1361. }
  1362. .help {
  1363. width: 260px;
  1364. }
  1365. .help .prompt {
  1366. width: 100%;
  1367. }
  1368. /* 评论 */
  1369. .evaluate {
  1370. height: 101px;
  1371. padding: 19px 0 16px;
  1372. background: rgba(255, 255, 255, 1);
  1373. border: 1px solid rgba(223, 223, 223, 1);
  1374. border-radius: 10px;
  1375. margin-top: 15px;
  1376. text-align: center;
  1377. position: relative;
  1378. box-sizing: border-box;
  1379. }
  1380. .evaluate span {
  1381. font-size: 14px;
  1382. color: #666666;
  1383. }
  1384. .nopd {
  1385. padding: 0;
  1386. }
  1387. .evaluate .btn {
  1388. display: block;
  1389. background: #F04992;
  1390. border-radius: 10px;
  1391. margin-top: 10px;
  1392. color: #FFFFFF;
  1393. height: 36px;
  1394. line-height: 36px;
  1395. width: 100px;
  1396. position: absolute;
  1397. bottom: 16px;
  1398. left: 35%;
  1399. cursor: pointer;
  1400. }
  1401. /* 聊天框 */
  1402. .chatting {
  1403. width: 100%;
  1404. background: rgba(255, 255, 255, 1);
  1405. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1406. height: 100px;
  1407. padding: 10px 20px;
  1408. }
  1409. .informationBox {
  1410. height: 500px;
  1411. overflow: auto;
  1412. }
  1413. .expression, .photo {
  1414. display: inline-block;
  1415. width: 18px;
  1416. height: 18px;
  1417. background: url("./../assets/st-img/expression.png") no-repeat;
  1418. background-size: 100% 100%;
  1419. cursor: pointer;
  1420. margin-right: 18px;
  1421. }
  1422. .expression:hover {
  1423. background: url("./../assets/st-img/expressionHover.png") no-repeat;
  1424. background-size: 100% 100%;
  1425. }
  1426. .photo {
  1427. background: url("./../assets/st-img/photo.png") no-repeat;
  1428. background-size: 100% 100%;
  1429. }
  1430. .photo:hover {
  1431. background: url("./../assets/st-img/photoHover.png") no-repeat;
  1432. background-size: 100% 100%;
  1433. }
  1434. textarea {
  1435. height: 30px;
  1436. width: 300px;
  1437. border: 0;
  1438. -webkit-user-select: auto;
  1439. user-select: auto;
  1440. -o-user-select: auto;
  1441. -ms-user-select: auto;
  1442. resize: none;
  1443. outline: none;
  1444. padding-top: 10px;
  1445. }
  1446. .sendOut {
  1447. width: 80px;
  1448. height: 44px;
  1449. line-height: 40px;
  1450. border: 1px solid rgba(221, 221, 221, 1);
  1451. border-radius: 5px;
  1452. text-align: center;
  1453. margin-left: 20px;
  1454. }
  1455. .sendOut span {
  1456. color: #CCCCCC;
  1457. font-size: 16px;
  1458. }
  1459. .chattingBox {
  1460. margin-top: 12px;
  1461. }
  1462. /* 评论弹框 */
  1463. .zzBox {
  1464. position: absolute;
  1465. width: 100%;
  1466. height: 100%;
  1467. background: rgba(0, 0, 0, 0.3)
  1468. }
  1469. .box-card, .proving {
  1470. width: 494px;
  1471. height: 429px;
  1472. position: absolute;
  1473. left: 50%;
  1474. top: 50%;
  1475. transform: translate(-50%, -50%);
  1476. z-index: 999;
  1477. border-radius: 10px;
  1478. padding: 20px 20px 30px 50px;
  1479. box-sizing: border-box;
  1480. }
  1481. .proving {
  1482. padding: 20px 20px 30px 47px;
  1483. }
  1484. /* .close{
  1485. text-align: right;
  1486. cursor: pointer;
  1487. } */
  1488. /* .close i{
  1489. display: inline-block;
  1490. width: 18px;
  1491. height: 18px;
  1492. background: url("./../assets/st-img/close.png") no-repeat;
  1493. background-size: 100% 100%;
  1494. } */
  1495. .box-card .tit {
  1496. text-align: center;
  1497. padding-right: 65px;
  1498. margin-bottom: 40px;
  1499. }
  1500. .box-card .tit span {
  1501. font-size: 18px;
  1502. color: #666666;
  1503. }
  1504. .selIcon {
  1505. padding-right: 30px;
  1506. margin-bottom: 30px;
  1507. }
  1508. .selIcon div {
  1509. text-align: center;
  1510. cursor: pointer;
  1511. }
  1512. .selIcon div i {
  1513. display: block;
  1514. width: 44px;
  1515. height: 44px;
  1516. background: url("./../assets/st-img/satisfied.png") no-repeat;
  1517. background-size: 100% 100%;
  1518. margin-bottom: 10px;
  1519. }
  1520. .selIcon div span {
  1521. /* display: block; */
  1522. }
  1523. .selIcon div .comm {
  1524. background: url("./../assets/st-img/comm2.png") no-repeat;
  1525. }
  1526. .selIcon div .sfd {
  1527. background: url("./../assets/st-img/Satisfied2.png") no-repeat;
  1528. }
  1529. .selIcon div .comm2 {
  1530. background: url("./../assets/st-img/comm.png") no-repeat;
  1531. }
  1532. .selIcon div .notSfd {
  1533. background: url("./../assets/st-img/notSatisfied2.png")
  1534. }
  1535. .selIcon div .notSfd2 {
  1536. background: url("./../assets/st-img/notSatisfied.png")
  1537. }
  1538. .levMsg {
  1539. padding-right: 30px;
  1540. margin-bottom: 20px;
  1541. }
  1542. .sure {
  1543. text-align: center;
  1544. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1545. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1546. border-radius: 10px;
  1547. width: 100px;
  1548. height: 48px;
  1549. line-height: 48px;
  1550. color: #fff;
  1551. position: absolute;
  1552. bottom: 30px;
  1553. left: 37%;
  1554. cursor: pointer;
  1555. }
  1556. /* 验证框 */
  1557. .logo {
  1558. text-align: center;
  1559. margin-bottom: 20px;
  1560. }
  1561. .logo span {
  1562. font-size: 38px;
  1563. font-weight: bold;
  1564. color: #5EA0F7;
  1565. font-family: Microsoft YaHei;
  1566. }
  1567. .logo span:nth-child(1) {
  1568. color: #F04992;
  1569. }
  1570. .formBox {
  1571. padding: 0 27px 0 0;
  1572. }
  1573. .formBox .el-input {
  1574. margin-bottom: 21px;
  1575. }
  1576. .formBox .phone .el-input, .formBox .email .el-input {
  1577. margin-bottom: 0;
  1578. }
  1579. .formBox .phone, .formBox .email {
  1580. margin-bottom: 10px;
  1581. }
  1582. .vertion {
  1583. vertical-align: middle;
  1584. /* margin-bottom: 28px; */
  1585. }
  1586. .vertion .el-input {
  1587. width: 250px;
  1588. margin-right: 15px;
  1589. display: inline-block;
  1590. }
  1591. .vertion span {
  1592. display: inline-block;
  1593. width: 128px;
  1594. height: 40px;;
  1595. vertical-align: middle;
  1596. background: rgba(241, 225, 224, 1);
  1597. }
  1598. .formBox .sure {
  1599. bottom: 21px;
  1600. }
  1601. .el-card__body .tit {
  1602. line-height: 25px;
  1603. }
  1604. .chatting .el-button {
  1605. border: none;
  1606. padding: 0;
  1607. border-radius: 0
  1608. }
  1609. .emoticon {
  1610. width: 30px;
  1611. height: 30px;
  1612. display: inline-block;
  1613. }
  1614. .pointer {
  1615. cursor: pointer;
  1616. }
  1617. .ly:hover {
  1618. border-bottom: 1px solid #5EA0F7;
  1619. /* 高亮效果 */
  1620. filter: brightness(0.9);
  1621. }
  1622. .gl:hover {
  1623. filter: brightness(0.9);
  1624. }
  1625. .seek:hover {
  1626. background: #860c60
  1627. }
  1628. .sendCol {
  1629. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  1630. }
  1631. .netSendCol {
  1632. cursor: not-allowed;
  1633. }
  1634. /* 修改滚动条 */
  1635. ::-webkit-scrollbar-button {
  1636. background: transparent;
  1637. border: 0;
  1638. }
  1639. /* 顶部三个图标 */
  1640. .imgBox i {
  1641. display: inline-block;
  1642. width: 25px;
  1643. height: 25px;
  1644. margin-right: 20px;
  1645. background: url("./../assets/st-img/pj.png") no-repeat;
  1646. background-size: 100% 100%;
  1647. vertical-align: middle;
  1648. }
  1649. .imgBox .sy {
  1650. background: url("./../assets/st-img/sy.png") no-repeat;
  1651. }
  1652. .imgBox .sq {
  1653. background: url("./../assets/st-img/sq.png") no-repeat;
  1654. }
  1655. /* .sc:hover{
  1656. background: url("./../assets/st-img/pjhover.png") no-repeat;
  1657. }
  1658. .sy:hover{
  1659. background: url("./../assets/st-img/sy2.png")no-repeat;
  1660. }
  1661. .sq:hover{
  1662. background: url("./../assets/st-img/sq2.png") no-repeat;
  1663. } */
  1664. i.scActy {
  1665. background: #1654D1 url("./../assets/st-img/pjhover.png") no-repeat;
  1666. width: 33px;
  1667. height: 33px;
  1668. background-position: 5px;
  1669. }
  1670. /* .imgBox .syActy{
  1671. background:#1654D1 url("./../assets/st-img/jzsy.png") no-repeat;
  1672. width: 33px;
  1673. height: 33px;
  1674. background-position: 5px;
  1675. }
  1676. .imgBox .sqActy{
  1677. background: #1654D1 url("./../assets/st-img/sq2.png") no-repeat;
  1678. width: 33px;
  1679. height: 33px;
  1680. transform: rotate(180deg);
  1681. background-position: 5px;
  1682. } */
  1683. .tips {
  1684. font-size: 12px;
  1685. color: #F04992;
  1686. }
  1687. #main {
  1688. position: relative;
  1689. }
  1690. .retract {
  1691. position: absolute;
  1692. right: 0;
  1693. top: 290px;
  1694. z-index: 999;
  1695. }
  1696. /* 滚动条样式 */
  1697. .scroll::-webkit-scrollbar {
  1698. border: 5px solid #fff;
  1699. }
  1700. .scroll::-webkit-scrollbar {
  1701. width: 5px;
  1702. height: 20px;
  1703. }
  1704. .scroll::-webkit-scrollbar-button {
  1705. width: 0px;
  1706. height: 0px;
  1707. }
  1708. .scroll::-webkit-scrollbar-thumb {
  1709. border-radius: 5px;
  1710. box-shadow: inset 0 0 0 5px #aaa;
  1711. border: .02rem solid transparent;
  1712. }
  1713. .scroll::-webkit-scrollbar-track {
  1714. display: block;
  1715. background: rgba(0, 0, 0, 0.1);
  1716. }
  1717. </style>