index.vue 55 KB

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