index.vue 58 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173
  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. this.$dialog.alert({
  796. mes: redata.content, callback: () => {
  797. this.initData = 100;
  798. // _this.$dialog.loading.open('数据加载中...');
  799. // setTimeout(() => {
  800. // _this.$dialog.loading.close();
  801. // // _this.registered();
  802. // }, 2000);
  803. }
  804. });
  805. }
  806. //系统消息评价
  807. if (redata.message_type == "getEvaluate") {
  808. // this.evaluateOnOff = true;
  809. // console.log( this.chat)
  810. this.chat.push({
  811. type: 'system',
  812. content: {
  813. text: redata.data.content,
  814. state: 'getEvaluate',
  815. }
  816. })
  817. }
  818. //会话关闭前通知用户
  819. if (redata.message_type == 'overtime') {
  820. this.chat.push({
  821. type: 'system',
  822. content: {
  823. text: redata.data.content,
  824. state: 'closeInform',
  825. }
  826. })
  827. }
  828. // 历史信息
  829. if (redata.message_type == 'toOld') {
  830. this.hisSviceChat = [];
  831. let obj = redata;
  832. this.historyMsgtext = obj.data.content;
  833. this.chat.push({
  834. type: 'historyMsg',
  835. content: {
  836. text: this.historyMsgtext,
  837. }
  838. })
  839. let historyTime = '';
  840. this.hisLength =obj.data.chatLog.length
  841. obj.data.chatLog.forEach(res => {
  842. // console.log(res,'历史信息');
  843. res.content = JSON.parse(res.content);
  844. res.content.text =this.turnFace(res.content.text);
  845. let time_line = this.$public.customFormatDateTime(res.time_line, '', 3);
  846. if (!historyTime) {
  847. res.time_line = time_line
  848. } else {
  849. let newTime = time_line.split(':');
  850. let lastTime = historyTime.split(':');
  851. if (newTime[0] == lastTime[0] && newTime[1] < (lastTime[1] + 2)) {
  852. res.time_line = '';
  853. } else {
  854. res.time_line = time_line
  855. }
  856. }
  857. // console.log(res.content);
  858. historyTime = time_line;
  859. this.hisSviceChat.push(res);
  860. })
  861. }
  862. //获取发送时间
  863. if (redata.message_type == "webTime") {
  864. // console.log(this.chat)
  865. // console.log(this.chatIndex)
  866. if (this.webTime) {
  867. let newTime = redata.data.webTime.split(':');
  868. let time = this.webTime.split(':');
  869. if (newTime[0] * 1 > time[0] * 1) {
  870. // console.log('newTime[0]')
  871. this.$set(this.chat[this.chatIndex], 'time', redata.data.webTime);
  872. } else if (newTime[0] * 1 == time[0] * 1 && (newTime[1] * 1 - time[1] * 1) > 2) {
  873. this.$set(this.chat[this.chatIndex], 'time', redata.data.webTime);
  874. // console.log('newTime[1]')
  875. }
  876. } else {
  877. this.$set(this.chat[this.chatIndex],'time',redata.data.webTime);
  878. }
  879. this.webTime = redata.data.webTime
  880. }
  881. // 评价返回
  882. if (redata.message_type == "evaluate") {
  883. if (redata.data.status == 1) {
  884. this.comtSuccess = true;
  885. localStorage.setItem('comtSuccess',true)
  886. }
  887. }
  888. //屏幕滚动
  889. this.automaticRolling();
  890. },
  891. /*******************************************/
  892. //数据发送
  893. socket_send(Data) {
  894. this.websock.send(Data);
  895. },
  896. /*******************************************/
  897. //关闭
  898. socket_close(e) {
  899. console.log('断开连接', e);
  900. this.nloding('网络接中...');
  901. this.initData = 100;
  902. this.link_success = false;
  903. this.setInit();
  904. this.reconnect();
  905. // this.registered();
  906. // this.websock.close()
  907. },
  908. /***************************************/
  909. //socket重连
  910. reconnect() {
  911. if (this.lockReconnect) { //这里很关键,因为连接失败之后之后会相继触发 连接关闭,不然会连接上两个 WebSocket
  912. return
  913. }
  914. this.lockReconnect = true;
  915. this.reconnectData && clearTimeout(this.reconnectData);
  916. this.reconnectData = setTimeout(() => {
  917. this.initWebSocket(this.apiToken);
  918. //this.registered()
  919. // console.log('-----lail-----');
  920. this.lockReconnect = false;
  921. }, 2000)
  922. },
  923. /*************************************/
  924. //心跳检测
  925. heatBeat() {
  926. this.timeoutObj && clearTimeout(this.timeoutObj);
  927. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  928. this.timeoutObj = setTimeout(() => {
  929. // console.log('发送', {type: 'ping'});
  930. this.socket_send(JSON.stringify({type: 'ping'})) //根据后台要求发送
  931. this.serverTimeoutObj = setTimeout(() => {
  932. // console.log('------close-------')
  933. this.websock.close(); //如果 4秒之后我们没有收到 后台返回的心跳检测数据 断开socket,断开后会启动重连机制
  934. }, 4000);
  935. }, this.timeout)
  936. },
  937. /*****************************************/
  938. //用户匿名注册
  939. registered() {
  940. let token = localStorage.getItem('token');
  941. let appuid = this.$public.getQueryString('appuid');
  942. let tutype = this.$public.getQueryString('tutype');
  943. if (appuid && tutype >= 1) {
  944. token = localStorage.getItem('token');
  945. } else if (!appuid && tutype < 1) {
  946. token = localStorage.getItem('token');
  947. } else {
  948. token = '';
  949. }
  950. let data = {
  951. token: token != null ? token : '',
  952. appid: this.$public.getQueryString('appid'),
  953. appuid: this.$public.getQueryString('appuid'),
  954. }
  955. let obj = {
  956. headers: {
  957. "apiToken": this.setApiToken('autoReg', 'register', this.currentTime[0], 'index')
  958. }
  959. }
  960. this.$http.post('/index/register/autoReg', data, obj).then(res => {
  961. if (res.data.code == 0) {
  962. this.$dialog.alert({
  963. mes: res.data.msg
  964. });
  965. } else if (res.data.code == 1) {
  966. this.user_info = res.data.data;
  967. // console.log(this.user_info)
  968. localStorage.setItem('uid', res.data.data.id)
  969. // 游客 token
  970. localStorage.setItem("token", res.data.data.token);
  971. localStorage.setItem("tutype", res.data.tutype);
  972. //Websocket链接
  973. this.$dialog.loading.close();
  974. this.initWebSocket(this.apiToken);
  975. //console.log(res.data.data)
  976. }
  977. })
  978. },
  979. /******************************************/
  980. //获取热门问题
  981. getProblem() {
  982. let obj = {
  983. headers: {
  984. // 'Content-Type': 'application/x-www-form-urlencoded',
  985. "apiToken": this.setApiToken('index', 'robot', this.currentTime[0], 'index')
  986. }
  987. }
  988. this.$http.post('/index/robot/index', {groups_id: 1, robotgroups_id: 1}, obj).then(res => {
  989. //console.log(res.data.data);
  990. this.problem = res.data.data;
  991. })
  992. },
  993. /*******************************************/
  994. //推送机器人消息
  995. pushMessage(e) {
  996. this.robot.push({
  997. type: 'service',
  998. content: {text: e}
  999. });
  1000. this.automaticRolling();
  1001. },
  1002. checkSetType(){
  1003. let u = navigator.userAgent, app = navigator.appVersion;
  1004. let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Linux') > -1; //g
  1005. let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
  1006. if (isAndroid) {
  1007. return 'android';
  1008. }
  1009. if (isIOS) {
  1010.     return 'ios';
  1011. }
  1012. },
  1013. /*******************************************/
  1014. //转人工
  1015. turnArtificial(id) {
  1016. this.group = id;
  1017. // this.$dialog.loading.open('转接中...')
  1018. this.nloding('人工客服转接中');
  1019. if (this.isTurnArtifcial) {
  1020. let data = {
  1021. 'type': 'userInit',
  1022. data: {
  1023. 'uid': this.user_info.id,
  1024. 'name': this.user_info.name,
  1025. 'avatar': this.user_info.avatar,
  1026. 'group': this.group,
  1027. 'settype':this.checkSetType()
  1028. }
  1029. }
  1030. this.socket_send(JSON.stringify(data));
  1031. this.isTurnArtifcial = false
  1032. // if(){
  1033. // }else{
  1034. // setTimeout(()=>{
  1035. // this.socket_send(JSON.stringify(data));
  1036. // this.isTurnArtifcial = false
  1037. // })
  1038. // }
  1039. }
  1040. },
  1041. /******************************************/
  1042. // 消息发送
  1043. send() {
  1044. if (this.text_info == '') return;
  1045. let str = this.text_info;
  1046. let formatStr = str.replace(/\n|\r\n/g, "<br>");
  1047. let type = 'toRobot';
  1048. let data = {};
  1049. let obj = {
  1050. text: formatStr,
  1051. img: '',
  1052. type: ''
  1053. }
  1054. this.meme = false;
  1055. // console.log(JSON.stringify(obj))
  1056. //和人工发送消息
  1057. if (this.link_success) {
  1058. // if(this.getHistory){
  1059. // this.getHistory = false;
  1060. // }
  1061. data = {
  1062. from_name: this.user_info.name,
  1063. content: JSON.stringify(obj),
  1064. from_id: this.user_info.id,
  1065. avatar: '',
  1066. to_id: this.service_info.id,
  1067. to_name: this.service_info.name,
  1068. conversationId: this.conversationId,
  1069. }
  1070. type = 'chatMessage';
  1071. this.chatIndex = this.chat.length;
  1072. this.chat.push({
  1073. type: 'user',
  1074. time: '',
  1075. content: {text: this.turnFace(obj.text)}
  1076. })
  1077. } else {//和机器人聊天
  1078. data = {
  1079. groups_id: '1',
  1080. robot_name: formatStr,
  1081. robotgroups_id: '1',
  1082. }
  1083. // console.log(this.turnFace(formatStr));
  1084. type = 'toRobot';
  1085. //本地存放数据
  1086. this.robot.push({
  1087. type: 'user',
  1088. content: this.turnFace(formatStr) //obj
  1089. })
  1090. }
  1091. this.socket_send(JSON.stringify({type, data}))
  1092. this.text_info = '';
  1093. this.automaticRolling();
  1094. // console.log(data)
  1095. this.sendAudio();
  1096. // 还原输入框高度
  1097. let area = document.getElementById('textarea')
  1098. area.style.height = 36 + 'px';
  1099. },
  1100. // 消息发送音频
  1101. sendAudio() {
  1102. let send = new Audio();
  1103. send.src = '../../static/audio/send.wav';
  1104. send.play()
  1105. },
  1106. // 消息接收音频
  1107. receiveAudio() {
  1108. let receive = new Audio()
  1109. receive.src = "../../static/audio/receive.wav";
  1110. receive.play();
  1111. },
  1112. /*******************************************/
  1113. //获取转接人工客服列表
  1114. connectionService() {
  1115. // if (!this.isConnection) return
  1116. this.nloding('正在读取客服列表');
  1117. let obj = {
  1118. headers: {
  1119. "apiToken": this.setApiToken('index', 'groups', this.currentTime[0], 'index')
  1120. }
  1121. }
  1122. // this.isConnection = false;
  1123. //api
  1124. this.$http.get('/index/groups/index', obj).then(res => {
  1125. this.closeNloading();
  1126. if (res.data.code == 1) {
  1127. this.robot.push({
  1128. type: 'artificial_service',
  1129. content: res.data.data
  1130. });
  1131. this.automaticRolling();
  1132. }
  1133. })
  1134. //this.hintSwitch.connection = true; //系统提示开关激活
  1135. // 此处为请求
  1136. },
  1137. /*******************************************/
  1138. //发送消息后自动滚动高度
  1139. automaticRolling() {
  1140. this.$nextTick(() => {
  1141. let msg = document.getElementById('main') // 获取对象
  1142. // let input_box = document.getElementById('input_box') // 获取对象
  1143. //判断是否是苹果手机自代浏览器
  1144. if (/iPhone/.test(navigator.userAgent)) {
  1145. this.Safari_height = true; //input_box+'px';
  1146. }
  1147. if (/Linux/.test(navigator.userAgent)) {
  1148. this.Chrome_height = true; //input_box+'px';
  1149. }
  1150. msg.scrollTop = msg.scrollHeight // 滚动高度
  1151. })
  1152. },
  1153. /*******************************************/
  1154. //图片发送
  1155. uploadIMG(e) {
  1156. // console.log(e);
  1157. let self = this;
  1158. let files = e.target.files || e.dataTransfer.files;
  1159. if (!files.length) return;
  1160. let picavalue = files[0];
  1161. const isJPG = file.type == 'image/jpeg' || 'image/jpg' || 'image/png' || 'image/svg';
  1162. const isLt2M = picavalue.size / 1000 / 1000 > 2;
  1163. if (isLt2M) {
  1164. this.$dialog.notify({
  1165. mes: '图片过大不支持上传哦!',
  1166. timeout: 2000,
  1167. });
  1168. } else if (!isJPG) {
  1169. this.$dialog.notify({
  1170. mes: '只能上传图片哦!',
  1171. timeout: 2000,
  1172. });
  1173. } else {
  1174. this.$public.imgPreview(picavalue, function (imgSrc, formData) {
  1175. // let img = imgSrc;
  1176. // 数据结构请求
  1177. self.$http.uploadPost('/index/upload/uploadImg', formData).then(res => {
  1178. e.target.value = "";
  1179. // console.log(res.data.code)
  1180. if (res.data.code == 1) {
  1181. let type = 'toRobot';
  1182. let data = {};
  1183. let obj = {
  1184. text: '',
  1185. img: res.data.data.src,
  1186. type: ''
  1187. }
  1188. if (self.link_success) {
  1189. //和人工聊天发送图片
  1190. data = {
  1191. from_name: self.user_info.name,
  1192. content: JSON.stringify(obj),
  1193. from_id: self.user_info.id,
  1194. avatar: '',
  1195. to_id: self.service_info.id,
  1196. to_name: self.service_info.name,
  1197. conversationId: self.conversationId,
  1198. }
  1199. type = 'chatMessage';
  1200. self.chatIndex = self.chat.length;
  1201. //本地储存
  1202. self.chat.push({
  1203. type: 'user',
  1204. time:"",
  1205. content: {img: res.data.data.src}
  1206. });
  1207. } else {
  1208. //和机器发送图片
  1209. data = {
  1210. groups_id: '1',
  1211. robot_name: res.data.data.src,
  1212. robotgroups_id: '1',
  1213. }
  1214. type = 'toRobot';
  1215. //本地储存
  1216. self.robot.push({
  1217. type: 'user',
  1218. content: {img: res.data.data.src}
  1219. });
  1220. }
  1221. self.socket_send(JSON.stringify({type, data}))
  1222. self.automaticRolling();
  1223. }
  1224. })
  1225. });
  1226. }
  1227. },
  1228. /**监听滚动事件,使消息能完全看见 */
  1229. scrollMain() {
  1230. let main = document.getElementById('main')
  1231. let footer = document.getElementById('input_box')
  1232. main.style.bottom = 0;
  1233. main.style.paddingBottom = (footer.offsetHeight - 30) + 'px'
  1234. },
  1235. /** 监听输入框滚动高度,并给textarea高度赋值*/
  1236. keyup_maxlength(){
  1237. let area = document.getElementById('textarea')
  1238. this.areaHeight = area.scrollHeight > 36 ? area.scrollHeight : 36;
  1239. let main = document.getElementById('main')
  1240. this.makeExpandingArea(area)
  1241. //console.log('screen:', window.screen.height, 'inner:', window.innerHeight)
  1242. // main.style.bottom = this.needScrollTop + 'px'
  1243. // console.log('foucus', this.needScrollTop)
  1244. // this.automaticRolling();
  1245. },
  1246. focus_maxlength() {
  1247. this.automaticRolling();
  1248. },
  1249. /** 兼容处理 */
  1250. makeExpandingArea(el) {
  1251. var timer = null;
  1252. //由于ie8有溢出堆栈问题,故调整了这里
  1253. var setStyle = function(el, auto) {
  1254. if (auto) el.style.height = 'auto';
  1255. el.style.height = el.scrollHeight + 'px';
  1256. }
  1257. var delayedResize = function(el) {
  1258. if (timer) {
  1259. clearTimeout(timer);
  1260. timer = null;
  1261. }
  1262. timer = setTimeout(function() {
  1263. setStyle(el)
  1264. }, 200);
  1265. }
  1266. if (el.addEventListener) {
  1267. el.addEventListener('input', function() {
  1268. setStyle(el, 1);
  1269. }, false);
  1270. setStyle(el)
  1271. } else if (el.attachEvent) {
  1272. el.attachEvent('onpropertychange', function() {
  1273. setStyle(el)
  1274. })
  1275. setStyle(el)
  1276. }
  1277. if (window.VBArray && window.addEventListener) { //IE9
  1278. el.attachEvent("onkeydown", function() {
  1279. var key = window.event.keyCode;
  1280. if (key == 8 || key == 46) delayedResize(el);
  1281. });
  1282. el.attachEvent("oncut", function() {
  1283. delayedResize(el);
  1284. }); //处理粘贴
  1285. }
  1286. },
  1287. /*******************************************/
  1288. //手机弹窗处理
  1289. inputShow(e) {
  1290. //console.log('a')
  1291. let ua = navigator.userAgent.toLowerCase();
  1292. if (ua.match(/iPhone\sOS/i) == "iphone os") {
  1293. var nowClientHeight = document.documentElement.clientHeight || document.body.clientHeight;
  1294. setTimeout(() => {
  1295. document.body.scrollTop = document.body.scrollHeight - (nowClientHeight / 2)
  1296. }, 200);
  1297. } else {
  1298. setTimeout(function () {
  1299. e.target.scrollIntoView({behavior: "smooth", block: "end"});
  1300. }, 100);
  1301. }
  1302. },
  1303. /******************文字信息转表情******************/
  1304. turnFace(data) {
  1305. let str = data.match(/\#\[.*?\]\//g);
  1306. let arr = Array.from(new Set(str));
  1307. arr.forEach(e => {
  1308. let imgsrc = '';
  1309. for (let i = 0; i < this.frceArr.length; i++) {
  1310. let expText = e.slice(1, e.length - 1);
  1311. if (expText == this.frceArr[i]) {
  1312. imgsrc = '<img class="hover" src="' + require(`@/assets/${i}.gif`) + '"/>'
  1313. break;
  1314. }
  1315. }
  1316. data = data.replace(new RegExp(`\\#\\[${e.substring(2, e.length - 2)}\\]\\/`, 'g'), imgsrc);
  1317. })
  1318. return data;
  1319. },
  1320. /*******************************************/
  1321. // 表情包开关
  1322. faceClick() {
  1323. this.meme = !this.meme;
  1324. },
  1325. /*******************************************/
  1326. //当表情被点击
  1327. memeImg(i) {
  1328. this.text_info = this.text_info + "#" + this.frceArr[i] + "/";
  1329. //this.text_info = this.text_info + '<img :src="' + require(`@/assets/${i}.gif`) +'"/>';
  1330. // console.log( this.text_info);
  1331. },
  1332. // /*******************************************/
  1333. // //验证码
  1334. // initialLoginCode() {
  1335. // this.loginCode = "";
  1336. // for (let i = 1; i <= 4; i++) {
  1337. // this.loginCode =
  1338. // this.loginCode + frce.arr[Math.floor(Math.random() * 32)];
  1339. // }
  1340. // },
  1341. /********************************************/
  1342. //显示隐藏评价
  1343. is_show_evaluate() {
  1344. if(localStorage.getItem('comtSuccess')){
  1345. this.$dialog.notify({
  1346. mes: '亲,您已经评价了...',
  1347. timeout: 3000,
  1348. });
  1349. return false;
  1350. }
  1351. if (this.evaluateState == 100) {
  1352. this.bottomShow = true;
  1353. } else {
  1354. if (!this.haveEvaluation) {
  1355. this.bottomShow = false;
  1356. } else {
  1357. this.$dialog.notify({
  1358. mes: '亲,您已经评价了...',
  1359. timeout: 5000,
  1360. callback: () => {
  1361. //console.log('我走咯!');
  1362. }
  1363. });
  1364. }
  1365. }
  1366. },
  1367. /*******************************************/
  1368. //切换评价状态
  1369. evaluateClick(type) {
  1370. // console.log(type);
  1371. this.evaluateState = type;
  1372. },
  1373. /*******************************************/
  1374. //提交评价信息
  1375. evaluateEsc() {
  1376. if (this.evaluateState != 100) {
  1377. this.bottomShow = false;
  1378. this.haveEvaluation = true; // 标识已评价
  1379. this.socket_send(JSON.stringify({
  1380. type: 'evaluate', data: {
  1381. evaluate_id: this.evaluateState,
  1382. conversationId: this.conversationId,
  1383. // evaluate_content:''
  1384. }
  1385. }))
  1386. let that = this
  1387. this.$dialog.notify({
  1388. mes: '感谢你的评价!',
  1389. timeout: 2000,
  1390. callback: () => {
  1391. //console.log('我走咯!');
  1392. }
  1393. });
  1394. } else {
  1395. this.$dialog.notify({
  1396. mes: '亲,请选择评价类型...',
  1397. timeout: 2000,
  1398. callback: () => {
  1399. //console.log('我走咯!');
  1400. }
  1401. });
  1402. }
  1403. },
  1404. /************************************************/
  1405. //人工聊天初始化
  1406. setInit() {
  1407. this.haveEvaluation = false;
  1408. this.chat = [];
  1409. this.evaluateState = 100;
  1410. this.hisSviceChat = [];
  1411. this.meme = false
  1412. // this.frceArr = [];//表情包代码
  1413. this.isConnection = true;
  1414. this.isExit = false;
  1415. this.service_info = {
  1416. avatar: '/static/customer/images/robot.png',
  1417. job_name: '001',
  1418. name: '智能客服',
  1419. signature: " "
  1420. }
  1421. },
  1422. /* ****************获取聊天次数****************** */
  1423. getChatNum() {
  1424. this.$http.get('/index/evaluate/minRound', {
  1425. headers: {
  1426. 'Content-Type': 'application/x-www-form-urlencoded',
  1427. 'apiToken': this.setApiToken('minround', 'evaluate', this.currentTime[0], 'index')
  1428. }
  1429. }).then(res => {
  1430. if (res.data.code == 1) {
  1431. this.chatNum = res.data.data.systemconfig_data;
  1432. // console.log(this.chatNum, '聊天限制')
  1433. }
  1434. })
  1435. },
  1436. // 留言知识库返回到主页
  1437. returnIndex(data) {
  1438. console.log(data)
  1439. this.knowledge = data
  1440. }
  1441. },
  1442. /**
  1443. * 视图挂载前
  1444. */
  1445. mounted() {
  1446. this.source.appuid = this.$public.getQueryString('appuid');//用户标识
  1447. this.source.appid = this.$public.getQueryString('appid');//用户来源
  1448. this.frceArr = frce.frce;
  1449. //console.log(this.source);
  1450. //页面初始化获取系统时间第一步
  1451. //console.log(this.$md5('userwordscustomer-servicewords1562169600service'));
  1452. this.$dialog.loading.open('网络连接中...');
  1453. this.$http.get('/index/index/systime?t=' + 100).then(res => {
  1454. if (res.data.code == 1) {
  1455. this.logo = res.data.data.logo;
  1456. this.currentTime = res.data.data.time.split(' ')
  1457. this.currentTime[0] = (new Date(this.currentTime[0].replace(/-/g, '/')).getTime()) / 1000;
  1458. // console.log( this.currentTime[0] );
  1459. this.apiToken = this.$md5('customer-service' + window.location.origin);
  1460. //匿名注册
  1461. this.registered();
  1462. //获取机器人热门问题
  1463. this.getProblem();
  1464. //获取配置信息
  1465. this.getChatNum();
  1466. }
  1467. })
  1468. },
  1469. destroyed() {
  1470. this.setInit();
  1471. this.websock.close() //离开路由之后断开websocket连接
  1472. this.lockReconnect = true;
  1473. clearTimeout(this.reconnectData); //离开清除 timeout
  1474. clearTimeout(this.timeoutObj); //离开清除 timeout
  1475. clearTimeout(this.serverTimeoutObj); //离开清除 timeout
  1476. },
  1477. // 计算
  1478. computed: {
  1479. inputmsg() {
  1480. return this.text_info;
  1481. },
  1482. iboxheight(){
  1483. return this.ibox_height;
  1484. },
  1485. // 需要额外滚动的高度,大小为键盘高度加上输入框的高度
  1486. needScrollTop: function () {
  1487. if(this.innerHeight > 0) {
  1488. // return (this.innerHeight > window.innerHeight ? this.innerHeight : innerHeight )
  1489. // - window.innerHeight + this.areaHeight -36
  1490. return window.screen.height - window.innerHeight + this.areaHeight -36
  1491. } else {
  1492. return 0;
  1493. }
  1494. },
  1495. },
  1496. // 监听
  1497. watch: {},
  1498. // 组件生命周期结束销毁阶段
  1499. beforeDestroy() {
  1500. this.timers = false;
  1501. }
  1502. };
  1503. </script>
  1504. <style scoped>
  1505. #textarea {
  1506. flex: 1;
  1507. height: 36px;
  1508. margin: 15px;
  1509. border: none;
  1510. }
  1511. .logo {
  1512. margin: 0 0.1rem;
  1513. width: 0.4rem;
  1514. height: 0.4rem;
  1515. }
  1516. /* 聊天 */
  1517. .memeImg {
  1518. width: 0.6rem;
  1519. height: 0.6rem;
  1520. margin: 0.15rem 0.4rem;
  1521. }
  1522. .dialogueA {
  1523. padding-left: 0.3rem;
  1524. padding-right: 0.3rem;
  1525. }
  1526. .dialogueB {
  1527. padding-right: 0.3rem;
  1528. padding-left: 0.3rem;
  1529. }
  1530. .left {
  1531. position: relative;
  1532. z-index: 99;
  1533. background: #fff;
  1534. }
  1535. .left::after {
  1536. position: absolute;
  1537. content: "";
  1538. display: inline-block;
  1539. left: -0.08rem;
  1540. top: 0.2rem;
  1541. width: 0.125rem;
  1542. height: 0.2rem;
  1543. background: #fff;
  1544. transform: skewX(30deg);
  1545. z-index: -1;
  1546. border-left: 0.02rem solid #dfdfdf;
  1547. border-top: 0.02rem solid #dfdfdf;
  1548. }
  1549. .right {
  1550. position: relative;
  1551. z-index: 99;
  1552. background: #5ea0f7;
  1553. border: 0.02rem solid #5ea0f7;
  1554. }
  1555. .right::after {
  1556. position: absolute;
  1557. content: "";
  1558. display: inline-block;
  1559. right: -0.07rem;
  1560. top: 0.2rem;
  1561. width: 0.125rem;
  1562. height: 0.2rem;
  1563. background: #5ea0f7;
  1564. transform: skewX(-30deg);
  1565. z-index: -1;
  1566. border-left: 0.02rem solid #5ea0f7;
  1567. border-top: 0.02rem solid #5ea0f7;
  1568. }
  1569. .service {
  1570. width: 100%;
  1571. color: #555;
  1572. font-size: 0.28rem;
  1573. padding-top: 1rem;
  1574. background: #f5f5f5;
  1575. }
  1576. .header {
  1577. position: fixed;
  1578. left: 0;
  1579. top: 0;
  1580. width: 100%;
  1581. z-index: 999;
  1582. height: 1rem;
  1583. background: linear-gradient(
  1584. 90deg,
  1585. rgba(22, 84, 209, 1) 0%,
  1586. rgba(9, 52, 173, 1) 100%
  1587. );
  1588. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1589. font-size: 0.34rem;
  1590. color: #fff;
  1591. padding: 0 0.3rem;
  1592. }
  1593. .main {
  1594. position: relative;
  1595. box-sizing: border-box;
  1596. height: 83vh;
  1597. overflow-x: hidden;
  1598. overflow-y: auto;
  1599. padding:0.4rem 0.3rem;
  1600. padding-top:0;
  1601. }
  1602. .btn {
  1603. display: inline-block;
  1604. padding: 0 0.36rem;
  1605. text-align: center;
  1606. line-height: 0.4rem;
  1607. background: rgba(221, 221, 221, 1);
  1608. border-radius: 0.3rem;
  1609. color: #fff;
  1610. font-size: 0.24rem;
  1611. max-width: 6rem;
  1612. margin: 0 auto;
  1613. margin-top: 0.3rem;
  1614. }
  1615. .btn .click {
  1616. color: #5ea0f7;
  1617. }
  1618. .btnRouter {
  1619. color: #5ea0f7;
  1620. }
  1621. .systemDialogue {
  1622. min-height: 0.8rem;
  1623. width: 100%;
  1624. }
  1625. .manUserDialogue {
  1626. min-height: 1rem;
  1627. }
  1628. .manPlatformDialogue {
  1629. min-height: 1rem;
  1630. }
  1631. .user {
  1632. padding: 0.2rem;
  1633. display: inline-block;
  1634. border-radius: 0.1rem;
  1635. font-size: 0.28rem;
  1636. color: #fff;
  1637. max-width: 19.1rem;
  1638. table-layout:fixed;
  1639. word-break: break-all;
  1640. text-align: left;
  1641. }
  1642. .HeadPortrait {
  1643. width: 1rem;
  1644. height: 1rem;
  1645. /* background: #ddd; */
  1646. border-radius: 0.1rem;
  1647. }
  1648. .HeadPortrait img {
  1649. width: 100%;
  1650. height: 100%;
  1651. }
  1652. .icon {
  1653. width: 0.32rem;
  1654. height: 0.32rem;
  1655. }
  1656. .icon-msg {
  1657. margin-top: 0.06rem;
  1658. margin-left: 0.2rem;
  1659. width: 0.32rem;
  1660. height: 0.32rem;
  1661. }
  1662. .customerService {
  1663. background: #ffffff;
  1664. padding: 0.2rem;
  1665. display: inline-block;
  1666. border-radius: 0.1rem;
  1667. font-size: 0.28rem;
  1668. border: 1px solid rgba(223, 223, 223, 1);
  1669. }
  1670. .customerService {
  1671. /* min-height: 1rem; */
  1672. }
  1673. .system {
  1674. width: 100%;
  1675. border: 0.01rem solid rgba(223, 223, 223, 1);
  1676. border-radius: 0.1rem;
  1677. }
  1678. div /deep/ .yd-accordion-head {
  1679. /* border-radius: 0.1rem; */
  1680. border-bottom: 0.01rem solid rgb(238, 238, 238);
  1681. padding: 0 0.2rem;
  1682. }
  1683. div /deep/ .yd-accordion-title, div /deep/ .yd-accordion-head-arrow {
  1684. min-height: 0.8rem !important;
  1685. }
  1686. div /deep/ .yd-textarea textarea {
  1687. -webkit-user-select: auto;
  1688. }
  1689. .footer {
  1690. display: flex;
  1691. min-height: 1.2rem;
  1692. box-shadow: 0px -5px 5px rgba(0, 0, 0, 0.05);
  1693. background: #fff;
  1694. width: 100%;
  1695. position: fixed;
  1696. bottom: 0;
  1697. left: 0;
  1698. z-index: 1000;
  1699. }
  1700. .input {
  1701. width: 60%;
  1702. min-height: 1.2rem;
  1703. padding-top: 0.4rem;
  1704. padding-bottom: 0.4rem;
  1705. border: none;
  1706. padding-right: 0.3rem;
  1707. padding-left: 0.3rem;
  1708. font-size: 0.28rem;
  1709. }
  1710. .send {
  1711. flex: 0 0 130px;
  1712. margin-right: 10px;
  1713. text-align: right;
  1714. /* position: absolute;
  1715. right: 0;
  1716. top: 0; */
  1717. background: #fff;
  1718. height: 1.2rem;
  1719. }
  1720. .memeBox {
  1721. height: 3rem;
  1722. width: 100%;
  1723. }
  1724. .send img {
  1725. vertical-align: middle;
  1726. margin-right: 0.4rem;
  1727. }
  1728. .artificial {
  1729. margin: 0.3rem 0 0 1.3rem;
  1730. width: 77%;
  1731. border: 0.01rem solid #dfdfdf;
  1732. background: #fff;
  1733. border-radius: 0.1rem;
  1734. padding: 0 0.2rem;
  1735. }
  1736. div /deep/ .yd-accordion-head-arrow:after {
  1737. border: none;
  1738. width: 0.3rem;
  1739. height: 0.3rem;
  1740. background: url("../assets/addright.png") no-repeat;
  1741. background-size: 100% 100%;
  1742. transform: rotate(0deg);
  1743. }
  1744. div /deep/ .yd-accordion-head-arrow.yd-accordion-rotated:after {
  1745. transform: rotate(-270deg);
  1746. }
  1747. div /deep/ .yd-accordion {
  1748. border-radius: 0.1rem;
  1749. }
  1750. div /deep/ .yd-accordion-content {
  1751. border-radius: 0.1rem;
  1752. }
  1753. .imgSrc img {
  1754. width: 1.2rem;
  1755. }
  1756. .leftHader {
  1757. height: 1rem;
  1758. background: linear-gradient(
  1759. 90deg,
  1760. rgba(22, 84, 209, 1) 0%,
  1761. rgba(9, 52, 173, 1) 100%
  1762. );
  1763. box-shadow: 0 0.03rem 0.03rem rgba(0, 0, 0, 0.2);
  1764. padding: 0 0.3rem;
  1765. }
  1766. .leftMain-top {
  1767. margin-top: 0.4rem;
  1768. font-size: 0.28rem;
  1769. line-height: 0.45rem;
  1770. padding: 0 0.3rem;
  1771. color: #666;
  1772. }
  1773. .leftMain-top span {
  1774. color: #999;
  1775. }
  1776. .leftMain-top > div {
  1777. width: 50%;
  1778. }
  1779. .leftMain-center {
  1780. margin-top: 0.3rem;
  1781. color: #666;
  1782. line-height: 0.5rem;
  1783. }
  1784. .leftMain-chenter span {
  1785. color: #999;
  1786. font-size: 0.28rem;
  1787. }
  1788. .evaluate {
  1789. height: 1.7rem;
  1790. background: #fff;
  1791. border: 0.01rem solid #ddd;
  1792. border-radius: 0.1rem;
  1793. color: #666;
  1794. margin-top: 0.3rem;
  1795. }
  1796. .evaluateBtn {
  1797. width: 1.4rem;
  1798. height: 0.6rem;
  1799. border: none;
  1800. background: #f04992;
  1801. color: #fff;
  1802. border-radius: 0.1rem;
  1803. }
  1804. div /deep/ .yd-popup {
  1805. border-radius: 0.2rem 0.2rem 0 0;
  1806. }
  1807. div /deep/ .yd-popup-content {
  1808. }
  1809. .evaluatebtn > div p {
  1810. height: 50%;
  1811. width: 100%;
  1812. text-align: center;
  1813. margin-top: 0.14rem;
  1814. }
  1815. .evaluatebtn > div {
  1816. display: flex;
  1817. align-items: center;
  1818. justify-content: center;
  1819. }
  1820. .evaluateBox {
  1821. margin: 0 0.2rem;
  1822. height: 1.5rem;
  1823. border: 0.01rem solid #ddd;
  1824. border-radius: 0.1rem;
  1825. background: #f5f5f5;
  1826. }
  1827. .evaluateBox textarea {
  1828. width: 100%;
  1829. height: 100%;
  1830. background: #f5f5f5;
  1831. border: none;
  1832. border-radius: 0.1rem;
  1833. padding: 0.2rem;
  1834. color: #999;
  1835. font-size: 0.28rem;
  1836. }
  1837. .sub {
  1838. margin: 0 0.2rem;
  1839. background: linear-gradient(
  1840. 90deg,
  1841. rgba(22, 84, 209, 1) 0%,
  1842. rgba(9, 52, 173, 1) 100%
  1843. );
  1844. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1845. height: 1rem;
  1846. font-size: 0.34rem;
  1847. color: #fff;
  1848. border-radius: 0.1rem;
  1849. margin-top: 0.4rem;
  1850. }
  1851. div /deep/ .yd-popup-content {
  1852. background: #fff;
  1853. border-radius: 0.1rem;
  1854. }
  1855. .loginInput {
  1856. height: 0.8rem;
  1857. border: 0.01rem solid #ddd;
  1858. background: #f5f5f5;
  1859. border-radius: 0.1rem;
  1860. margin-top: 0.5rem;
  1861. padding: 0.2rem;
  1862. font-size: 0.28rem;
  1863. margin: 0.2rem;
  1864. margin-top: 0.5rem;
  1865. width: 94%;
  1866. color: #999;
  1867. }
  1868. /* 留言 */
  1869. .leave-header {
  1870. height: 1rem;
  1871. background: linear-gradient(
  1872. 90deg,
  1873. rgba(22, 84, 209, 1) 0%,
  1874. rgba(9, 52, 173, 1) 100%
  1875. );
  1876. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  1877. color: #fff;
  1878. font-size: 0.34rem;
  1879. padding: 0 0.3rem;
  1880. }
  1881. .leave-main {
  1882. height: 10rem;
  1883. background: #f5f5f5;
  1884. font-size: 0.28rem;
  1885. padding: 0.3rem 0.3rem 0.2rem 0.3rem;
  1886. }
  1887. .leave-main > div {
  1888. height: 1.3rem;
  1889. margin-bottom: 0.2rem;
  1890. }
  1891. .leave-main > div input {
  1892. height: 0.8rem;
  1893. border: 0.01rem solid #ddd;
  1894. border-radius: 0.1rem;
  1895. background: #fff;
  1896. padding: 0.2rem;
  1897. width: 100%;
  1898. margin-top: 0.1rem;
  1899. }
  1900. .leave-main-txt {
  1901. background: #fff;
  1902. padding: 0.2rem;
  1903. border: 0.01rem solid #ddd;
  1904. border-radius: 0.1rem;
  1905. }
  1906. .imgMsg {
  1907. height: 1.5rem;
  1908. padding: 0 0.2rem;
  1909. margin-top: 0.1rem;
  1910. font-size: 0.24rem;
  1911. background: #fff;
  1912. border: 0.01rem solid #ddd;
  1913. border-radius: 0.1rem;
  1914. }
  1915. .yd-cell-box {
  1916. width: 60%;
  1917. min-height: 1.2rem;
  1918. border: none;
  1919. padding-right: 0.3rem;
  1920. padding-left: 0.3rem;
  1921. border-bottom: 0.01rem solid rgb(221, 221, 221);
  1922. }
  1923. div /deep/ .yd-textarea > textarea {
  1924. min-height: 1.2rem;
  1925. font-size: 0.28rem;
  1926. padding-top: 0.2rem;
  1927. }
  1928. .yd-textarea {
  1929. padding: 0;
  1930. }
  1931. .yd-cell-box {
  1932. margin: 0;
  1933. }
  1934. .yd-cell-item {
  1935. padding: 0;
  1936. }
  1937. div /deep/ .yd-cell:after {
  1938. height: 0;
  1939. }
  1940. div /deep/ .yd-textarea-counter {
  1941. display: none;
  1942. }
  1943. .promptBox {
  1944. display: flex;
  1945. justify-content: center;
  1946. height: 26px;
  1947. margin: 10px 0 10px;
  1948. /* line-height: 26px; */
  1949. }
  1950. .promptBoxH {
  1951. display: flex;
  1952. justify-content: center;
  1953. height: 50px;
  1954. margin: 10px 0 10px;
  1955. /* line-height: 26px; */
  1956. }
  1957. .prompt {
  1958. line-height: 25px;
  1959. text-align: center;
  1960. background: #DDDDDD;
  1961. border-radius: 30px;
  1962. width: 140px;
  1963. color: #FFFFFF;
  1964. font-size: 12px;
  1965. }
  1966. .help {
  1967. width: 80%;
  1968. }
  1969. .help .prompt {
  1970. width: 100%;
  1971. }
  1972. .row .rightAlignment {
  1973. text-align: right;
  1974. display: block;
  1975. }
  1976. #main{
  1977. /* margin-bottom: .3rem; */
  1978. }
  1979. /*
  1980. *留言知识库
  1981. */
  1982. </style>