index.vue 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177
  1. <template>
  2. <div>
  3. <!-- 聊天 -->
  4. <div class="service" v-if="!knowledge">
  5. <!-- 头部信息 -->
  6. <div class="header row allAlignment item-center">
  7. <div class="row item-center" v-if="!link_success">
  8. <img class="icon" style="margin-right:.2rem;" src="@/assets/Service1.png" @click="leftShow = true">
  9. <img class="logo" :src="img_http + logo" alt="">
  10. <p>{{service_info.name}}</p>
  11. <span style="margin:5px 0 0 5px"><img src="@/assets/on_icon.png" alt=""></span>
  12. </div>
  13. <div class="row item-center" v-else>
  14. <img class="icon" style="margin-right:.2rem;" src="@/assets/Service1.png" @click="leftShow = true">
  15. <img class="logo" :src="img_http + logo" alt="">
  16. <p>{{service_info.name}}</p>
  17. <span v-if="service_on" style="margin:5px 0 0 5px"><img src="@/assets/on_icon.png" alt=""></span>
  18. <span v-if="!service_on" style="margin:5px 0 0 5px"><img src="@/assets/off_icon.png" alt=""></span>
  19. </div>
  20. <div class="row">
  21. <yd-button v-if="isExit" color="#fff" bgcolor="#1d57dd" class="exit" size="mini" type="primary"
  22. @click.native="is_exit()">结束聊天
  23. </yd-button>
  24. <img class="icon-msg" v-if="( chat.length -1 ) + hisLength >= chatNum" @click="is_show_evaluate()" src="@/assets/Service2.png">
  25. <img class="icon-msg" @click="knowledge = true,flag = false" src="@/assets/leaveSwitch.png" v-if="!isExit">
  26. </div>
  27. </div>
  28. <div class="main" id="main" @scroll="scrollMain">
  29. <!-- ********************************************************** -->
  30. <!-- 机器人聊天板块 -->
  31. <div v-if="!link_success">
  32. <!-- 系统欢迎语 -->
  33. <div v-if="welcome.length > 0" v-for="(item,i) in welcome" :key="'w'+i">
  34. <div class="row allAlignment" style="margin-top:.3rem;">
  35. <div class="HeadPortrait row center">
  36. <img :src="require('@/assets/headAdvent.png')">
  37. </div>
  38. <div class="messageWindow dialogueA col-w">
  39. <div class="customerService left" v-html="item"></div>
  40. </div>
  41. </div>
  42. </div>
  43. <!-- 系统消息下拉选择 -->
  44. <div class="artificial" v-if="problem.length > 0 && welcome.length > 0">
  45. <div class="row item-center allAlignment" style="height:.75rem;border-bottom:.01rem solid #EEE;"
  46. v-for="(item,index) in problem" :key="index" @click="pushMessage(item.robot_content)">
  47. <span>{{item.robot_name}}</span>
  48. <img style="width:.3rem;height:.3rem;" src="@/assets/addright.png">
  49. </div>
  50. <div class="row item-center" style="height:.72rem;">
  51. <p>以上问题都不是</p>
  52. <div style="color:#5EA0F7;padding-left:.1rem;" @click="connectionService">转人工客服</div>
  53. </div>
  54. </div>
  55. <!-- 和机器人会话 -->
  56. <div v-for="(item,i) in robot" :key="'r'+i">
  57. <!-- 和机器人会话互动 -->
  58. <div v-if="item.type == 'error'" class="row allAlignment"
  59. style="margin-top:.3rem;">
  60. <div class="HeadPortrait row center">
  61. <img v-if="item.type == 'error'" :src="require('@/assets/headAdvent.png')">
  62. </div>
  63. <div class="messageWindow dialogueA col-w">
  64. <!-- <div v-if="item.type == '1001'" class="customerService left"
  65. v-html="item.content.text"></div> -->
  66. <!-- <div v-if="item.type == 'user'" class="user right imgSrc">
  67. <yd-lightbox v-if="item.content.img" style="display:inline-block"
  68. class="row rightAlignment box-img">
  69. <yd-lightbox-img :src=" img_http + item.content.img"></yd-lightbox-img>
  70. </yd-lightbox> -->
  71. <div v-if="item.type == 'error'" class="customerService left">{{item.content.text}}
  72. <div style="color:#5EA0F7;padding-left:.1rem;cursor:pointer;" @click="connectionService">转人工客服</div>
  73. </div>
  74. <!-- </div> -->
  75. </div>
  76. <div class="HeadPortrait row center">
  77. <img v-if="item.type == 'user'"
  78. :src="require('@/assets/timg.jpg') ">
  79. </div>
  80. </div>
  81. <!-- 和机器人会话互动 -->
  82. <div v-if="item.type == 'service' || item.type == 'user'" class="row allAlignment"
  83. style="margin-top:.3rem;">
  84. <div class="HeadPortrait row center">
  85. <img v-if="item.type == 'service'" :src="require('@/assets/headAdvent.png')">
  86. </div>
  87. <div class="messageWindow dialogueA col-w"
  88. :style="item.type == 'user'?'text-align: right;':''">
  89. <div v-if="item.type == 'service'" class="customerService left"
  90. v-html="item.content.text"></div>
  91. <div v-if="item.type == 'user'" class="user right imgSrc">
  92. <yd-lightbox v-if="item.content.img" style="display:inline-block"
  93. class="row rightAlignment box-img">
  94. <yd-lightbox-img :src=" img_http + item.content.img"></yd-lightbox-img>
  95. </yd-lightbox>
  96. <div v-else v-html="item.content"></div>
  97. </div>
  98. </div>
  99. <div class="HeadPortrait row center">
  100. <img v-if="item.type == 'user'"
  101. :src="require('@/assets/timg.jpg') ">
  102. </div>
  103. </div>
  104. <!-- 转人工分组 -->
  105. <div class="artificial" v-if="item.type == 'artificial_service' ">
  106. <div @click="turnArtificial(items.id)" v-for="(items,indexs) in item.content"
  107. :key="'r'+indexs" class="row item-center allAlignment"
  108. style="height:.75rem;border-bottom:.01rem solid #EEE;">
  109. <p>
  110. 人工客服:
  111. <span style="color:#5EA0F7;padding-left:.1rem;">{{items.name}}</span>
  112. </p>
  113. <img style="width:.3rem;height:.3rem;" src="@/assets/addright.png">
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <!-- ********************************************************** -->
  119. <!-- 人工会话模版 -->
  120. <div v-if="link_success">
  121. <!--历史消息-->
  122. <div v-if="showHistory" v-for="(item, index) in hisSviceChat" :key="'h'+index">
  123. <!-- 客服信息 -->
  124. <div v-if="item.from_id.startsWith('KF')">
  125. <div style="width: 100%;text-align: center;">
  126. <span v-if="item.time_line">{{item.time_line}}</span>
  127. </div>
  128. <div class="row allAlignment" style="margin-top:.3rem;margin-top: 0.3rem;">
  129. <div class="HeadPortrait row center">
  130. <img v-if="service_info.avatar == '' " :src="avatar_imgs">
  131. <img v-if="service_info.avatar != ''"
  132. :src="img_http + service_info.avatar ? img_http + service_info.avatar : require('@/assets/user2.png')">
  133. </div>
  134. <div class="messageWindow dialogueA col-w">
  135. <div class="customerService left imgSrc">
  136. <yd-lightbox v-if="item.content.img" style="display:inline-block"
  137. class="row rightAlignment">
  138. <yd-lightbox-img :src=" img_http + item.content.img"></yd-lightbox-img>
  139. </yd-lightbox>
  140. <div v-html="item.content.text" v-else></div>
  141. </div>
  142. </div>
  143. <div class="HeadPortrait row center">
  144. </div>
  145. </div>
  146. </div>
  147. <!-- 用户信息 -->
  148. <div v-else>
  149. <div style="width: 100%;text-align: center;margin-top: 0.3rem;">
  150. <span v-if="item.time_line">{{item.time_line}}</span>
  151. </div>
  152. <div class="row allAlignment" style="margin-top:.3rem;">
  153. <div class="HeadPortrait row center">
  154. </div>
  155. <div class="messageWindow dialogueA col-w row rightAlignment" >
  156. <div class="user right imgSrc ">
  157. <yd-lightbox v-if="item.content.img" style="display:inline-block" class="row rightAlignment">
  158. <yd-lightbox-img :src="img_http+item.content.img"></yd-lightbox-img>
  159. </yd-lightbox>
  160. <div v-html="item.content.text" v-else></div>
  161. </div>
  162. </div>
  163. <div class="HeadPortrait row center">
  164. <img :src="require('@/assets/timg.jpg') ">
  165. </div>
  166. </div>
  167. </div>
  168. </div>
  169. <div v-for="(item,index) in chat" :key="index">
  170. <!-- 展示历史消息 -->
  171. <div class="promptBox" v-if="item.type == 'historyMsg'">
  172. <div class="prompt help">
  173. <span>{{historyMsgtext}}</span>
  174. </div>
  175. </div>
  176. <!-- 客服会话 -->
  177. <div v-if="item.type == 'service'">
  178. <div style="width: 100%;text-align: center;margin-top: 0.3rem;">
  179. <span v-if="item.time ">{{item.time}}</span>
  180. </div>
  181. <div class="row allAlignment" style="margin-top:.3rem;">
  182. <div class="HeadPortrait row center">
  183. <img id="123" v-if="service_info.avatar == '' " :src="avatar_imgs">
  184. <img id="321" v-if="service_info.avatar != '' "
  185. :src="img_http + service_info.avatar ? img_http + service_info.avatar : img_http + service_info.avatar">
  186. </div>
  187. <div class="messageWindow dialogueA col-w ">
  188. <div class="customerService left imgSrc">
  189. <yd-lightbox v-if="item.content.img" style="display:inline-block"
  190. class="row rightAlignment">
  191. <yd-lightbox-img :src="img_http + item.content.img"></yd-lightbox-img>
  192. </yd-lightbox>
  193. <div v-html="item.content.text" v-else></div>
  194. </div>
  195. </div>
  196. <div class="HeadPortrait row center">
  197. </div>
  198. </div>
  199. </div>
  200. <!-- 用户会话 -->
  201. <div v-if="item.type == 'user'">
  202. <div style="width: 100%;text-align: center;margin-top: 0.3rem;">
  203. <span v-if="item.time">{{item.time}}</span>
  204. </div>
  205. <div class="row allAlignment" style="margin-top:.3rem;">
  206. <div class="HeadPortrait row center">
  207. </div>
  208. <div class="messageWindow dialogueA col-w row rightAlignment" >
  209. <div class="user right imgSrc ">
  210. <yd-lightbox v-if="item.content.img" style="display:inline-block"
  211. class="row rightAlignment">
  212. <yd-lightbox-img :src="img_http+item.content.img"></yd-lightbox-img>
  213. </yd-lightbox>
  214. <span v-html="item.content.text" v-else>{{item.content.text}}</span>
  215. </div>
  216. </div>
  217. <div class="HeadPortrait row center">
  218. <img v-if="item.type == 'user'"
  219. :src="require('@/assets/timg.jpg') ">
  220. </div>
  221. </div>
  222. </div>
  223. <!-- 常规系统消息评价 -->
  224. <div class="row center " v-if="item.type== 'system' ">
  225. <div class="column item-center "
  226. style="margin: 0.3rem 0; background: #fff; width:100% ;padding: 0.1rem 0;"
  227. v-if="item.content.state =='getEvaluate' && !haveEvaluation ">
  228. <p class="row center wrap">{{item.content.text}}</p>
  229. <button class="evaluateBtn" style="margin-top:.2rem;" @click="is_show_evaluate()">评价
  230. </button>
  231. </div>
  232. <div class="column item-center"
  233. style="margin: 0.3rem 0; background: #fff; width:100% ;padding: 0.1rem 0.5rem;"
  234. v-if="item.content.state == 'closeInform' ">
  235. <p class="row center wrap">{{item.content.text}}</p>
  236. </div>
  237. </div>
  238. </div>
  239. </div>
  240. <div v-if="Chrome_height" style="height:40px">
  241. </div>
  242. <div v-if="Safari_height" style="height:90px">
  243. </div>
  244. </div>
  245. <!-- 底部弹窗评价 -->
  246. <yd-popup v-model="bottomShow" position="bottom" height="6.5rem" :masker-opacity=".2">
  247. <div class="row rightAlignment" style="padding-top:.2rem;padding-right:.2rem;">
  248. <img @click.stop="bottomShow = false, evaluateState = 100" style="width: 0.32rem;height: 0.32rem;"
  249. src="@/assets/Service5.png">
  250. </div>
  251. <div style="color:#666;text-align: center;font-size:.28rem;">感谢您的咨询,请对我们的服务做出评价</div>
  252. <div style="height:2.3rem;" class="row allAlignment evaluatebtn">
  253. <div style="width:33%;height:100%;">
  254. <div class="row wrap center" @click="evaluateClick(1)">
  255. <img style="width:.66rem;height:.66rem;"
  256. :src="evaluateState =='1'?require('@/assets/evaluate1a.png'):require('@/assets/evaluate1.png')">
  257. <p>满意</p>
  258. </div>
  259. </div>
  260. <div style="width:33%;height:100%;" @click="evaluateClick(2)">
  261. <div class="row wrap center">
  262. <img style="width:.66rem;height:.66rem;"
  263. :src="evaluateState =='2'?require('@/assets/evaluate2a.png'):require('@/assets/evaluate2.png')">
  264. <p>一般</p>
  265. </div>
  266. </div>
  267. <div style="width:33%;height:100%;" @click="evaluateClick(3)">
  268. <div class="row wrap center">
  269. <img style="width:.66rem;height:.66rem;"
  270. :src="evaluateState =='3'?require('@/assets/evaluate3a.png'):require('@/assets/evaluate3.png')">
  271. <p>不满意</p>
  272. </div>
  273. </div>
  274. </div>
  275. <!-- <div class="evaluateBox">
  276. <textarea placeholder="评价备注" v-model="evalArea"></textarea>
  277. </div> -->
  278. <div class="row center sub" @click="evaluateEsc">确定</div>
  279. </yd-popup>
  280. <!-- 左侧弹窗客服信息 -->
  281. <yd-popup v-model="leftShow" position="left" width="4.8rem" :masker-opacity=".2">
  282. <div class="leftHader row item-center">
  283. <img @click="leftShow = false" class="icon" src="@/assets/Service4.png">
  284. <img class="logo" :src="img_http + logo" alt="">
  285. <p style="color:#FFF;font-size:.34rem;">{{service_info.name}}</p>
  286. </div>
  287. <div>
  288. <div class="leftMain-top row">
  289. <div>
  290. <p>
  291. <!-- 客服名字 -->
  292. <span>姓名:</span>
  293. {{service_info.name}}
  294. </p>
  295. <p>
  296. <!-- 客服工号 -->
  297. <span>工号:</span>
  298. {{service_info.job_name}}
  299. </p>
  300. <p>
  301. <!-- 客服性别 -->
  302. <span>性别:</span>
  303. {{service_info.gender == "0" ? "保密" :service_info.gender == 1? '男' :'女' }}
  304. </p>
  305. <p>
  306. <!-- 客服职务 -->
  307. <span>职务:</span>
  308. {{service_info.job_name}}
  309. </p>
  310. </div>
  311. <div class="row center">
  312. <img style="width:1.8rem;height:1.8rem;" v-if="!trueImg" :src="avatar_imgs">
  313. <!-- {{service_info.avatar}} -->
  314. <img style="width:1.8rem;height:1.8rem;" v-if="trueImg" :src="img_http +service_info.avatar">
  315. </div>
  316. </div>
  317. <div class="leftMain-chenter"
  318. style="padding:0 .3rem;margin-top:.3rem;padding-bottom:.6rem;border-bottom:.01rem solid #ddd;"
  319. >
  320. <!-- 客服个性签名 -->
  321. <span>个性签名:</span>
  322. {{service_info.signature}}
  323. </div>
  324. <!-- 广告图 -->
  325. <div class="leftMain-bottom row center" style="padding:0 .3rem;margin-top:.6rem;">
  326. <a :href="'https://'+advertisement.advertisement_url" target="_blank" rel="noopener noreferrer">
  327. <img style="width:4.2rem;height:7rem;" :src="img_http+advertisement.advertisement_img">
  328. </a>
  329. </div>
  330. </div>
  331. </yd-popup>
  332. <!-- 底部输入框 -->
  333. <div class="footer row wrap" id='input_box'>
  334. <!-- @keydown="inputNumFun()" -->
  335. <textarea
  336. id="textarea"
  337. v-model.trim="text_info"
  338. placeholder="请输入你的问题:"
  339. maxlength="450"
  340. @keyup ='keyup_maxlength()'
  341. @focus="keyup_maxlength()"
  342. :style="{height:iboxheight}"
  343. >
  344. </textarea>
  345. <div class="send row item-center" style="border-bottom:.01rem solid #ddd;">
  346. <img
  347. :src="meme?require('@/assets/faceActive.png'):require('@/assets/face.png')"
  348. @click="faceClick"
  349. style="width:.48rem;height:.48rem"
  350. >
  351. <input type="file" id="file" @change="uploadIMG" accept="image/jpeg,image/jpg,image/png,image/svg"
  352. style="display:none">
  353. <label for="file">
  354. <img src="@/assets/imge.png" style="width:.46rem;height:.42rem">
  355. </label>
  356. <div
  357. @click="send()"
  358. style="color:#ccc;border:.02rem solid #ddd;width:1rem;height:.66rem;border-radius:.1rem;"
  359. :style="text_info.length>0?'background:#5EA0F7;color:#fff;':''"
  360. class="row center"
  361. >发送
  362. </div>
  363. </div>
  364. <!-- 表情包 -->
  365. <div v-show="meme" class="memeBox">
  366. <yd-slider autoplay="0" :loop="false">
  367. <yd-slider-item>
  368. <div>
  369. <ul style="width:100%;padding-bottom:.3rem;" class="row average wrap">
  370. <li v-for="(item,index) in frceArr" :key="index" v-show="index<15">
  371. <img
  372. class="memeImg"
  373. :src="require(`@/assets/${index}.gif`)"
  374. @click="memeImg(index)"
  375. >
  376. </li>
  377. </ul>
  378. </div>
  379. </yd-slider-item>
  380. <yd-slider-item>
  381. <div>
  382. <ul style="width:100%;padding-bottom:.3rem;" class="row average wrap">
  383. <li v-for="(item,index) in frceArr" :key="index" v-show="index>15&&index<=30">
  384. <img
  385. class="memeImg"
  386. :src="require(`@/assets/${index}.gif`)"
  387. @click="memeImg(index)"
  388. >
  389. </li>
  390. </ul>
  391. </div>
  392. </yd-slider-item>
  393. <yd-slider-item>
  394. <div>
  395. <ul style="width:100%;padding-bottom:.3rem;" class="row average wrap">
  396. <li v-for="(item,index) in frceArr" :key="index" v-show="index>30&&index<=45">
  397. <img
  398. class="memeImg"
  399. :src="require(`@/assets/${index}.gif`)"
  400. @click="memeImg(index)"
  401. >
  402. </li>
  403. </ul>
  404. </div>
  405. </yd-slider-item>
  406. <yd-slider-item>
  407. <div>
  408. <ul style="width:100%;padding-bottom:.3rem;" class="row average wrap">
  409. <li v-for="(item,index) in frceArr" :key="index" v-show="index>45&&index<=60">
  410. <img
  411. class="memeImg"
  412. :src="require(`@/assets/${index}.gif`)"
  413. @click="memeImg(index)"
  414. >
  415. </li>
  416. </ul>
  417. </div>
  418. </yd-slider-item>
  419. <yd-slider-item>
  420. <div>
  421. <ul style="width:100%;padding-bottom:.3rem;" class="row average wrap">
  422. <li v-for="(item,index) in frceArr" :key="index" v-show="index>60">
  423. <img
  424. class="memeImg"
  425. :src="require(`@/assets/${index}.gif`)"
  426. @click="memeImg(index)"
  427. >
  428. </li>
  429. </ul>
  430. </div>
  431. </yd-slider-item>
  432. </yd-slider>
  433. </div>
  434. </div>
  435. </div>
  436. <!-- 留言知识库 -->
  437. <div v-if="knowledge">
  438. <!-- 接收返回消息 -->
  439. <knowledgeLibrary @returnIndex="returnIndex" :currentTime="currentTime"/>
  440. </div>
  441. <!-- 发送消息音频提示
  442. <audio id="send" src="../../static/send.wav"></audio>
  443. 接收消息音频提示
  444. <audio id="receive" src="../../static/receive.wav"></audio>
  445. -->
  446. </div>
  447. </template>
  448. <script>
  449. import "../css/index.css";
  450. import knowledgeLibrary from './knowledgeLibrary'
  451. import frce from "./frce.js";
  452. import defaultImgs from "./../assets/timg.jpg"
  453. import headPortrait from "./../assets/headPortrait.png"
  454. import autoTextarea from 'auto-textarea'
  455. import { Loading } from 'vue-ydui/dist/lib.rem/dialog';
  456. export default {
  457. name: "service",
  458. // 模板注册
  459. components: {
  460. knowledgeLibrary,
  461. autoTextarea
  462. },
  463. data() {
  464. return {
  465. /*-----------------------------------------------*/
  466. text_info: "", //输入框内容
  467. knowledge: false,//留言知识库开关
  468. leftShow: false, //左侧详细开关
  469. evaluateOnOff: false, //人工客服评价通知
  470. bottomShow: false, //底部评价弹窗开关
  471. meme: false, // 表情包开关
  472. frceArr: [], //表情包代码
  473. evaluateState: 100,//评价状态
  474. websock: null,//创建websock
  475. user_info: '',//用户信息
  476. apiToken: '',//通话调用凭证
  477. currentTime: '',//接口调用服务器时间
  478. problem: [],//机器人问题
  479. welcome: [],//欢迎语
  480. advertisement: '', //广告
  481. img_http: 'https://manage.281570.com',//图片路径域
  482. //img_http:'http://192.168.2.186:8090',//图片路径域
  483. robot: [],//和机器人聊天临时数据
  484. chat: [],//人工会话
  485. error_num: 1001,//机器人回答超出能力之外编号
  486. isConnection: true,//人工分组列表开关
  487. ibox_height:'auto',
  488. //客服信息
  489. service_info: {
  490. avatar: headPortrait,
  491. job_name: '001',
  492. name: '智能客服',
  493. signature: ""
  494. },
  495. link_success: false,//人工链接成功
  496. service_on: true,
  497. closeByServer: false, //客服关闭会话
  498. serverNotOnlin: false, //客服掉线
  499. willOverTime: false, //超时关闭会话
  500. overTimeMsg: '', // 超时提示内容
  501. conversationId: '',//会话工单
  502. chatNum: 0,//触发评价按钮条件
  503. haveEvaluation: false,//是否已评价
  504. evalArea: '', //评价备注
  505. source: {},//来源信息
  506. initData: 1,//
  507. isTurnArtifcial: true,
  508. Chrome_height: false, // chrome浏览器增加会话框高度
  509. Safari_height:false, // 苹果浏览器增加会话框高度
  510. logo: '',
  511. isExit: false,
  512. historyMsg: false, // 是否展示历史信息
  513. historyMsgtext: "", // 历史信息内容提示
  514. hisSviceChat: [],
  515. showHistory: true,
  516. avatar_imgs: headPortrait,
  517. webTime: '',//人工会话上一次发送消息时间
  518. chatIndex: '',//人工会话上一次下标
  519. /*****************websockt心跳变量*******************/
  520. reconnectData: null,
  521. lockReconnect: false, //避免重复连接,因为onerror之后会立即触发 onclose
  522. timeout: 5000, //5s一次心跳检测
  523. timeoutObj: null,
  524. serverTimeoutObj: null,
  525. waitingMsg: false, // 是否显示等待排队
  526. serviceNotOnlineText: '',
  527. comtSuccess:false,
  528. hisLength:0,
  529. trueImg:false,
  530. innerHeight: 0, // 可视区域高度,不包括键盘
  531. areaHeight: 0, // textarea高度
  532. loadingobj:null,//加载特效对像
  533. };
  534. },
  535. created() {
  536. this.getInnerHeight();
  537. },
  538. // 方法
  539. methods: {
  540. // 获取初始的可视高度
  541. getInnerHeight() {
  542. console.log('当前高度:', window.innerHeight)
  543. this.innerHeight = window.innerHeight;
  544. },
  545. // 光标
  546. // // 退出聊天
  547. is_exit() {
  548. this.webTime = ''
  549. this.socket_send(JSON.stringify({
  550. type: 'kfCloseUser',
  551. data: {
  552. to_id: this.user_info.id,
  553. kf_id: this.service_info.id,
  554. group_id: this.service_info.group,
  555. conversationId: this.conversationId,
  556. type: 6,
  557. }
  558. }));
  559. this.setInit();
  560. },
  561. nloding(msg){
  562. this.$dialog.loading.open(msg);
  563. },
  564. closeNloading(){
  565. this.$dialog.loading.close();
  566. },
  567. /*******************************************/
  568. //设置token加密
  569. setApiToken(name, controller, time, modules) {
  570. //let txetVal = name + 'customer-service' + controller + time + modules;
  571. let txetVal = name + 'customer-service' + controller + modules;
  572. let sssd = txetVal.toLowerCase();
  573. return this.$md5(txetVal.toLowerCase());
  574. },
  575. /*******************************************/
  576. //初始化Websocket链接
  577. initWebSocket(apiToken) {
  578. let sock_ip = ''; // 线上
  579. this.websock = new WebSocket("wss://link.281570.com?apiToken=" + apiToken);
  580. //数据返回
  581. this.websock.onmessage = this.socket_message;
  582. //数据发送
  583. this.websock.onopen = this.socket_open;
  584. //重新链接
  585. this.websock.onerror = this.socket_error;
  586. //关闭链接
  587. this.websock.onclose = this.socket_close;
  588. },
  589. /*******************************************/
  590. //连接建立之后执行send方法发送数据
  591. socket_open() {
  592. console.log('我链接了');
  593. this.$dialog.loading.close();
  594. },
  595. /*******************************************/
  596. //连接建立失败重连
  597. socket_error() {
  598. console.log('连接建立失败重连');
  599. // this.initWebSocket();
  600. // this.setInit();
  601. // this.reconnect();
  602. },
  603. /*******************************************/
  604. //数据接收
  605. socket_message(e) {
  606. if (!e.data) return;
  607. const redata = JSON.parse(e.data);
  608. //心跳检测
  609. this.heatBeat();
  610. // 心跳检测
  611. if (redata.message_type == "ping") {
  612. this.websock.send('{"type":"pong"}')
  613. return false;
  614. }
  615. if (redata.type == 'pong') return false;
  616. if (redata.type != 'pong' || redata.message_type != "ping") {
  617. console.log(redata)
  618. }
  619. //欢迎语
  620. if (redata.message_type == 'helloMessage') {
  621. this.isTurnArtifcial = true;
  622. if (this.initData == 1) {
  623. this.welcome.push(redata.data.content);
  624. //this.welcome.push('请点击您想咨询的问题,若都不是,请在输入框直接输入');
  625. }
  626. }
  627. //广告语
  628. if (redata.message_type == 'advertisement') {
  629. this.advertisement = redata.data[0]
  630. }
  631. //机器人回复
  632. if (redata.message_type == "robotMessage") {
  633. // console.log(redata);
  634. if (redata.data.content == "error") {
  635. this.robot.push({
  636. type: 'error',
  637. content: {text: "您的问题暂无法处理"}
  638. })
  639. // this.error_num++;
  640. } else {
  641. this.robot.push({
  642. type: 'service',
  643. content: {text: redata.data.content}
  644. })
  645. }
  646. //console.log(this.robot);
  647. // this.automaticRolling();
  648. //data
  649. //this.robot =
  650. }
  651. //人工链接
  652. if (redata.message_type == 'connect') {
  653. this.willOverTime = false;
  654. this.trueImg = true
  655. this.chat.splice(-1)
  656. let server = {};
  657. if (redata.data) {
  658. server = redata.data
  659. } else {
  660. server = {
  661. conversationId: redata.data.conversationId,
  662. kf_id: redata.data.kf_id,
  663. kf_name: "",
  664. serverInfo: {
  665. avatar: avatarImgs,
  666. client_id: "",
  667. group: "",
  668. id: "",
  669. intime: "",
  670. job_name: "",
  671. name: "tank",
  672. signature: "",
  673. status: 0,
  674. task: 0,
  675. }
  676. }
  677. }
  678. this.service_on = true;
  679. this.isExit = true;
  680. this.link_success = true;
  681. // localStorage.getItem('comtSuccess',true)
  682. this.$dialog.loading.close();
  683. this.service_info = server.serverInfo;
  684. this.conversationId = server.conversationId;
  685. }
  686. // 客服掉线.
  687. if (redata.message_type == 'serviceoffline') {
  688. this.chat.push({
  689. type: 'system',
  690. content: {
  691. text: redata.msg,
  692. state: 'closeInform',
  693. }
  694. })
  695. this.automaticRolling();
  696. this.service_on = false;
  697. // let that = this;
  698. // setTimeout(function () {
  699. // that.link_success = false;
  700. // that.serverNotOnlin = true;
  701. // that.closeByServer = true;
  702. // that.chat.splice(-1)
  703. // },3000)
  704. }
  705. // 客服不在线请稍后再试
  706. if (redata.message_type == 'kfNotOnlin') {
  707. this.service_on = false;
  708. }
  709. // 客服会话超时
  710. if (redata.message_type == 'overtime') {
  711. this.willOverTime = true;
  712. this.automaticRolling();
  713. // this.goBack();
  714. this.overTimeMsg = redata.data.content;
  715. }
  716. // 客服等待排队
  717. if (redata.message_type == "inqueue") {
  718. this.waitingMsg = true;
  719. // this.automaticRolling();
  720. // this.waitingText = redata.content;
  721. this.$dialog.confirm({
  722. title: '温馨提示',
  723. mes: redata.content,
  724. opts: [{
  725. txt: '取消排队',
  726. color: true,
  727. callback: () => {
  728. this.socket_send(JSON.stringify({
  729. "type": "cancelqueue",
  730. "data": {
  731. "uid": localStorage.getItem('uid')
  732. }
  733. }));
  734. this.isTurnArtifcial =true;
  735. // this.$dialog.toast({mes: '你点了确定', timeout: 1000});
  736. }
  737. }]
  738. });
  739. }
  740. //人工会话回复
  741. if (redata.message_type == "chatMessage") {
  742. // 转接的时候清除历史信息
  743. // this.hisSviceChat = [];
  744. // this.getHistory = false;
  745. // 接收提示音
  746. this.receiveAudio();
  747. this.$dialog.loading.close();
  748. let obj = {};
  749. let thisTime = '';
  750. if (this.$public.isJSON(redata.data.content)) {
  751. obj = JSON.parse(redata.data.content);
  752. obj.text = this.turnFace(obj.text);
  753. //接收消息大于两分钟显示时间
  754. let newTime = redata.data.time.split(':');
  755. if (this.webTime) {
  756. let lastTime = this.webTime.split(":");
  757. if (newTime[0] == lastTime[0] && newTime[1] < (lastTime[1] + 2)) {
  758. thisTime = ''
  759. } else {
  760. thisTime = redata.data.time;
  761. }
  762. } else {
  763. thisTime = redata.data.time;
  764. }
  765. this.webTime = redata.data.time;
  766. } else {
  767. obj.text = redata.data.content;
  768. }
  769. this.chat.push({
  770. type: 'service',
  771. time: thisTime ? thisTime : '',
  772. content: obj
  773. })
  774. }
  775. //系统消息通知客户结束通话
  776. if (redata.message_type == 'closeBysever') {
  777. this.setInit();
  778. this.showHistory = false;
  779. this.link_success = false;
  780. this.isTurnArtifcial = true;
  781. localStorage.removeItem('comtSuccess');
  782. this.comtSuccess = false;
  783. }
  784. if (redata.message_type == "changeKeFuSuccess") {
  785. this.$dialog.alert({
  786. mes: redata.data.content
  787. });
  788. }
  789. //系统消息通转人工
  790. if (redata.message_type == 'notice') {
  791. console.log('人工');
  792. this.$dialog.loading.close();
  793. this.isTurnArtifcial = true;
  794. let _this = this;
  795. if(this.group == 99999){
  796. this.$dialog.alert({
  797. mes: redata.content, callback: () => {
  798. this.initData = 100;
  799. // _this.$dialog.loading.open('数据加载中...');
  800. // setTimeout(() => {
  801. // _this.$dialog.loading.close();
  802. // // _this.registered();
  803. // }, 2000);
  804. }
  805. });
  806. }else{
  807. this.turnArtificial(99999);
  808. }
  809. }
  810. //系统消息评价
  811. if (redata.message_type == "getEvaluate") {
  812. // this.evaluateOnOff = true;
  813. // console.log( this.chat)
  814. this.chat.push({
  815. type: 'system',
  816. content: {
  817. text: redata.data.content,
  818. state: 'getEvaluate',
  819. }
  820. })
  821. }
  822. //会话关闭前通知用户
  823. if (redata.message_type == 'overtime') {
  824. this.chat.push({
  825. type: 'system',
  826. content: {
  827. text: redata.data.content,
  828. state: 'closeInform',
  829. }
  830. })
  831. }
  832. // 历史信息
  833. if (redata.message_type == 'toOld') {
  834. this.hisSviceChat = [];
  835. let obj = redata;
  836. this.historyMsgtext = obj.data.content;
  837. this.chat.push({
  838. type: 'historyMsg',
  839. content: {
  840. text: this.historyMsgtext,
  841. }
  842. })
  843. let historyTime = '';
  844. this.hisLength =obj.data.chatLog.length
  845. obj.data.chatLog.forEach(res => {
  846. // console.log(res,'历史信息');
  847. res.content = JSON.parse(res.content);
  848. res.content.text =this.turnFace(res.content.text);
  849. let time_line = this.$public.customFormatDateTime(res.time_line, '', 3);
  850. if (!historyTime) {
  851. res.time_line = time_line
  852. } else {
  853. let newTime = time_line.split(':');
  854. let lastTime = historyTime.split(':');
  855. if (newTime[0] == lastTime[0] && newTime[1] < (lastTime[1] + 2)) {
  856. res.time_line = '';
  857. } else {
  858. res.time_line = time_line
  859. }
  860. }
  861. // console.log(res.content);
  862. historyTime = time_line;
  863. this.hisSviceChat.push(res);
  864. })
  865. }
  866. //获取发送时间
  867. if (redata.message_type == "webTime") {
  868. // console.log(this.chat)
  869. // console.log(this.chatIndex)
  870. if (this.webTime) {
  871. let newTime = redata.data.webTime.split(':');
  872. let time = this.webTime.split(':');
  873. if (newTime[0] * 1 > time[0] * 1) {
  874. // console.log('newTime[0]')
  875. this.$set(this.chat[this.chatIndex], 'time', redata.data.webTime);
  876. } else if (newTime[0] * 1 == time[0] * 1 && (newTime[1] * 1 - time[1] * 1) > 2) {
  877. this.$set(this.chat[this.chatIndex], 'time', redata.data.webTime);
  878. // console.log('newTime[1]')
  879. }
  880. } else {
  881. this.$set(this.chat[this.chatIndex],'time',redata.data.webTime);
  882. }
  883. this.webTime = redata.data.webTime
  884. }
  885. // 评价返回
  886. if (redata.message_type == "evaluate") {
  887. if (redata.data.status == 1) {
  888. this.comtSuccess = true;
  889. localStorage.setItem('comtSuccess',true)
  890. }
  891. }
  892. //屏幕滚动
  893. this.automaticRolling();
  894. },
  895. /*******************************************/
  896. //数据发送
  897. socket_send(Data) {
  898. this.websock.send(Data);
  899. },
  900. /*******************************************/
  901. //关闭
  902. socket_close(e) {
  903. console.log('断开连接', e);
  904. this.nloding('网络接中...');
  905. this.initData = 100;
  906. this.link_success = false;
  907. this.setInit();
  908. this.reconnect();
  909. // this.registered();
  910. // this.websock.close()
  911. },
  912. /***************************************/
  913. //socket重连
  914. reconnect() {
  915. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  916. return
  917. }
  918. this.lockReconnect = true;
  919. this.reconnectData && clearTimeout(this.reconnectData);
  920. this.reconnectData = setTimeout(() => {
  921. this.initWebSocket(this.apiToken);
  922. //this.registered()
  923. // console.log('-----lail-----');
  924. this.lockReconnect = false;
  925. }, 2000)
  926. },
  927. /*************************************/
  928. //心跳检测
  929. heatBeat() {
  930. this.timeoutObj && clearTimeout(this.timeoutObj);
  931. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  932. this.timeoutObj = setTimeout(() => {
  933. // console.log('发送', {type: 'ping'});
  934. this.socket_send(JSON.stringify({type: 'ping'})) //根据后台要求发送
  935. this.serverTimeoutObj = setTimeout(() => {
  936. // console.log('------close-------')
  937. this.websock.close(); //如果 4秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  938. }, 4000);
  939. }, this.timeout)
  940. },
  941. /*****************************************/
  942. //用户匿名注册
  943. registered() {
  944. let token = localStorage.getItem('token');
  945. let appuid = this.$public.getQueryString('appuid');
  946. let tutype = this.$public.getQueryString('tutype');
  947. if (appuid && tutype >= 1) {
  948. token = localStorage.getItem('token');
  949. } else if (!appuid && tutype < 1) {
  950. token = localStorage.getItem('token');
  951. } else {
  952. token = '';
  953. }
  954. let data = {
  955. token: token != null ? token : '',
  956. appid: this.$public.getQueryString('appid'),
  957. appuid: this.$public.getQueryString('appuid'),
  958. }
  959. let obj = {
  960. headers: {
  961. "apiToken": this.setApiToken('autoReg', 'register', this.currentTime[0], 'index')
  962. }
  963. }
  964. this.$http.post('/index/register/autoReg', data, obj).then(res => {
  965. if (res.data.code == 0) {
  966. this.$dialog.alert({
  967. mes: res.data.msg
  968. });
  969. } else if (res.data.code == 1) {
  970. this.user_info = res.data.data;
  971. // console.log(this.user_info)
  972. localStorage.setItem('uid', res.data.data.id)
  973. // 游客 token
  974. localStorage.setItem("token", res.data.data.token);
  975. localStorage.setItem("tutype", res.data.tutype);
  976. //Websocket链接
  977. this.$dialog.loading.close();
  978. this.initWebSocket(this.apiToken);
  979. //console.log(res.data.data)
  980. }
  981. })
  982. },
  983. /******************************************/
  984. //获取热门问题
  985. getProblem() {
  986. let obj = {
  987. headers: {
  988. // 'Content-Type': 'application/x-www-form-urlencoded',
  989. "apiToken": this.setApiToken('index', 'robot', this.currentTime[0], 'index')
  990. }
  991. }
  992. this.$http.post('/index/robot/index', {groups_id: 1, robotgroups_id: 1}, obj).then(res => {
  993. //console.log(res.data.data);
  994. this.problem = res.data.data;
  995. })
  996. },
  997. /*******************************************/
  998. //推送机器人消息
  999. pushMessage(e) {
  1000. this.robot.push({
  1001. type: 'service',
  1002. content: {text: e}
  1003. });
  1004. this.automaticRolling();
  1005. },
  1006. checkSetType(){
  1007. let u = navigator.userAgent, app = navigator.appVersion;
  1008. let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
  1009. let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  1010. if (isAndroid) {
  1011. return 'android';
  1012. }
  1013. if (isIOS) {
  1014.     return 'ios';
  1015. }
  1016. },
  1017. /*******************************************/
  1018. //转人工
  1019. turnArtificial(id) {
  1020. this.group = id;
  1021. // this.$dialog.loading.open('转接中...')
  1022. this.nloding('人工客服转接中');
  1023. if (this.isTurnArtifcial) {
  1024. let data = {
  1025. 'type': 'userInit',
  1026. data: {
  1027. 'uid': this.user_info.id,
  1028. 'name': this.user_info.name,
  1029. 'avatar': this.user_info.avatar,
  1030. 'group': this.group,
  1031. 'settype':this.checkSetType()
  1032. }
  1033. }
  1034. this.socket_send(JSON.stringify(data));
  1035. this.isTurnArtifcial = false
  1036. // if(){
  1037. // }else{
  1038. // setTimeout(()=>{
  1039. // this.socket_send(JSON.stringify(data));
  1040. // this.isTurnArtifcial = false
  1041. // })
  1042. // }
  1043. }
  1044. },
  1045. /******************************************/
  1046. // 消息发送
  1047. send() {
  1048. if (this.text_info == '') return;
  1049. let str = this.text_info;
  1050. let formatStr = str.replace(/\n|\r\n/g, "<br>");
  1051. let type = 'toRobot';
  1052. let data = {};
  1053. let obj = {
  1054. text: formatStr,
  1055. img: '',
  1056. type: ''
  1057. }
  1058. this.meme = false;
  1059. // console.log(JSON.stringify(obj))
  1060. //和人工发送消息
  1061. if (this.link_success) {
  1062. // if(this.getHistory){
  1063. // this.getHistory = false;
  1064. // }
  1065. data = {
  1066. from_name: this.user_info.name,
  1067. content: JSON.stringify(obj),
  1068. from_id: this.user_info.id,
  1069. avatar: '',
  1070. to_id: this.service_info.id,
  1071. to_name: this.service_info.name,
  1072. conversationId: this.conversationId,
  1073. }
  1074. type = 'chatMessage';
  1075. this.chatIndex = this.chat.length;
  1076. this.chat.push({
  1077. type: 'user',
  1078. time: '',
  1079. content: {text: this.turnFace(obj.text)}
  1080. })
  1081. } else {//和机器人聊天
  1082. data = {
  1083. groups_id: '1',
  1084. robot_name: formatStr,
  1085. robotgroups_id: '1',
  1086. }
  1087. // console.log(this.turnFace(formatStr));
  1088. type = 'toRobot';
  1089. //本地存放数据
  1090. this.robot.push({
  1091. type: 'user',
  1092. content: this.turnFace(formatStr) //obj
  1093. })
  1094. }
  1095. this.socket_send(JSON.stringify({type, data}))
  1096. this.text_info = '';
  1097. this.automaticRolling();
  1098. // console.log(data)
  1099. this.sendAudio();
  1100. // 还原输入框高度
  1101. let area = document.getElementById('textarea')
  1102. area.style.height = 36 + 'px';
  1103. },
  1104. // 消息发送音频
  1105. sendAudio() {
  1106. let send = new Audio();
  1107. send.src = '../../static/audio/send.wav';
  1108. send.play()
  1109. },
  1110. // 消息接收音频
  1111. receiveAudio() {
  1112. let receive = new Audio()
  1113. receive.src = "../../static/audio/receive.wav";
  1114. receive.play();
  1115. },
  1116. /*******************************************/
  1117. //获取转接人工客服列表
  1118. connectionService() {
  1119. // if (!this.isConnection) return
  1120. this.nloding('正在读取客服列表');
  1121. let obj = {
  1122. headers: {
  1123. "apiToken": this.setApiToken('index', 'groups', this.currentTime[0], 'index')
  1124. }
  1125. }
  1126. // this.isConnection = false;
  1127. //api
  1128. this.$http.get('/index/groups/index', obj).then(res => {
  1129. this.closeNloading();
  1130. if (res.data.code == 1) {
  1131. this.robot.push({
  1132. type: 'artificial_service',
  1133. content: res.data.data
  1134. });
  1135. this.automaticRolling();
  1136. }
  1137. })
  1138. //this.hintSwitch.connection = true; //系统提示开关激活
  1139. // 此处为请求
  1140. },
  1141. /*******************************************/
  1142. //发送消息后自动滚动高度
  1143. automaticRolling() {
  1144. this.$nextTick(() => {
  1145. let msg = document.getElementById('main') // 获取对象
  1146. // let input_box = document.getElementById('input_box') // 获取对象
  1147. //判断是否是苹果手机自代浏览器
  1148. if (/iPhone/.test(navigator.userAgent)) {
  1149. this.Safari_height = true; //input_box+'px';
  1150. }
  1151. if (/Linux/.test(navigator.userAgent)) {
  1152. this.Chrome_height = true; //input_box+'px';
  1153. }
  1154. msg.scrollTop = msg.scrollHeight // 滚动高度
  1155. })
  1156. },
  1157. /*******************************************/
  1158. //图片发送
  1159. uploadIMG(e) {
  1160. // console.log(e);
  1161. let self = this;
  1162. let files = e.target.files || e.dataTransfer.files;
  1163. if (!files.length) return;
  1164. let picavalue = files[0];
  1165. const isJPG = file.type == 'image/jpeg' || 'image/jpg' || 'image/png' || 'image/svg';
  1166. const isLt2M = picavalue.size / 1000 / 1000 > 2;
  1167. if (isLt2M) {
  1168. this.$dialog.notify({
  1169. mes: '图片过大不支持上传哦!',
  1170. timeout: 2000,
  1171. });
  1172. } else if (!isJPG) {
  1173. this.$dialog.notify({
  1174. mes: '只能上传图片哦!',
  1175. timeout: 2000,
  1176. });
  1177. } else {
  1178. this.$public.imgPreview(picavalue, function (imgSrc, formData) {
  1179. // let img = imgSrc;
  1180. // 数据结构请求
  1181. self.$http.uploadPost('/index/upload/uploadImg', formData).then(res => {
  1182. e.target.value = "";
  1183. // console.log(res.data.code)
  1184. if (res.data.code == 1) {
  1185. let type = 'toRobot';
  1186. let data = {};
  1187. let obj = {
  1188. text: '',
  1189. img: res.data.data.src,
  1190. type: ''
  1191. }
  1192. if (self.link_success) {
  1193. //和人工聊天发送图片
  1194. data = {
  1195. from_name: self.user_info.name,
  1196. content: JSON.stringify(obj),
  1197. from_id: self.user_info.id,
  1198. avatar: '',
  1199. to_id: self.service_info.id,
  1200. to_name: self.service_info.name,
  1201. conversationId: self.conversationId,
  1202. }
  1203. type = 'chatMessage';
  1204. self.chatIndex = self.chat.length;
  1205. //本地储存
  1206. self.chat.push({
  1207. type: 'user',
  1208. time:"",
  1209. content: {img: res.data.data.src}
  1210. });
  1211. } else {
  1212. //和机器发送图片
  1213. data = {
  1214. groups_id: '1',
  1215. robot_name: res.data.data.src,
  1216. robotgroups_id: '1',
  1217. }
  1218. type = 'toRobot';
  1219. //本地储存
  1220. self.robot.push({
  1221. type: 'user',
  1222. content: {img: res.data.data.src}
  1223. });
  1224. }
  1225. self.socket_send(JSON.stringify({type, data}))
  1226. self.automaticRolling();
  1227. }
  1228. })
  1229. });
  1230. }
  1231. },
  1232. /**监听滚动事件,使消息能完全看见 */
  1233. scrollMain() {
  1234. let main = document.getElementById('main')
  1235. let footer = document.getElementById('input_box')
  1236. main.style.bottom = 0;
  1237. main.style.paddingBottom = (footer.offsetHeight - 30) + 'px'
  1238. },
  1239. /** 监听输入框滚动高度,并给textarea高度赋值*/
  1240. keyup_maxlength(){
  1241. let area = document.getElementById('textarea')
  1242. this.areaHeight = area.scrollHeight > 36 ? area.scrollHeight : 36;
  1243. let main = document.getElementById('main')
  1244. this.makeExpandingArea(area)
  1245. //console.log('screen:', window.screen.height, 'inner:', window.innerHeight)
  1246. // main.style.bottom = this.needScrollTop + 'px'
  1247. // console.log('foucus', this.needScrollTop)
  1248. // this.automaticRolling();
  1249. },
  1250. focus_maxlength() {
  1251. this.automaticRolling();
  1252. },
  1253. /** 兼容处理 */
  1254. makeExpandingArea(el) {
  1255. var timer = null;
  1256. //由于ie8有溢出堆栈问题,故调整了这里
  1257. var setStyle = function(el, auto) {
  1258. if (auto) el.style.height = 'auto';
  1259. el.style.height = el.scrollHeight + 'px';
  1260. }
  1261. var delayedResize = function(el) {
  1262. if (timer) {
  1263. clearTimeout(timer);
  1264. timer = null;
  1265. }
  1266. timer = setTimeout(function() {
  1267. setStyle(el)
  1268. }, 200);
  1269. }
  1270. if (el.addEventListener) {
  1271. el.addEventListener('input', function() {
  1272. setStyle(el, 1);
  1273. }, false);
  1274. setStyle(el)
  1275. } else if (el.attachEvent) {
  1276. el.attachEvent('onpropertychange', function() {
  1277. setStyle(el)
  1278. })
  1279. setStyle(el)
  1280. }
  1281. if (window.VBArray && window.addEventListener) { //IE9
  1282. el.attachEvent("onkeydown", function() {
  1283. var key = window.event.keyCode;
  1284. if (key == 8 || key == 46) delayedResize(el);
  1285. });
  1286. el.attachEvent("oncut", function() {
  1287. delayedResize(el);
  1288. }); //处理粘贴
  1289. }
  1290. },
  1291. /*******************************************/
  1292. //手机弹窗处理
  1293. inputShow(e) {
  1294. //console.log('a')
  1295. let ua = navigator.userAgent.toLowerCase();
  1296. if (ua.match(/iPhone\sOS/i) == "iphone os") {
  1297. var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight;
  1298. setTimeout(() => {
  1299. document.body.scrollTop = document.body.scrollHeight - (nowClientHeight / 2)
  1300. }, 200);
  1301. } else {
  1302. setTimeout(function () {
  1303. e.target.scrollIntoView({behavior: "smooth", block: "end"});
  1304. }, 100);
  1305. }
  1306. },
  1307. /******************文字信息转表情******************/
  1308. turnFace(data) {
  1309. let str = data.match(/\#\[.*?\]\//g);
  1310. let arr = Array.from(new Set(str));
  1311. arr.forEach(e => {
  1312. let imgsrc = '';
  1313. for (let i = 0; i < this.frceArr.length; i++) {
  1314. let expText = e.slice(1, e.length - 1);
  1315. if (expText == this.frceArr[i]) {
  1316. imgsrc = '<img class="hover" src="' + require(`@/assets/${i}.gif`) + '"/>'
  1317. break;
  1318. }
  1319. }
  1320. data = data.replace(new RegExp(`\\#\\[${e.substring(2, e.length - 2)}\\]\\/`, 'g'), imgsrc);
  1321. })
  1322. return data;
  1323. },
  1324. /*******************************************/
  1325. // 表情包开关
  1326. faceClick() {
  1327. this.meme = !this.meme;
  1328. },
  1329. /*******************************************/
  1330. //当表情被点击
  1331. memeImg(i) {
  1332. this.text_info = this.text_info + "#" + this.frceArr[i] + "/";
  1333. //this.text_info = this.text_info + '<img :src="' + require(`@/assets/${i}.gif`) +'"/>';
  1334. // console.log( this.text_info);
  1335. },
  1336. // /*******************************************/
  1337. // //验证码
  1338. // initialLoginCode() {
  1339. // this.loginCode = "";
  1340. // for (let i = 1; i <= 4; i++) {
  1341. // this.loginCode =
  1342. // this.loginCode + frce.arr[Math.floor(Math.random() * 32)];
  1343. // }
  1344. // },
  1345. /********************************************/
  1346. //显示隐藏评价
  1347. is_show_evaluate() {
  1348. if(localStorage.getItem('comtSuccess')){
  1349. this.$dialog.notify({
  1350. mes: '亲,您已经评价了...',
  1351. timeout: 3000,
  1352. });
  1353. return false;
  1354. }
  1355. if (this.evaluateState == 100) {
  1356. this.bottomShow = true;
  1357. } else {
  1358. if (!this.haveEvaluation) {
  1359. this.bottomShow = false;
  1360. } else {
  1361. this.$dialog.notify({
  1362. mes: '亲,您已经评价了...',
  1363. timeout: 5000,
  1364. callback: () => {
  1365. //console.log('我走咯!');
  1366. }
  1367. });
  1368. }
  1369. }
  1370. },
  1371. /*******************************************/
  1372. //切换评价状态
  1373. evaluateClick(type) {
  1374. // console.log(type);
  1375. this.evaluateState = type;
  1376. },
  1377. /*******************************************/
  1378. //提交评价信息
  1379. evaluateEsc() {
  1380. if (this.evaluateState != 100) {
  1381. this.bottomShow = false;
  1382. this.haveEvaluation = true; // 标识已评价
  1383. this.socket_send(JSON.stringify({
  1384. type: 'evaluate', data: {
  1385. evaluate_id: this.evaluateState,
  1386. conversationId: this.conversationId,
  1387. // evaluate_content:''
  1388. }
  1389. }))
  1390. let that = this
  1391. this.$dialog.notify({
  1392. mes: '感谢你的评价!',
  1393. timeout: 2000,
  1394. callback: () => {
  1395. //console.log('我走咯!');
  1396. }
  1397. });
  1398. } else {
  1399. this.$dialog.notify({
  1400. mes: '亲,请选择评价类型...',
  1401. timeout: 2000,
  1402. callback: () => {
  1403. //console.log('我走咯!');
  1404. }
  1405. });
  1406. }
  1407. },
  1408. /************************************************/
  1409. //人工聊天初始化
  1410. setInit() {
  1411. this.haveEvaluation = false;
  1412. this.chat = [];
  1413. this.evaluateState = 100;
  1414. this.hisSviceChat = [];
  1415. this.meme = false
  1416. // this.frceArr = [];//表情包代码
  1417. this.isConnection = true;
  1418. this.isExit = false;
  1419. this.service_info = {
  1420. avatar: '/static/customer/images/robot.png',
  1421. job_name: '001',
  1422. name: '智能客服',
  1423. signature: " "
  1424. }
  1425. },
  1426. /* ****************获取聊天次数****************** */
  1427. getChatNum() {
  1428. this.$http.get('/index/evaluate/minRound', {
  1429. headers: {
  1430. 'Content-Type': 'application/x-www-form-urlencoded',
  1431. 'apiToken': this.setApiToken('minround', 'evaluate', this.currentTime[0], 'index')
  1432. }
  1433. }).then(res => {
  1434. if (res.data.code == 1) {
  1435. this.chatNum = res.data.data.systemconfig_data;
  1436. // console.log(this.chatNum, '聊天限制')
  1437. }
  1438. })
  1439. },
  1440. // 留言知识库返回到主页
  1441. returnIndex(data) {
  1442. console.log(data)
  1443. this.knowledge = data
  1444. }
  1445. },
  1446. /**
  1447. * 视图挂载前
  1448. */
  1449. mounted() {
  1450. this.source.appuid = this.$public.getQueryString('appuid');//用户标识
  1451. this.source.appid = this.$public.getQueryString('appid');//用户来源
  1452. this.frceArr = frce.frce;
  1453. //console.log(this.source);
  1454. //页面初始化获取系统时间第一步
  1455. //console.log(this.$md5('userwordscustomer-servicewords1562169600service'));
  1456. this.$dialog.loading.open('网络连接中...');
  1457. this.$http.get('/index/index/systime?t=' + 100).then(res => {
  1458. if (res.data.code == 1) {
  1459. this.logo = res.data.data.logo;
  1460. this.currentTime = res.data.data.time.split(' ')
  1461. this.currentTime[0] = (new Date(this.currentTime[0].replace(/-/g, '/')).getTime()) / 1000;
  1462. // console.log( this.currentTime[0] );
  1463. this.apiToken = this.$md5('customer-service' + window.location.origin);
  1464. //匿名注册
  1465. this.registered();
  1466. //获取机器人热门问题
  1467. this.getProblem();
  1468. //获取配置信息
  1469. this.getChatNum();
  1470. }
  1471. })
  1472. },
  1473. destroyed() {
  1474. this.setInit();
  1475. this.websock.close() //离开路由之后断开websocket连接
  1476. this.lockReconnect = true;
  1477. clearTimeout(this.reconnectData); //离开清除 timeout
  1478. clearTimeout(this.timeoutObj); //离开清除 timeout
  1479. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  1480. },
  1481. // 计算
  1482. computed: {
  1483. inputmsg() {
  1484. return this.text_info;
  1485. },
  1486. iboxheight(){
  1487. return this.ibox_height;
  1488. },
  1489. // 需要额外滚动的高度,大小为键盘高度加上输入框的高度
  1490. needScrollTop: function () {
  1491. if(this.innerHeight > 0) {
  1492. // return (this.innerHeight > window.innerHeight ? this.innerHeight : innerHeight )
  1493. // - window.innerHeight + this.areaHeight -36
  1494. return window.screen.height - window.innerHeight + this.areaHeight -36
  1495. } else {
  1496. return 0;
  1497. }
  1498. },
  1499. },
  1500. // 监听
  1501. watch: {},
  1502. // 组件生命周期结束销毁阶段
  1503. beforeDestroy() {
  1504. this.timers = false;
  1505. }
  1506. };
  1507. </script>
  1508. <style scoped>
  1509. #textarea {
  1510. flex: 1;
  1511. height: 36px;
  1512. margin: 15px;
  1513. border: none;
  1514. }
  1515. .logo {
  1516. margin: 0 0.1rem;
  1517. width: 0.4rem;
  1518. height: 0.4rem;
  1519. }
  1520. /* 聊天 */
  1521. .memeImg {
  1522. width: 0.6rem;
  1523. height: 0.6rem;
  1524. margin: 0.15rem 0.4rem;
  1525. }
  1526. .dialogueA {
  1527. padding-left: 0.3rem;
  1528. padding-right: 0.3rem;
  1529. }
  1530. .dialogueB {
  1531. padding-right: 0.3rem;
  1532. padding-left: 0.3rem;
  1533. }
  1534. .left {
  1535. position: relative;
  1536. z-index: 99;
  1537. background: #fff;
  1538. }
  1539. .left::after {
  1540. position: absolute;
  1541. content: "";
  1542. display: inline-block;
  1543. left: -0.08rem;
  1544. top: 0.2rem;
  1545. width: 0.125rem;
  1546. height: 0.2rem;
  1547. background: #fff;
  1548. transform: skewX(30deg);
  1549. z-index: -1;
  1550. border-left: 0.02rem solid #dfdfdf;
  1551. border-top: 0.02rem solid #dfdfdf;
  1552. }
  1553. .right {
  1554. position: relative;
  1555. z-index: 99;
  1556. background: #5ea0f7;
  1557. border: 0.02rem solid #5ea0f7;
  1558. }
  1559. .right::after {
  1560. position: absolute;
  1561. content: "";
  1562. display: inline-block;
  1563. right: -0.07rem;
  1564. top: 0.2rem;
  1565. width: 0.125rem;
  1566. height: 0.2rem;
  1567. background: #5ea0f7;
  1568. transform: skewX(-30deg);
  1569. z-index: -1;
  1570. border-left: 0.02rem solid #5ea0f7;
  1571. border-top: 0.02rem solid #5ea0f7;
  1572. }
  1573. .service {
  1574. width: 100%;
  1575. color: #555;
  1576. font-size: 0.28rem;
  1577. padding-top: 1rem;
  1578. background: #f5f5f5;
  1579. }
  1580. .header {
  1581. position: fixed;
  1582. left: 0;
  1583. top: 0;
  1584. width: 100%;
  1585. z-index: 999;
  1586. height: 1rem;
  1587. background: linear-gradient(
  1588. 90deg,
  1589. rgba(22, 84, 209, 1) 0%,
  1590. rgba(9, 52, 173, 1) 100%
  1591. );
  1592. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1593. font-size: 0.34rem;
  1594. color: #fff;
  1595. padding: 0 0.3rem;
  1596. }
  1597. .main {
  1598. position: relative;
  1599. box-sizing: border-box;
  1600. height: 83vh;
  1601. overflow-x: hidden;
  1602. overflow-y: auto;
  1603. padding:0.4rem 0.3rem;
  1604. padding-top:0;
  1605. }
  1606. .btn {
  1607. display: inline-block;
  1608. padding: 0 0.36rem;
  1609. text-align: center;
  1610. line-height: 0.4rem;
  1611. background: rgba(221, 221, 221, 1);
  1612. border-radius: 0.3rem;
  1613. color: #fff;
  1614. font-size: 0.24rem;
  1615. max-width: 6rem;
  1616. margin: 0 auto;
  1617. margin-top: 0.3rem;
  1618. }
  1619. .btn .click {
  1620. color: #5ea0f7;
  1621. }
  1622. .btnRouter {
  1623. color: #5ea0f7;
  1624. }
  1625. .systemDialogue {
  1626. min-height: 0.8rem;
  1627. width: 100%;
  1628. }
  1629. .manUserDialogue {
  1630. min-height: 1rem;
  1631. }
  1632. .manPlatformDialogue {
  1633. min-height: 1rem;
  1634. }
  1635. .user {
  1636. padding: 0.2rem;
  1637. display: inline-block;
  1638. border-radius: 0.1rem;
  1639. font-size: 0.28rem;
  1640. color: #fff;
  1641. max-width: 19.1rem;
  1642. table-layout:fixed;
  1643. word-break: break-all;
  1644. text-align: left;
  1645. }
  1646. .HeadPortrait {
  1647. width: 1rem;
  1648. height: 1rem;
  1649. /* background: #ddd; */
  1650. border-radius: 0.1rem;
  1651. }
  1652. .HeadPortrait img {
  1653. width: 100%;
  1654. height: 100%;
  1655. }
  1656. .icon {
  1657. width: 0.32rem;
  1658. height: 0.32rem;
  1659. }
  1660. .icon-msg {
  1661. margin-top: 0.06rem;
  1662. margin-left: 0.2rem;
  1663. width: 0.32rem;
  1664. height: 0.32rem;
  1665. }
  1666. .customerService {
  1667. background: #ffffff;
  1668. padding: 0.2rem;
  1669. display: inline-block;
  1670. border-radius: 0.1rem;
  1671. font-size: 0.28rem;
  1672. border: 1px solid rgba(223, 223, 223, 1);
  1673. }
  1674. .customerService {
  1675. /* min-height: 1rem; */
  1676. }
  1677. .system {
  1678. width: 100%;
  1679. border: 0.01rem solid rgba(223, 223, 223, 1);
  1680. border-radius: 0.1rem;
  1681. }
  1682. div /deep/ .yd-accordion-head {
  1683. /* border-radius: 0.1rem; */
  1684. border-bottom: 0.01rem solid rgb(238, 238, 238);
  1685. padding: 0 0.2rem;
  1686. }
  1687. div /deep/ .yd-accordion-title, div /deep/ .yd-accordion-head-arrow {
  1688. min-height: 0.8rem !important;
  1689. }
  1690. div /deep/ .yd-textarea textarea {
  1691. -webkit-user-select: auto;
  1692. }
  1693. .footer {
  1694. display: flex;
  1695. min-height: 1.2rem;
  1696. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1697. background: #fff;
  1698. width: 100%;
  1699. position: fixed;
  1700. bottom: 0;
  1701. left: 0;
  1702. z-index: 1000;
  1703. }
  1704. .input {
  1705. width: 60%;
  1706. min-height: 1.2rem;
  1707. padding-top: 0.4rem;
  1708. padding-bottom: 0.4rem;
  1709. border: none;
  1710. padding-right: 0.3rem;
  1711. padding-left: 0.3rem;
  1712. font-size: 0.28rem;
  1713. }
  1714. .send {
  1715. flex: 0 0 130px;
  1716. margin-right: 10px;
  1717. text-align: right;
  1718. /* position: absolute;
  1719. right: 0;
  1720. top: 0; */
  1721. background: #fff;
  1722. height: 1.2rem;
  1723. }
  1724. .memeBox {
  1725. height: 3rem;
  1726. width: 100%;
  1727. }
  1728. .send img {
  1729. vertical-align: middle;
  1730. margin-right: 0.4rem;
  1731. }
  1732. .artificial {
  1733. margin: 0.3rem 0 0 1.3rem;
  1734. width: 77%;
  1735. border: 0.01rem solid #dfdfdf;
  1736. background: #fff;
  1737. border-radius: 0.1rem;
  1738. padding: 0 0.2rem;
  1739. }
  1740. div /deep/ .yd-accordion-head-arrow:after {
  1741. border: none;
  1742. width: 0.3rem;
  1743. height: 0.3rem;
  1744. background: url("../assets/addright.png") no-repeat;
  1745. background-size: 100% 100%;
  1746. transform: rotate(0deg);
  1747. }
  1748. div /deep/ .yd-accordion-head-arrow.yd-accordion-rotated:after {
  1749. transform: rotate(-270deg);
  1750. }
  1751. div /deep/ .yd-accordion {
  1752. border-radius: 0.1rem;
  1753. }
  1754. div /deep/ .yd-accordion-content {
  1755. border-radius: 0.1rem;
  1756. }
  1757. .imgSrc img {
  1758. width: 1.2rem;
  1759. }
  1760. .leftHader {
  1761. height: 1rem;
  1762. background: linear-gradient(
  1763. 90deg,
  1764. rgba(22, 84, 209, 1) 0%,
  1765. rgba(9, 52, 173, 1) 100%
  1766. );
  1767. box-shadow: 0 0.03rem 0.03rem rgba(0, 0, 0, 0.2);
  1768. padding: 0 0.3rem;
  1769. }
  1770. .leftMain-top {
  1771. margin-top: 0.4rem;
  1772. font-size: 0.28rem;
  1773. line-height: 0.45rem;
  1774. padding: 0 0.3rem;
  1775. color: #666;
  1776. }
  1777. .leftMain-top span {
  1778. color: #999;
  1779. }
  1780. .leftMain-top > div {
  1781. width: 50%;
  1782. }
  1783. .leftMain-center {
  1784. margin-top: 0.3rem;
  1785. color: #666;
  1786. line-height: 0.5rem;
  1787. }
  1788. .leftMain-chenter span {
  1789. color: #999;
  1790. font-size: 0.28rem;
  1791. }
  1792. .evaluate {
  1793. height: 1.7rem;
  1794. background: #fff;
  1795. border: 0.01rem solid #ddd;
  1796. border-radius: 0.1rem;
  1797. color: #666;
  1798. margin-top: 0.3rem;
  1799. }
  1800. .evaluateBtn {
  1801. width: 1.4rem;
  1802. height: 0.6rem;
  1803. border: none;
  1804. background: #f04992;
  1805. color: #fff;
  1806. border-radius: 0.1rem;
  1807. }
  1808. div /deep/ .yd-popup {
  1809. border-radius: 0.2rem 0.2rem 0 0;
  1810. }
  1811. div /deep/ .yd-popup-content {
  1812. }
  1813. .evaluatebtn > div p {
  1814. height: 50%;
  1815. width: 100%;
  1816. text-align: center;
  1817. margin-top: 0.14rem;
  1818. }
  1819. .evaluatebtn > div {
  1820. display: flex;
  1821. align-items: center;
  1822. justify-content: center;
  1823. }
  1824. .evaluateBox {
  1825. margin: 0 0.2rem;
  1826. height: 1.5rem;
  1827. border: 0.01rem solid #ddd;
  1828. border-radius: 0.1rem;
  1829. background: #f5f5f5;
  1830. }
  1831. .evaluateBox textarea {
  1832. width: 100%;
  1833. height: 100%;
  1834. background: #f5f5f5;
  1835. border: none;
  1836. border-radius: 0.1rem;
  1837. padding: 0.2rem;
  1838. color: #999;
  1839. font-size: 0.28rem;
  1840. }
  1841. .sub {
  1842. margin: 0 0.2rem;
  1843. background: linear-gradient(
  1844. 90deg,
  1845. rgba(22, 84, 209, 1) 0%,
  1846. rgba(9, 52, 173, 1) 100%
  1847. );
  1848. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1849. height: 1rem;
  1850. font-size: 0.34rem;
  1851. color: #fff;
  1852. border-radius: 0.1rem;
  1853. margin-top: 0.4rem;
  1854. }
  1855. div /deep/ .yd-popup-content {
  1856. background: #fff;
  1857. border-radius: 0.1rem;
  1858. }
  1859. .loginInput {
  1860. height: 0.8rem;
  1861. border: 0.01rem solid #ddd;
  1862. background: #f5f5f5;
  1863. border-radius: 0.1rem;
  1864. margin-top: 0.5rem;
  1865. padding: 0.2rem;
  1866. font-size: 0.28rem;
  1867. margin: 0.2rem;
  1868. margin-top: 0.5rem;
  1869. width: 94%;
  1870. color: #999;
  1871. }
  1872. /* 留言 */
  1873. .leave-header {
  1874. height: 1rem;
  1875. background: linear-gradient(
  1876. 90deg,
  1877. rgba(22, 84, 209, 1) 0%,
  1878. rgba(9, 52, 173, 1) 100%
  1879. );
  1880. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1881. color: #fff;
  1882. font-size: 0.34rem;
  1883. padding: 0 0.3rem;
  1884. }
  1885. .leave-main {
  1886. height: 10rem;
  1887. background: #f5f5f5;
  1888. font-size: 0.28rem;
  1889. padding: 0.3rem 0.3rem 0.2rem 0.3rem;
  1890. }
  1891. .leave-main > div {
  1892. height: 1.3rem;
  1893. margin-bottom: 0.2rem;
  1894. }
  1895. .leave-main > div input {
  1896. height: 0.8rem;
  1897. border: 0.01rem solid #ddd;
  1898. border-radius: 0.1rem;
  1899. background: #fff;
  1900. padding: 0.2rem;
  1901. width: 100%;
  1902. margin-top: 0.1rem;
  1903. }
  1904. .leave-main-txt {
  1905. background: #fff;
  1906. padding: 0.2rem;
  1907. border: 0.01rem solid #ddd;
  1908. border-radius: 0.1rem;
  1909. }
  1910. .imgMsg {
  1911. height: 1.5rem;
  1912. padding: 0 0.2rem;
  1913. margin-top: 0.1rem;
  1914. font-size: 0.24rem;
  1915. background: #fff;
  1916. border: 0.01rem solid #ddd;
  1917. border-radius: 0.1rem;
  1918. }
  1919. .yd-cell-box {
  1920. width: 60%;
  1921. min-height: 1.2rem;
  1922. border: none;
  1923. padding-right: 0.3rem;
  1924. padding-left: 0.3rem;
  1925. border-bottom: 0.01rem solid rgb(221, 221, 221);
  1926. }
  1927. div /deep/ .yd-textarea > textarea {
  1928. min-height: 1.2rem;
  1929. font-size: 0.28rem;
  1930. padding-top: 0.2rem;
  1931. }
  1932. .yd-textarea {
  1933. padding: 0;
  1934. }
  1935. .yd-cell-box {
  1936. margin: 0;
  1937. }
  1938. .yd-cell-item {
  1939. padding: 0;
  1940. }
  1941. div /deep/ .yd-cell:after {
  1942. height: 0;
  1943. }
  1944. div /deep/ .yd-textarea-counter {
  1945. display: none;
  1946. }
  1947. .promptBox {
  1948. display: flex;
  1949. justify-content: center;
  1950. height: 26px;
  1951. margin: 10px 0 10px;
  1952. /* line-height: 26px; */
  1953. }
  1954. .promptBoxH {
  1955. display: flex;
  1956. justify-content: center;
  1957. height: 50px;
  1958. margin: 10px 0 10px;
  1959. /* line-height: 26px; */
  1960. }
  1961. .prompt {
  1962. line-height: 25px;
  1963. text-align: center;
  1964. background: #DDDDDD;
  1965. border-radius: 30px;
  1966. width: 140px;
  1967. color: #FFFFFF;
  1968. font-size: 12px;
  1969. }
  1970. .help {
  1971. width: 80%;
  1972. }
  1973. .help .prompt {
  1974. width: 100%;
  1975. }
  1976. .row .rightAlignment {
  1977. text-align: right;
  1978. display: block;
  1979. }
  1980. #main{
  1981. /* margin-bottom: .3rem; */
  1982. }
  1983. /*
  1984. *留言知识库
  1985. */
  1986. </style>