CustomerService1.vue 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269
  1. <template>
  2. <div class="autoBox box">
  3. <div>
  4. <div class="sessionArea">
  5. <!--会话名称-->
  6. <div class="title">
  7. <span style="font-size: 18px;line-height: 49px;">
  8. <!-- {{sessionAreaTitle}}-->
  9. {{$i18n.locale=='zh'?'能联全球':'World of Energy Interconnection'}}
  10. </span>
  11. </div>
  12. <!--会话窗口-->
  13. <div class="session">
  14. <div id="sessionContent" style="width: 100%;height: 100%;position: relative;overflow: auto;">
  15. <!--转人工客服-->
  16. <div style="width: calc(100% - 40px);height: 47px;text-align: right;font-size: 14px;margin-bottom: 6px;
  17. position: absolute;left: 20px;z-index: 100;padding-top: 10px;box-sizing: border-box;"
  18. :style="{top:(sessionContentScrollTop+'px')}">
  19. <span style="border-radius: 3px;padding: 9px 19px;box-sizing: border-box;cursor:pointer;display: inline-block;;
  20. background-color: #2c5589;color: white;line-height: 22px;"
  21. @click="changeService">
  22. <span v-show="serviceStatus=='ROBERT'">
  23. {{i18n('toCustomerService')}}
  24. </span>
  25. <span v-show="serviceStatus=='Artificial'">
  26. {{$i18n.locale=='zh'?'转智能客服':'Switch to intelligent customer service'}}
  27. </span>
  28. </span>
  29. </div>
  30. <!--会话记录-->
  31. <div style="width: calc(100% - 40px);font-size: 12px;position: absolute;top: 0;left: 20px;z-index: 10">
  32. <div v-for="(item,index) in messages"
  33. style="width: 100%;font-size: 14px;line-height: 26px;color: black;margin: 20px 0;">
  34. <!--客服-->
  35. <div v-if="!(item.messageUserType=='USER')">
  36. <!--ROBERT-->
  37. <div v-show="item.messageUserType=='ROBERT'"
  38. style="display: flex;justify-content: flex-start;">
  39. <!--头像-->
  40. <div style="width: 50px;height: 50px">
  41. <div style="width: 38px;height: 38px;margin: 0 6px 6px 6px;">
  42. <img v-if="item.userImage" :src="imageAddPath(item.userImage)" alt=""
  43. style="width: 100%;height: 100%;border-radius: 50%">
  44. <img v-else src="@/assets/logo11.png" alt=""
  45. style="width: 100%;height: 100%;border-radius: 50%">
  46. </div>
  47. </div>
  48. <!--内容-->
  49. <div style="max-width: 650px;margin-left: 5px;">
  50. <!--用户名/客服-->
  51. <div>
  52. <p style="margin: 5px 0;font-size: 16px;">{{item.userName}}</p>
  53. </div>
  54. <!-- 文本 -->
  55. <div style="position: relative">
  56. <div>
  57. <div style="max-width: 650px;padding: 12px 15px 12px 15px;background-color: white;border-radius: 5px;display: inline-block;"
  58. v-show="item.messageContent.messageContentType != 'HTML'">
  59. <!-- +FAQ -->
  60. <p style="margin: 0;">
  61. {{item.messageContent.content}}<!-- 内容 -->
  62. </p>
  63. <div v-show="item.messageContent.messageContentType != 'ML'">
  64. <p v-for="(ele) in item.messageContent.messageContentList"
  65. style="margin: 0;cursor: pointer;"
  66. @click="sessionFAQClick(item,index)">
  67. {{ele.content}}<!-- 内容 -->
  68. </p>
  69. </div>
  70. </div>
  71. <div style="max-width: 650px;padding: 12px 15px 12px 15px;background-color: white;border-radius: 5px;display: inline-block;"
  72. v-show="item.messageContent.messageContentType == 'HTML'"
  73. v-html="item.messageContent.content"></div>
  74. </div>
  75. <!-- 左侧小三角形 ==> -->
  76. <!-- <div style="width:0;position: absolute;top:20px;left:-10px;border: 5px solid transparent;border-right: 5px solid white;"></div>-->
  77. <!-- <== 左侧小三角形 -->
  78. <!-- +快捷入口 -->
  79. <div style="margin-top: 7px;display: inline-block;"
  80. v-show="item.messageContent.messageContentType == 'ML'">
  81. <!--<div v-for="(ele,indexs) in item.messageContent.messageContentList"
  82. style="width: 80px;height: 80px;border-radius: 3px;background-color: white;float: left;margin-left: 6px;cursor: pointer;"
  83. :style="{marginLeft:indexs==0?'0':'6px'}"
  84. @click="sessionQuickClick(ele,indexs)">
  85. <div style="text-align: center;margin-top: 15px;width: 100%;height: 30px;">
  86. <img v-if="ele.imagePath" :src="ele.imagePath" alt="" style="width: 30px;height: 30px;">
  87. <img v-else src="" alt="" style="width: 30px;height: 30px;">
  88. </div>
  89. <div style="text-align: center;">
  90. <span style="font-size: 14px;color: #959595;">{{ele.content}}</span>
  91. </div>
  92. </div>
  93. <div style="clear: both;"></div>-->
  94. <div v-for="(ele,indexs) in item.messageContent.messageContentList"
  95. style="border-radius: 3px;background-color: white;cursor: pointer;margin-top: 6px;"
  96. @click="sessionQuickClick(ele,indexs)">
  97. <div style="text-align: center;width: 80px;height: 100%;float: left;">
  98. <img v-if="ele.imagePath" :src="imageAddPath(ele.imagePath)"
  99. alt=""
  100. style="width: 30px;height: 30px;margin-top: 15px;">
  101. <img v-else :src="imageAddPath('helpCenter/shuji.jpg')"
  102. alt=""
  103. style="width: 30px;height: 30px;margin-top: 15px;">
  104. </div>
  105. <div style="float: left;line-height:30px;padding: 0 25px 0 0;max-width: 80%;margin-top: 14px;">
  106. <span style="font-size: 14px;color: #959595;">{{ele.content}}</span>
  107. </div>
  108. <div style="clear: both;"></div>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <!--人工-->
  115. <div v-show="item.messageUserType=='CUSTOMER'"
  116. style="display: flex;justify-content: flex-start;">
  117. <!--头像-->
  118. <div style="width: 50px;height: 50px">
  119. <div style="width: 38px;height: 38px;margin: 0 6px 6px 6px;">
  120. <img v-if="item.userImage" :src="imageAddPath(item.userImage)" alt=""
  121. style="width: 100%;height: 100%;border-radius: 50%">
  122. <img v-else src="@/assets/logo11.png" alt=""
  123. style="width: 100%;height: 100%;border-radius: 50%">
  124. </div>
  125. </div>
  126. <!--内容-->
  127. <div style="max-width: 650px;margin-left: 5px;">
  128. <!--用户名/客服-->
  129. <div>
  130. <p style="margin: 5px 0;font-size: 16px;">{{item.userName}}</p>
  131. </div>
  132. <!-- 文本 -->
  133. <div style="position: relative">
  134. <div>
  135. <div style="max-width: 650px;padding: 12px 15px 12px 15px;background-color: white;border-radius: 5px;display: inline-block;">
  136. <p style="margin: 0;">
  137. {{item.messageContent.content}}<!-- 内容 -->
  138. </p>
  139. </div>
  140. </div>
  141. <!-- 左侧小三角形 ==> -->
  142. <!-- <div style="width:0;position: absolute;top:20px;left:-10px;border: 5px solid transparent;border-right: 5px solid white;"></div>-->
  143. <!-- <== 左侧小三角形 -->
  144. </div>
  145. </div>
  146. </div>
  147. <!--时间-->
  148. <div style="padding-left: 55px;box-sizing: border-box;">
  149. <p style="margin: 5px 0;color:#999a9c;font-size: 12px">{{item.messageTime}}</p>
  150. </div>
  151. </div>
  152. <!--用户-->
  153. <div v-else style="text-align: right;">
  154. <div style="display: inline-block;">
  155. <div style="display: flex;justify-content: flex-end;">
  156. <!--内容-->
  157. <div style="max-width: 650px;margin-right: 5px;">
  158. <!--用户名/用户-->
  159. <div>
  160. <p style="margin: 5px 0;">{{item.userName}}</p>
  161. </div>
  162. <!-- 文本 -->
  163. <div style="position: relative;">
  164. <div>
  165. <div style="max-width: 650px;padding: 12px 15px 12px 15px;background-color: white;border-radius: 5px;display: inline-block;">
  166. <p style="margin: 0;text-align: left;">
  167. {{item.messageContent.content}}<!-- 内容 -->
  168. </p>
  169. </div>
  170. </div>
  171. <!-- 左侧小三角形 ==> -->
  172. <!-- <div style="width:0;position: absolute;top:20px;right:-5px;border: 5px solid transparent;border-left: 5px solid white;"></div>-->
  173. <!-- <== 左侧小三角形 -->
  174. </div>
  175. </div>
  176. <!--头像-->
  177. <div style="width: 50px;height: 50px">
  178. <div style="width: 38px;height: 38px;margin: 0 6px 6px 6px;">
  179. <img v-if="item.userImage" :src="imageAddPath(item.userImage)"
  180. alt=""
  181. style="width: 100%;height: 100%;border-radius: 50%">
  182. <img v-else src="@/assets/img/helpCenter/headPortrait.png" alt=""
  183. style="width: 100%;height: 100%;border-radius: 50%">
  184. </div>
  185. </div>
  186. </div>
  187. <!--时间-->
  188. <div style="padding-right: 55px;box-sizing: border-box;">
  189. <p style="margin: 5px 0;color:#999a9c;font-size: 12px">
  190. {{item.messageTime}}</p>
  191. </div>
  192. </div>
  193. </div>
  194. </div>
  195. </div>
  196. </div>
  197. </div>
  198. <!--类别-->
  199. <div class="classes">
  200. <div v-for="(item,index) in sessionAreaClasses"
  201. style="height: 100%;margin-left: 6px;float: left;margin-top: 11px;">
  202. <span style="padding: 0 12px;font-size: 14px;line-height: 25px;border: 1px solid #285185;border-radius: 25px;color: #999999;cursor: pointer;"
  203. :style="{backgroundColor:sessionAreaClassesFlag.value==item.value?'#71a7ef':'transparent',
  204. color:sessionAreaClassesFlag.value==item.value?'white':'#999999',
  205. border:sessionAreaClassesFlag.value==item.value?'1px solid transparent':'1px solid #285185'}"
  206. @click="filtrateClasses(item,index)">
  207. <!-- {{i18n(item.label)}}-->
  208. {{item.value}}
  209. </span>
  210. </div>
  211. <div style="clear: both;"></div>
  212. </div>
  213. <!--输入区域-->
  214. <div class="inputText">
  215. <!--表情/图片-->
  216. <!--<div style="height: 32px;width: 100%;padding-top: 6px;box-sizing: border-box;">
  217. <div v-for="(item,index) in sessionAreaFunction"
  218. style="width: 20px;height: 20px;display: inline-block;margin-left: 6px;cursor: pointer;">
  219. <emoji v-if="item.value=='表情'" style="float:left;">
  220. <div slot="icon" style="float:left;">
  221. <i v-if="item.iconName" :class="item.iconName" style="font-size: 20px;color: #5b5f68;"
  222. @click="sendkind(item,index)"></i>
  223. <img v-else :src="item.iconImg" alt="" @click="sendkind(item,index)">
  224. </div>
  225. </emoji>
  226. <div v-else-if="item.value=='图片'" style="float:left;">
  227. <i v-if="item.iconName" :class="item.iconName" style="font-size: 20px;color: #5b5f68;"
  228. @click="sendkind(item,index)"></i>
  229. <img v-else :src="item.iconImg" alt="" @click="sendkind(item,index)">
  230. </div>
  231. </div>
  232. </div>-->
  233. <!--<div style="height: 32px;width: 100%;padding-top: 6px;box-sizing: border-box;">
  234. <div v-for="(item,index) in sessionAreaFunction"
  235. style="width: 20px;height: 20px;display: inline-block;margin-left: 6px;cursor: pointer;">
  236. <emoji v-if="item.value=='表情'" style="float:left;" class="items" ref="qqemoji" @select="qqemoji_selectFace">
  237. <div slot="icon" style="float:left;">
  238. <i v-if="item.iconName" :class="item.iconName"
  239. style="font-size: 20px;color: #5b5f68;"
  240. @click="sendkind(item,index)"></i>
  241. <img v-else :src="item.iconImg" alt="" @click="sendkind(item,index)">
  242. </div>
  243. </emoji>
  244. <div v-else-if="item.value=='图片'" style="float:left;">
  245. <i v-if="item.iconName" :class="item.iconName" style="font-size: 20px;color: #5b5f68;"
  246. @click="sendkind(item,index)"></i>
  247. <img v-else :src="item.iconImg" alt="" @click="sendkind(item,index)">
  248. </div>
  249. </div>
  250. </div>-->
  251. <!--输入内容-->
  252. <div style="height: 103px;width: 100%;padding-bottom: 6px;box-sizing: border-box;overflow: hidden;">
  253. <el-input
  254. type="textarea"
  255. :rows="4"
  256. resize="none"
  257. :placeholder="$i18n.locale=='zh'?'请输入内容':'Please enter content'"
  258. v-model="senderMessage"
  259. maxlength="50"
  260. show-word-limit
  261. @keyup.alt="onStop(1)"
  262. @keydown.alt="onStop(11)"
  263. @keyup.alt.enter.native="onStop(3)"
  264. @keydown.alt.enter.native="onStop(33)"
  265. @keyup.ctrl.enter.native="onStop(4)"
  266. @keydown.ctrl.enter.native="onStop(44)"
  267. @keyup.enter.native="toSend(senderMessage)">
  268. </el-input>
  269. <!--<div
  270. maxlength="500"
  271. class="inputContent common_chat_emoji-wrapper-global"
  272. id="common_chat_input"
  273. contenteditable="true"
  274. @paste.stop="inputContent_paste"
  275. @drop="inputContent_drop"
  276. @keydown="inputContent_keydown"
  277. @mouseup="inputContent_mouseup"
  278. ></div>-->
  279. </div>
  280. <!--发送-->
  281. <div style="height: 32px;width: 100%;text-align: right;">
  282. <button v-if="senderMessage" type="button" style="width: 87px; height: 32px;border-radius: 4px;color: white;cursor:pointer;
  283. font-size: 16px;line-height: 30px;text-align: center;border: none;background-color: #2c5589;outline:none;"
  284. @click="toSend(senderMessage)">
  285. {{i18n('Send')}}
  286. </button>
  287. <button v-else type="button" style="width: 87px; height: 32px;border-radius: 4px;color: white;cursor:not-allowed;
  288. font-size: 16px;line-height: 30px;text-align: center;border: none;background-color: #71a7ef;outline:none;">
  289. {{i18n('Send')}}
  290. </button>
  291. </div>
  292. </div>
  293. </div>
  294. <div class="functionalArea">
  295. <!--常见问题-->
  296. <div class="content">
  297. <!--标题-->
  298. <div style="width: 100%;height: 50px;border-bottom: 1px solid #e1e1e3;padding:0 15px;box-sizing: border-box;">
  299. <span style="float:left;;font-size: 18px;line-height: 50px; color: #1d202f;">
  300. {{$i18n.locale=='zh'?'常见问题':'FAQ'}}
  301. </span>
  302. <span style="float: right;font-size: 16px;line-height: 50px; color: #365282;cursor: pointer;"
  303. @click="changeTheBatch()">
  304. {{i18n('ChangeTheBatch')}}
  305. </span>
  306. <div style="clear: both;"></div>
  307. </div>
  308. <!--正文-->
  309. <div style="width: 100%;padding: 6px 20px 6px 36px;box-sizing: border-box">
  310. <ul v-for="(item,index) in FAQ">
  311. <li style="font-size: 14px;line-height: 26px; color: #365282;" @click="toFAQ(item,index)">
  312. <span style="cursor: pointer;">{{item.label}}</span>
  313. </li>
  314. </ul>
  315. <div style="clear: both;"></div>
  316. </div>
  317. </div>
  318. <!--平台服务-->
  319. <div class="content">
  320. <!--标题-->
  321. <div style="width: 100%;height: 50px;border-bottom: 1px solid #e1e1e3;padding:0 15px;box-sizing: border-box;">
  322. <span style="float:left;;font-size: 18px;line-height: 50px; color: #1d202f;">
  323. {{$i18n.locale=='zh'?'平台服务':'Platform services'}}
  324. </span>
  325. <div style="clear: both;"></div>
  326. </div>
  327. <!--正文-->
  328. <div style="width: 100%;padding: 0 15px 5px 15px;box-sizing: border-box;">
  329. <div v-for="(item,index) in services"
  330. style="float: left;width: 25%; height: 92px;">
  331. <div style="width: 100%;height: 33px;text-align: center;margin-top: 14px">
  332. <img :src="item.icon" alt="" style="width: 33px;height: 33px;cursor: pointer;"
  333. @click="toServices(item,index)">
  334. </div>
  335. <div style="width: 100%;height: 33px;text-align: center;margin-top: 8px;">
  336. <span style="font-size: 12px;cursor: pointer;" @click="toServices(item,index)">
  337. <!-- {{i18n(item.label)}}-->
  338. {{item.label}}
  339. </span>
  340. </div>
  341. </div>
  342. <div style="clear: both;"></div>
  343. </div>
  344. </div>
  345. <!--快捷入口-->
  346. <div class="content">
  347. <!--标题-->
  348. <div style="width: 100%;height: 50px;border-bottom: 1px solid #e1e1e3;padding:0 15px;box-sizing: border-box;">
  349. <span style="float:left;;font-size: 18px;line-height: 50px; color: #1d202f;">
  350. {{$i18n.locale=='zh'?'快捷入口':'Quick entry'}}
  351. </span>
  352. <div style="clear: both;"></div>
  353. </div>
  354. <!--正文-->
  355. <div style="width: 100%;box-sizing: border-box;">
  356. <div v-for="(item,index) in quick"
  357. style="float: left;width: 155px; height: 66px;margin: 15px 0 0 15px;background-size:100% 100%;padding-left: 14px;box-sizing: border-box;cursor: pointer;
  358. display: flex;align-items:center;"
  359. :style="{backgroundImage:'url('+ item.backImg +')'}"
  360. @click="toQuick(item,index)">
  361. <span style="display: inline-block;width:100%;float:left;;font-size: 14px;color: #1d202f;">
  362. <!-- {{i18n(item.label)}}-->
  363. {{item.label}}
  364. </span>
  365. </div>
  366. <div style="clear: both;"></div>
  367. </div>
  368. </div>
  369. </div>
  370. <div style="clear: both;"></div>
  371. </div>
  372. <!--登录提示-->
  373. <el-dialog
  374. :title="$i18n.locale=='zh'?'提示':'Reminder'"
  375. :visible.sync="toViewLogin"
  376. :width="$i18n.locale=='zh'?'500px':'750px'"
  377. :height="$i18n.locale=='zh'?'300px':'386px'"
  378. :before-close="toViewLoginChange"
  379. >
  380. <div style="width: 100%;height: 100%;">
  381. <img src="@/assets/img/loginTips.png" alt="" style="width: 180px;height: 180px;margin-left: 20px;">
  382. <div style="float: right;margin-right: 20px;" :style="$i18n.locale=='zh'?'width: 49%;margin-top: 10px;':'width: 453px;margin-top: -25px;'">
  383. <div style="font-size: 20px;font-weight: normal;color: #333333;
  384. font-family: HiraginoSansGB-W3, HiraginoSansGB;
  385. line-height: 40px;">
  386. {{$t('common.ReminderFirst')}}
  387. </div>
  388. <div style="font-size: 16px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  389. font-weight: normal;color: #666666;line-height: 30px;">
  390. {{$t('common.ReminderSecond')}} <span style="color: #0091FF;font-size: 18px;">{{num}}</span> {{$t('common.ReminderThird')}}
  391. </div>
  392. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  393. font-weight: normal;color: #666666;line-height: 30px;">
  394. {{$t('common.ReminderForth')}}
  395. </div>
  396. <div style="font-size: 14px;font-family: HiraginoSansGB-W3, HiraginoSansGB;
  397. height:33px;line-height:60px;font-weight: normal;color: #0091FF;">
  398. <span style="margin-left: 40px;" class="cursor" @click="toViewLocal('login')">
  399. {{$t('common.ReminderFifth')}}
  400. </span>
  401. <span style="margin-left: 10px;" class="cursor" @click="toViewLocal('Register')">
  402. {{$t('common.ReminderSixth')}}
  403. </span>
  404. </div>
  405. </div>
  406. </div>
  407. </el-dialog>
  408. </div>
  409. </template>
  410. <script>
  411. import {getDicts} from "@/api/dict";
  412. import Base from "@/views/base/Base";
  413. import {getToken, resetToken} from "@/utils/auth";
  414. import {robertClientMessages, getOperationListByOperationType} from "@/api/customer/customerServiceRobert"
  415. import {artificialClientMessages} from "@/api/customer/customerServiceStaff"
  416. import {getHelpCenterLanguages} from "@/api/operation/help/helpCenterLanguage"
  417. import {getHelpColumnContent} from '@/api/operation/help/helpCenterEntity'
  418. import emoji from "./emoji.vue";
  419. export default {
  420. extends: Base,
  421. components: {
  422. emoji: emoji
  423. },
  424. data() {
  425. return {
  426. num:5,
  427. timer:'',
  428. toViewLogin:false,
  429. isEnterStop: false,
  430. initWeb: false,
  431. //socket连接
  432. socket: null,
  433. //本地重连状态
  434. lockReconnect: false,
  435. tt: {},
  436. //socket连接地址
  437. socketUrl: '',
  438. artificial: {
  439. userId: '',
  440. userName: '',
  441. userImage: '',
  442. },
  443. user: {
  444. userId: '',
  445. userName: '',
  446. userImage: '',
  447. },
  448. //FAQ分页页码
  449. FAQPageNo: 1,
  450. // 当前客服状态
  451. serviceStatus: 'ROBERT', // ROBERT/Artificial
  452. staffService: 'off-line', // on-line/off-line
  453. //转人工客服(悬浮块)
  454. sessionContentScrollTop: Number,
  455. /*** 会话区数据 ***/
  456. //会话title
  457. sessionAreaTitle: '能联全球',
  458. //类别
  459. sessionAreaClassesFlag: '', //已选择类别
  460. sessionAreaClasses: [
  461. // {
  462. // label: 'MemberApply',
  463. // value: '入会申请',
  464. // },
  465. // {
  466. // label: 'ActivityRegistration',
  467. // value: '活动报名',
  468. // },
  469. // {
  470. // label: 'ForgetPassword',
  471. // value: '忘记密码',
  472. // },
  473. // {
  474. // label: 'AllianceApply',
  475. // value: '入盟申请',
  476. // },
  477. ],
  478. //表情、图片
  479. sessionAreaFunction: [
  480. {
  481. value: '表情',
  482. index: 0,
  483. iconName: 'el-icon-stopwatch',
  484. iconImg: '',
  485. },
  486. {
  487. value: '图片',
  488. index: 1,
  489. iconName: 'el-icon-picture-outline-round',
  490. iconImg: '',
  491. // iconImg:require(''),
  492. },
  493. ],
  494. //输入内容
  495. senderMessage: '',
  496. messageCount: 'FIRST',
  497. sendRequestMessageContent: {
  498. messageContentType: 'STR',
  499. content: "",
  500. language: this.$i18n.locale.toUpperCase(),
  501. },
  502. sendRequestMessage: {
  503. "userId": "0",
  504. "userName": "游客",
  505. "userImage": "helpCenter/logo11.png",
  506. "messageTime": 1223123412341,
  507. "messageType": "USER",
  508. "messageUserType": "USER",
  509. "messageTypeExtend": "",
  510. "language": this.$i18n.locale.toUpperCase(),
  511. "messageContent": "",
  512. },
  513. //心跳检测
  514. heartCheck: {},
  515. messages: [],
  516. /*** 功能区数据 语言包在user_zh/user_en ***/
  517. FAQ: [
  518. // {label: '如何开通平台账号'},
  519. // {label: '自动生成的账号可以修改吗'},
  520. // {label: '如何修改实名认证手机'},
  521. // {label: '如何开通平台账号'},
  522. // {label: '如何开通平台账号'},
  523. // {label: '如何开通平台账号'},
  524. // {label: '如何开通平台账号'},
  525. ],
  526. services: [
  527. // {
  528. // icon:require('@/assets/img/home/discussion3.png'),
  529. // label:'ConferenceService',
  530. // value:'会议服务',
  531. // },
  532. // {
  533. // icon:require('@/assets/img/helpCenter/zuanshi.jpg'),
  534. // label:'vipService',
  535. // value:'会员服务',
  536. // },
  537. // {
  538. // icon:require('@/assets/img/home/finance3.png'),
  539. // label:'FinancialServices',
  540. // value:'金融服务',
  541. // },
  542. // {
  543. // icon:require('@/assets/img/home/share3.png'),
  544. // label:'ResourceSharing',
  545. // value:'资源共享服务',
  546. // },
  547. // {
  548. // icon:require('@/assets/img/home/Exhibition3.png'),
  549. // label:'ExhibitionService',
  550. // value:'会展服务',
  551. // },
  552. ],
  553. quick: [
  554. // {
  555. // backImg:require('@/assets/img/helpCenter/quickBackImg1.jpg'),
  556. // label:'applyMembership1',
  557. // value:'申请入会',
  558. // },
  559. // {
  560. // backImg:require('@/assets/img/helpCenter/quickBackImg2.jpg'),
  561. // label:'applyMembership2',
  562. // value:'申请入盟',
  563. // },
  564. // {
  565. // backImg:require('@/assets/img/helpCenter/quickBackImg3.jpg'),
  566. // label:'Donation',
  567. // value:'资助洽商',
  568. // },
  569. // {
  570. // backImg:require('@/assets/img/helpCenter/quickBackImg4.jpg'),
  571. // label:'applyCustomizedServices',
  572. // value:'申请定制服务',
  573. // },
  574. // {
  575. // backImg:require('@/assets/img/helpCenter/quickBackImg5.png'),
  576. // label:'resourceApplicationResearch',
  577. // value:'申请调研',
  578. // },
  579. ],
  580. }
  581. },
  582. mounted() {
  583. // console.log('mounted')
  584. // this.initWeb = true
  585. // this.enterKeyup();
  586. this.sendRequestMessage.language = this.$i18n.locale.toUpperCase();
  587. this.sendRequestMessageContent.language = this.$i18n.locale.toUpperCase();
  588. // this.initdata();
  589. this.$nextTick(() => {
  590. const el = document.getElementById('sessionContent');
  591. el.onscroll = () => {
  592. let scrollTop = el.scrollTop;
  593. this.sessionContentScrollTop = scrollTop;
  594. };
  595. if (el.scrollHeight > el.clientHeight) {
  596. el.scrollTop = el.scrollHeight;
  597. }
  598. });
  599. // if(this.$i18n.locale.toUpperCase() == 'EN'){
  600. this.messages = [];
  601. this.messageCount = 'FIRST';
  602. this.initdata();
  603. // this.initWeb = false;
  604. // }
  605. },
  606. watch: {
  607. /*'$i18n.locale'(val, oldval) {
  608. console.log('watch')
  609. console.log(val)
  610. if (val == 'zh') {
  611. if (this.mountedEnd == true) {
  612. this.mountedEnd = false;
  613. } else {
  614. // this.slideShowImgFlag=0;
  615. this.sendRequestMessage.language = this.$i18n.locale.toUpperCase();
  616. this.sendRequestMessageContent.language = this.$i18n.locale.toUpperCase();
  617. this.messages = [];
  618. this.messageCount = 'FIRST'
  619. this.initdata();
  620. }
  621. } else {
  622. this.sendRequestMessage.language = this.$i18n.locale.toUpperCase();
  623. this.sendRequestMessageContent.language = this.$i18n.locale.toUpperCase();
  624. this.messages = [];
  625. this.messageCount = 'FIRST'
  626. this.initdata();
  627. }
  628. },*/
  629. '$i18n.locale': {
  630. handler(val, oldval) {
  631. // console.log('$i18n')
  632. this.sendRequestMessage.language = this.$i18n.locale.toUpperCase();
  633. this.sendRequestMessageContent.language = this.$i18n.locale.toUpperCase();
  634. this.messages = [];
  635. this.messageCount = 'FIRST';
  636. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  637. this.user.userName = '游客';
  638. this.sendRequestMessage.userName = '游客';
  639. } else {
  640. this.user.userName = 'Tourist';
  641. this.sendRequestMessage.userName = 'Tourist';
  642. }
  643. this.initdata();
  644. },
  645. },
  646. 'messages.length'() {
  647. this.$nextTick(() => {
  648. const el = document.getElementById('sessionContent');
  649. if (el.scrollHeight > el.clientHeight) {
  650. el.scrollTop = el.scrollHeight;
  651. }
  652. })
  653. },
  654. "toViewLogin"(){
  655. if(this.toViewLogin==true){
  656. this.loginTipsChange();
  657. }
  658. }
  659. },
  660. methods: {
  661. //拦截alt+enter\ctrl+enter事件
  662. onStop(ele) {
  663. console.log(ele)
  664. this.senderMessage = ''
  665. this.isEnterStop = true;
  666. },
  667. //连接地址补全
  668. linkAddPath(path) {
  669. var str = new RegExp("http");
  670. const origin = document.location.origin
  671. if (!str.test(path)) {
  672. return origin + "/#/" + path;
  673. } else {
  674. return path
  675. }
  676. },
  677. //图片地址补全
  678. imageAddPath(path) {
  679. const origin = document.location.origin
  680. // console.log(origin + "/common/opt/file/pub/" + path)
  681. return origin + "/api/file/pub/" + path;
  682. },
  683. //通用跳转方法
  684. toView(href) {
  685. window.open(href, '_blank');
  686. },
  687. toViewLocal(router, json) {
  688. // let rpath = { name: router, query: {key:JSON.stringify(json)}};
  689. clearInterval(this.timer);
  690. let rpath = { name: 'customerService'};
  691. sessionStorage.setItem('pathReminder', JSON.stringify(rpath));
  692. this.$router.push({ name: router, params: {key:json} });
  693. },
  694. //初始化方法
  695. initdata() {
  696. // this.initWeb = true;
  697. this.checkUser();
  698. //第一次请求
  699. this.toSend("");
  700. //获取常见问题
  701. this.getFAQ();
  702. //获取快捷点击栏
  703. this.getSessionAreaClasses();
  704. //获取平台服务数据
  705. this.getServices();
  706. //获取快捷入口数据
  707. this.getQuicks();
  708. // this.initWeb = false;
  709. },
  710. checkUser() {
  711. let that = this;
  712. let user = window.localStorage.getItem("user");
  713. var users = JSON.parse(user);
  714. if (users != null) {
  715. this.user.userId = users.userId;
  716. this.user.userName = users.username;
  717. this.sendRequestMessage.userId = this.user.userId;
  718. // if(users.umsUser.userNickName){
  719. // this.sendRequestMessage.userName = users.umsUser.userNickName;
  720. // }else{
  721. this.sendRequestMessage.userName = this.user.userName;
  722. // }
  723. if (users.umsUser.userPic) {
  724. this.user.userImage = users.umsUser.userPic;
  725. this.sendRequestMessage.userImage = this.user.userImage;
  726. }
  727. } else if (that.user.userId == '') {
  728. this.user.userId = new Date().getTime();
  729. this.sendRequestMessage.userId = this.user.userId;
  730. if (this.$i18n.locale.toUpperCase() == 'ZH') {
  731. this.user.userName = '游客';
  732. this.sendRequestMessage.userName = '游客';
  733. } else {
  734. this.user.userName = 'Tourist';
  735. this.sendRequestMessage.userName = 'Tourist';
  736. }
  737. this.user.userImage = '';
  738. this.sendRequestMessage.userImage = this.user.userImage;
  739. }
  740. },
  741. //换一页功能
  742. changeTheBatch() {
  743. if (this.FAQPageNo < 3) {
  744. this.FAQPageNo++
  745. } else {
  746. this.FAQPageNo = 1;
  747. }
  748. this.getFAQ(this.FAQPageNo);
  749. },
  750. //获取常见问题
  751. async getFAQ(pageNo) {
  752. let that = this;
  753. let param={
  754. pageSize:5,
  755. pageNo: this.FAQPageNo ? this.FAQPageNo : 1,
  756. businessType:'help_center',
  757. language:'',
  758. approveStatusDict:3,
  759. }
  760. param.language =this.$i18n.locale.toUpperCase();
  761. getHelpColumnContent(param).then((res) =>{
  762. this.FAQ = []
  763. res.data.cmsInformationViews.forEach(item => {
  764. this.FAQ.push({label: item.title, id: item.businessId});
  765. })
  766. if (that.FAQPageNo >= res.data.page.totalPage) {
  767. that.FAQPageNo = 0
  768. }
  769. })
  770. },
  771. //快捷点击栏
  772. async getQuicks() {
  773. let that = this;
  774. var operationType = "QUICKACCESS"
  775. var language = this.$i18n.locale.toUpperCase();
  776. getOperationListByOperationType(operationType, language).then((res) => {
  777. if ('200' == res.status) {
  778. this.quick = [];
  779. res.data.customerOperations.forEach(item => {
  780. this.quick.push({
  781. label: item.modelContent,
  782. value: item.modelContent,
  783. backImg: that.imageAddPath(item.imagePath),
  784. link: that.linkAddPath(item.linkPath),
  785. })
  786. })
  787. }
  788. });
  789. },
  790. //获取服务列表
  791. async getServices() {
  792. let that = this;
  793. var operationType = "PLATFORMSERVICES"
  794. var language = this.$i18n.locale.toUpperCase();
  795. getOperationListByOperationType(operationType, language).then((res) => {
  796. if ('200' == res.status) {
  797. this.services = [];
  798. res.data.customerOperations.forEach(item => {
  799. this.services.push({
  800. label: item.modelContent,
  801. value: item.modelContent,
  802. icon: that.imageAddPath(item.imagePath),
  803. link: that.linkAddPath(item.linkPath),
  804. })
  805. })
  806. }
  807. });
  808. },
  809. //获取类别列表
  810. async getSessionAreaClasses() {
  811. var operationType = "QUICKLIST"
  812. var language = this.$i18n.locale.toUpperCase();
  813. getOperationListByOperationType(operationType, language).then((res) => {
  814. if ('200' == res.status) {
  815. this.sessionAreaClasses = [];
  816. res.data.customerOperations.forEach(item => {
  817. this.sessionAreaClasses.push({
  818. label: item.modelContent,
  819. value: item.modelContent,
  820. link: item.linkPath,
  821. })
  822. })
  823. }
  824. });
  825. },
  826. /*** 会话区事件 ***/
  827. //转人工客服/转智能客服
  828. changeService() {
  829. if (this.serviceStatus == 'ROBERT') {
  830. this.serviceStatus = 'Artificial'
  831. this.openSocket();
  832. } else if (this.serviceStatus == 'Artificial') {
  833. this.serviceStatus = 'ROBERT'
  834. this.socket.close()
  835. this.heartCheck.stop();
  836. }
  837. },
  838. //类别
  839. async filtrateClasses(ele, index) {
  840. this.sessionAreaClassesFlag = ele;
  841. this.toSend(ele.value)
  842. },
  843. //表情、图片
  844. async sendkind(ele, index) {
  845. if (index == 0) {
  846. // 表情事件
  847. console.log(ele)
  848. console.log(index)
  849. }
  850. if (index == 1) {
  851. // 图片事件
  852. console.log(ele)
  853. console.log(index)
  854. }
  855. },
  856. // 发送内容
  857. async toSend(senderMessage) {
  858. if (this.isEnterStop) {
  859. this.isEnterStop = false;
  860. } else {
  861. let that = this;
  862. if (senderMessage) {
  863. if (senderMessage.match(/^\s+$/)) {
  864. return this.senderMessage = '';
  865. }
  866. if (senderMessage.match(/^[ ]+$/)) {
  867. return this.senderMessage = '';
  868. }
  869. if (senderMessage.match(/^[ ]*$/)) {
  870. return this.senderMessage = '';
  871. }
  872. if (senderMessage.match(/^\s*$/)) {
  873. return this.senderMessage = '';
  874. }
  875. }
  876. if (this.serviceStatus == 'ROBERT') {
  877. // this.messageCount= 'CHAT';
  878. this.sendRequestMessageContent.content = senderMessage;
  879. this.sendRequestMessage.messageContent = this.sendRequestMessageContent;
  880. this.sendRequestMessage.messageTime = this.dateFormat("YYYY-mm-dd HH:MM:SS", new Date());
  881. let messageCount = JSON.parse(JSON.stringify(this.messageCount));
  882. if (this.messageCount != 'FIRST') {
  883. let sendRequestMessageget = JSON.parse(JSON.stringify(this.sendRequestMessage));
  884. that.messages.push(sendRequestMessageget)
  885. }
  886. robertClientMessages(messageCount, JSON.stringify(this.sendRequestMessage)).then((res) => {
  887. if (res.status == '200') {
  888. if (messageCount == 'FIRST') {
  889. that.messages = []
  890. }
  891. that.messages.push(res.data.messages)
  892. this.messageCount = 'CHAT'
  893. }
  894. });
  895. } else if (this.serviceStatus == 'Artificial') {
  896. this.sendRequestMessageContent.content = senderMessage;
  897. this.sendRequestMessage.messageContent = this.sendRequestMessageContent;
  898. this.sendRequestMessage.messageTime = this.dateFormat("YYYY-mm-dd HH:MM:SS", new Date());
  899. var message = {
  900. userId: "",
  901. message: "",
  902. messageType: "ARTM",
  903. }
  904. message.message = this.sendRequestMessage
  905. message.userId = this.artificial.userId
  906. this.socket.send(JSON.stringify(message));
  907. let sendRequestMessageget = JSON.parse(JSON.stringify(this.sendRequestMessage));
  908. that.messages.push(sendRequestMessageget)
  909. this.messageCount = 'CHAT'
  910. // artificialClientMessages(this.artificial.userId,JSON.stringify(this.sendRequestMessage)).then((res) => {
  911. // if (res.status == '200') {
  912. // let sendRequestMessageget = JSON.parse(JSON.stringify(this.sendRequestMessage));;
  913. // that.messages.push(sendRequestMessageget)
  914. // this.messageCount = 'CHAT'
  915. // }
  916. // });
  917. console.log(this.artificial)
  918. }
  919. this.senderMessage = ''; //清空输入框
  920. }
  921. },
  922. async toSendMessage(data) {
  923. // 发送请求
  924. },
  925. async toPushSession(data) {
  926. this.message.push(data)
  927. },
  928. //智能客服
  929. sessionFAQClick(ele, index) {
  930. alert("sessionFAQClick")
  931. },
  932. sessionQuickClick(ele, index) {
  933. // alert("sessionQuickClick")
  934. // 快捷点击
  935. console.log('ele,index')
  936. console.log(ele,index)
  937. this.toSend(ele.content);
  938. },
  939. /*** 功能区事件 ***/
  940. // 常见问题事件
  941. async toFAQ(ele, index) {
  942. this.$store.commit('modify', 'helpCenter');
  943. window.localStorage.setItem('router', 'helpCenter');
  944. const {href} = this.$router.resolve({
  945. name: 'helpCenter',
  946. query: {
  947. key: ele.id
  948. }
  949. });
  950. window.open(href, '_blank');
  951. },
  952. // 平台服务事件
  953. async toServices(ele, index) {
  954. this.toView(ele.link);
  955. },
  956. // 快捷入口事件
  957. async toQuick(ele, index) {
  958. if (!this.$Cookies.get('token')){
  959. this.toViewLogin = true;
  960. }else{
  961. this.toView(ele.link);
  962. }
  963. // this.$router.push({ name: 'IntroductionMemberProfile', query: { data: row, key: 'custom', disable: true, index: this.taberIndex } })
  964. },
  965. // 国际化
  966. i18n(data) {
  967. return this.$t('common.' + data);
  968. },
  969. dateFormat(fmt, date) {
  970. let ret;
  971. const opt = {
  972. "Y+": date.getFullYear().toString(), // 年
  973. "m+": (date.getMonth() + 1).toString(), // 月
  974. "d+": date.getDate().toString(), // 日
  975. "H+": date.getHours().toString(), // 时
  976. "M+": date.getMinutes().toString(), // 分
  977. "S+": date.getSeconds().toString() // 秒
  978. // 有其他格式化字符需求可以继续添加,必须转化成字符串
  979. };
  980. for (let k in opt) {
  981. ret = new RegExp("(" + k + ")").exec(fmt);
  982. if (ret) {
  983. fmt = fmt.replace(ret[1], (ret[1].length == 1) ? (opt[k]) : (opt[k].padStart(ret[1].length, "0")))
  984. }
  985. ;
  986. }
  987. ;
  988. return fmt;
  989. },
  990. //socket
  991. openSocket() {
  992. let that = this;
  993. if (typeof WebSocket == "undefined") {
  994. console.log("您的浏览器不支持WebSocket");
  995. } else {
  996. console.log("您的浏览器支持WebSocket");
  997. //实现化WebSocket对象,指定要连接的服务器地址与端口 建立连接
  998. this.createSocket();
  999. }
  1000. },
  1001. //创建Socket连接
  1002. createSocket() {
  1003. let that = this;
  1004. let user = window.localStorage.getItem("user");
  1005. var users = JSON.parse(user);
  1006. if (users != null) {
  1007. that.user = users;
  1008. } else if (that.user.userId == '') {
  1009. that.user.userId = new Date().getTime();
  1010. }
  1011. var islocalhost = 'localhost' == document.location.hostname ? true : false;
  1012. if (islocalhost) {
  1013. this.socketUrl =
  1014. "http://localhost:7028/userConn/" + this.$i18n.locale.toUpperCase() + "/" + that.user.userId;
  1015. } else {
  1016. const origin = document.location.origin
  1017. this.socketUrl =
  1018. origin + "/userConn/" + this.$i18n.locale.toUpperCase() + "/" + that.user.userId;
  1019. }
  1020. this.socketUrl = this.socketUrl.replace("https", "wss").replace("http", "ws");
  1021. console.log(this.socketUrl);
  1022. if (this.socket != null) {
  1023. this.socket.close();
  1024. this.socket = null;
  1025. }
  1026. this.socket = new WebSocket(this.socketUrl);
  1027. this.initSocketFunction()
  1028. },
  1029. initHeartCheck() {
  1030. let that = this;
  1031. this.heartCheck = {
  1032. timeout: 30000,
  1033. timeoutObj: null,
  1034. serverTimeoutObj: null,
  1035. socket: this.socket,
  1036. start: function () {
  1037. console.log('start');
  1038. var self = this;
  1039. this.timeoutObj && clearTimeout(this.timeoutObj);
  1040. this.serverTimeoutObj && clearTimeout(this.serverTimeoutObj);
  1041. this.timeoutObj = setTimeout(function () {
  1042. //这里发送一个心跳,后端收到后,返回一个心跳消息,
  1043. var message = {
  1044. userId: "",
  1045. message: "",
  1046. messageType: "PING",
  1047. }
  1048. var a = JSON.stringify(message);
  1049. that.socket.send(a);
  1050. self.serverTimeoutObj = setTimeout(function () {
  1051. console.log(that.socket);
  1052. that.socket.close();
  1053. }, self.timeout);
  1054. }, this.timeout)
  1055. },
  1056. stop: function () {
  1057. window.clearTimeout(this.timeoutObj);
  1058. window.clearTimeout(this.serverTimeoutObj);
  1059. return this;
  1060. },
  1061. }
  1062. },
  1063. //初始化socket对应操作方法
  1064. initSocketFunction() {
  1065. let that = this
  1066. //初始化心跳
  1067. this.initHeartCheck()
  1068. //打开事件
  1069. this.socket.onopen = function () {
  1070. console.log("websocket已打开");
  1071. that.heartCheck.start();
  1072. //socket.send("这是来自客户端的消息" + location.href + new Date());
  1073. };
  1074. //获得消息事件
  1075. this.socket.onmessage = function (msg) {
  1076. that.heartCheck.start();
  1077. console.log(msg);
  1078. var message = JSON.parse(msg.data);
  1079. if (message.messageType == 'PONG') {
  1080. console.log(message)
  1081. } else {
  1082. console.log(message)
  1083. that.artificial.userId = message.userId;
  1084. that.artificial.userName = message.userName;
  1085. that.messages.push(message)
  1086. }
  1087. //发现消息进入 开始处理前端触发逻辑
  1088. };
  1089. //关闭事件
  1090. this.socket.onclose = function () {
  1091. console.log("websocket已关闭");
  1092. };
  1093. //发生了错误事件
  1094. this.socket.onerror = function () {
  1095. console.log("websocket发生了错误");
  1096. that.reconnect(this.socketUrl);
  1097. };
  1098. },
  1099. //重连方法
  1100. reconnect() {
  1101. let that = this;
  1102. if (this.lockReconnect) {
  1103. return;
  1104. }
  1105. ;
  1106. this.lockReconnect = true;
  1107. //没连接上会一直重连,设置延迟避免请求过多
  1108. this.tt && window.clearTimeout(this.tt);
  1109. this.tt = window.setTimeout(function () {
  1110. that.createSocket();
  1111. that.lockReconnect = false;
  1112. }, 4000);
  1113. },
  1114. // enterKey(event) {
  1115. // const code = event.keyCode
  1116. // ? event.keyCode
  1117. // : event.which
  1118. // ? event.which
  1119. // : event.charCode;
  1120. // if (code == 13) {
  1121. // console.log("asdfasdfasdfadsf")
  1122. // }
  1123. // },
  1124. // enterKeyup() {
  1125. // document.addEventListener("keyup", this.enterKey);
  1126. // },
  1127. //人工消息发布
  1128. sendMessage() {
  1129. if (typeof WebSocket == "undefined") {
  1130. console.log("您的浏览器不支持WebSocket");
  1131. } else {
  1132. console.log("您的浏览器支持WebSocket");
  1133. console.log(
  1134. '{"toUserId":"' +
  1135. this.toUserId +
  1136. '","contentText":"' +
  1137. this.content +
  1138. '"}'
  1139. );
  1140. this.socket.send(
  1141. '{"toUserId":"' +
  1142. this.toUserId +
  1143. '","contentText":"' +
  1144. this.content +
  1145. '"}'
  1146. );
  1147. }
  1148. },
  1149. // 判断未登录跳转是否关闭
  1150. toViewLoginChange(done){
  1151. this.toViewLogin=false;
  1152. this.num=5;
  1153. clearInterval(this.timer);
  1154. },
  1155. loginTipsChange(){
  1156. const that=this;
  1157. this.num =5;
  1158. // clearInterval(timer_interval);
  1159. this.timer = setInterval(function() {
  1160. if (that.num > 0) {
  1161. that.num--;
  1162. } else {
  1163. if(that.toViewLogin==true){
  1164. clearInterval(that.timer);
  1165. that.toViewLocal('login');
  1166. }else {
  1167. clearInterval(that.timer);
  1168. }
  1169. }
  1170. }, 1000)
  1171. },
  1172. },
  1173. }
  1174. </script>
  1175. <style scoped>
  1176. .oneLine {
  1177. /* 隐藏溢出元素 */
  1178. overflow: hidden;
  1179. /* 单行显示 */
  1180. white-space: nowrap;
  1181. /* 溢出显示省略号 */
  1182. text-overflow: ellipsis;
  1183. }
  1184. .box {
  1185. background: #fff;
  1186. padding: 10px 0 109px 0;
  1187. }
  1188. .sessionArea {
  1189. width: 833px;
  1190. height: 792px;
  1191. border: 1px solid #e1e1e3;
  1192. float: left;
  1193. }
  1194. .sessionArea .title {
  1195. width: 100%;
  1196. height: 50px;
  1197. background-color: #e6e7eb;
  1198. border-bottom: 1px solid #e1e1e3;
  1199. padding-left: 19px;
  1200. box-sizing: border-box;
  1201. }
  1202. .sessionArea .session {
  1203. width: 100%;
  1204. height: 519px;
  1205. background-color: #eef3f7;
  1206. }
  1207. .sessionArea .classes {
  1208. width: 100%;
  1209. height: 44px;
  1210. border-bottom: 1px solid #e1e1e3;
  1211. padding-left: 13px;
  1212. box-sizing: border-box;
  1213. }
  1214. .sessionArea .inputText {
  1215. width: 100%;
  1216. height: 179px;
  1217. padding: 6px 13px;
  1218. box-sizing: border-box;
  1219. }
  1220. .sessionArea .inputText .items {
  1221. clear: both;
  1222. overflow: hidden;
  1223. }
  1224. .functionalArea {
  1225. width: 357px;
  1226. height: 792px;
  1227. border: 1px solid #e1e1e3;
  1228. float: right;
  1229. }
  1230. .functionalArea .content {
  1231. width: 100%;
  1232. }
  1233. .functionalArea .content ul {
  1234. list-style-type: disc;
  1235. }
  1236. </style>
  1237. <style>
  1238. .inputText .el-textarea {
  1239. /*overflow:hidden*/
  1240. }
  1241. .inputText .el-textarea .el-textarea__inner {
  1242. border: none;
  1243. /*overflow-y: auto;*/
  1244. }
  1245. </style>