ledgeBase.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. <template>
  2. <div class="chatBox">
  3. <el-header height='80px'>
  4. <el-row type="flex" justify='space-between' align='middle' style="height:100%;">
  5. <el-col class="tit nopd">
  6. <span @click="back()" class="back pointer"></span>
  7. <span>留言知识库</span>
  8. </el-col>
  9. </el-row>
  10. </el-header>
  11. <div class="cationer">
  12. <el-main class="">
  13. <div class="leaveCont">
  14. <div class=" head row">
  15. <el-select v-model="selt.label" @change="selectGet" class="selt" placeholder="请选择">
  16. <el-option
  17. v-for="item in options"
  18. :key="item.value"
  19. :label="item.label"
  20. :value="item.value">
  21. </el-option>
  22. </el-select>
  23. <el-input
  24. placeholder="请输入关键词"
  25. suffix-icon="el-icon-search"
  26. v-model="crux"
  27. class="crux"
  28. >
  29. </el-input>
  30. <div class="">
  31. <el-button type="primary" @click="search()"
  32. style="height:40px;width:100px;margin-left:10px;">查询
  33. </el-button>
  34. </div>
  35. </div>
  36. <div class="nav">
  37. <div class="list" v-for="item in problemType" :key="item.id"
  38. @click="acty(item.id,item.name)" :class="activity == item.id?'listActy':''">
  39. <span>{{item.name}}</span>
  40. </div>
  41. </div>
  42. <!-- 折叠面板 -->
  43. <div class="fold" v-if="noBase">
  44. <el-collapse accordion>
  45. <el-collapse-item class="list" v-for="item in knowLedgeBase" :key="item.id">
  46. <template slot="title">
  47. <div style="width:100%;" class="quesTit">
  48. <span class="title">{{item.content}}</span>
  49. <span style="float: right">{{item.add_time}}</span>
  50. </div>
  51. </template>
  52. <div class="text">
  53. {{item.content}}
  54. </div>
  55. <ul class="imgs" v-for="i in imgs">
  56. <li v-for="child in i">
  57. <img :src="url + child" alt="">
  58. </li>
  59. </ul>
  60. <p>回复的留言</p>
  61. <div class="text">
  62. {{item.reply_content ? item.reply_content : "暂无"}}
  63. </div>
  64. </el-collapse-item>
  65. </el-collapse>
  66. </div>
  67. <div v-if="!noBase">
  68. <div class="noBase">
  69. <span>暂无数据</span>
  70. </div>
  71. </div>
  72. <!-- 分页 -->
  73. <el-pagination
  74. v-if="noBase"
  75. style="text-align: center"
  76. background
  77. layout="prev, pager, next"
  78. :total="pages" @prev-click='upData'
  79. @next-click="downData" @current-change="current_page">
  80. </el-pagination>
  81. </div>
  82. <div class="launch">
  83. <el-button type="primary" @click="launchLeave">发起留言</el-button>
  84. </div>
  85. </el-main>
  86. </div>
  87. </div>
  88. </template>
  89. <script>
  90. import '../css/index.css'
  91. export default {
  92. name: 'leaveMsg',
  93. data() {
  94. return {
  95. dialogImageUrl: '',
  96. selt: {value: 'week', label: '最近一周'},//选中默认值
  97. seltValue: '', // 选中的值
  98. crux: '', //关键词
  99. activeNames: '', //折叠面板选中效果
  100. activity: '1', //活动列表选中状态
  101. options: [{
  102. value: 'week',
  103. label: '最近一周'
  104. }, {
  105. value: 'oneMonth',
  106. label: '最近一个月'
  107. }, {
  108. value: 'threeMonth',
  109. label: '最近三个月'
  110. }],
  111. problemType: '', //类
  112. knowLedgeBase: '', //知识库问答数据
  113. problemName: '账号',//类名
  114. noBase: true, //无数据状态
  115. imgs: [],
  116. url: 'http://kfadmin.bocai186.com', // 域名地址
  117. // url: 'http://192.168.2.187:8090', // 域名地址
  118. pages: 1,
  119. optionCont: "",
  120. ledgedata: {}
  121. }
  122. },
  123. methods: {
  124. /******************上一页*****************/
  125. upData(e) {
  126. this.getLeave(e)
  127. },
  128. /*********************下一页******************/
  129. downData(e) {
  130. this.getLeave(e)
  131. },
  132. /*******************选择页数******************/
  133. current_page(e) {
  134. this.getLeave(e)
  135. },
  136. // 返回传值到父组件
  137. back() {
  138. this.$emit('value', 10)
  139. },
  140. // 跳转发起留言
  141. launchLeave() {
  142. this.$emit('value', 1000)
  143. },
  144. // 切换类
  145. acty(type, name) {
  146. this.activity = type;
  147. this.problemName = name;
  148. this.getLeave(1);
  149. },
  150. // 获取下拉框的值
  151. selectGet(value) {
  152. // 获取下拉框的value值
  153. this.seltValue = value;
  154. },
  155. // 获取数据
  156. getLeave(page, size = 5) {
  157. this.ledgedata = {
  158. time: this.optionCont,
  159. key: this.crux,
  160. type: this.problemName,
  161. pageSize: size,
  162. pageNumber: page,
  163. }
  164. this.$axios.post('/api/index/Message/index', this.ledgedata).then(res => {
  165. if (res.data.status === 1) {
  166. // console.log('======获取数据=========', res.data.data);
  167. let _img;
  168. for (let i = 0; i < res.data.data.length; i++) {
  169. _img = res.data.data[i].images.split(",");
  170. this.imgs.push(_img)
  171. }
  172. this.knowLedgeBase = res.data.data.list;
  173. this.pages = res.data.data.total;
  174. this.knowLedgeBase.length > 0 ? this.noBase = true : this.noBase = false;
  175. }
  176. })
  177. },
  178. // 查询数据
  179. search() {
  180. this.optionCont = '';
  181. if (this.seltValue == '') {
  182. this.optionCont = this.selt.value;
  183. } else {
  184. this.optionCont = this.seltValue;
  185. }
  186. this.getLeave(1)
  187. }
  188. },
  189. mounted() {
  190. this.activity = '1';
  191. this.$axios.post('/api/index/Message/type').then(res => {
  192. if (res.data.status === 1) {
  193. this.problemType = res.data.data;
  194. let optionCont = '';
  195. if (this.seltValue == '') {
  196. optionCont = this.selt.value;
  197. } else {
  198. optionCont = this.seltValue;
  199. }
  200. this.getLeave(1)
  201. }
  202. })
  203. }
  204. }
  205. </script>
  206. <style scoped>
  207. .title {
  208. float: left;
  209. width: 300px;
  210. overflow: hidden;
  211. word-break: keep-all;
  212. white-space: nowrap;
  213. text-overflow: ellipsis;
  214. }
  215. .imgs {
  216. margin: 20px 0;
  217. display: flex;
  218. justify-content: flex-start;
  219. }
  220. .imgs li {
  221. margin-right: 10px;
  222. width: 100px;
  223. height: 100px;
  224. }
  225. .imgs li img {
  226. width: 100px;
  227. height: 100px;
  228. }
  229. .text {
  230. background: #f5f5f5;
  231. border: 1px solid #eee;
  232. padding: 20px;
  233. font-size: 14px;
  234. color: #666;
  235. line-height: 1.8;
  236. margin-right: 15px;
  237. margin-top: 15px;
  238. }
  239. .chatBox {
  240. width: 700px;
  241. }
  242. .el-header {
  243. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  244. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  245. }
  246. .tit {
  247. height: 100%;
  248. line-height: 80px;
  249. text-align: left;
  250. padding-left: 20px;
  251. }
  252. .tit span {
  253. font-size: 18px;
  254. }
  255. .el-col span {
  256. font-size: 18px;
  257. color: #FFFFFF;
  258. }
  259. .imgBox {
  260. text-align: right;
  261. }
  262. .imgBox img {
  263. margin-right: 20px;
  264. }
  265. .imgBox img:nth-last-child(1) {
  266. margin-right: 0
  267. }
  268. .el-main {
  269. background: #fff;
  270. width: 445px;
  271. padding: 0;
  272. }
  273. .el-aside {
  274. background: #F5F5F5;
  275. width: 255px;
  276. }
  277. .cationer, .artificial {
  278. display: flex;
  279. justify-content: space-between;
  280. /* align-items: center; */
  281. }
  282. .rt {
  283. width: 255px;
  284. box-sizing: inherit;
  285. }
  286. .artificial {
  287. /* width: 150px; */
  288. /* padding:0 20px; */
  289. margin-top: 23px;
  290. margin-bottom: 9px;
  291. vertical-align: middle;
  292. /* flex-direction: column;*/
  293. }
  294. .infor div {
  295. margin-bottom: 3px;
  296. }
  297. .infor div span, .autograph span {
  298. color: #999999;
  299. font-size: 14px;
  300. font-weight: 400;
  301. }
  302. .infor div span:nth-child(2), .autograph span:nth-child(2) {
  303. color: #666666;
  304. margin-left: 4px;
  305. }
  306. .headPortrait {
  307. width: 100px;
  308. height: 100px;
  309. }
  310. .autograph {
  311. margin-bottom: 11px;
  312. }
  313. .advent {
  314. border-top: 1px solid #DDDDDD;
  315. padding: 20px;
  316. }
  317. .advent img {
  318. width: 215px;
  319. height: 350px;
  320. }
  321. .pd {
  322. padding: 20px;
  323. }
  324. .pd20 {
  325. padding: 0 20px;
  326. }
  327. /* 留言框 */
  328. .el-main {
  329. position: relative;
  330. height: 600px;
  331. overflow: auto;
  332. }
  333. .el-main .leaveCont {
  334. box-sizing: border-box;
  335. padding: 20px 20px 13px;
  336. }
  337. label {
  338. font-size: 14px;
  339. color: #666666;
  340. }
  341. .star {
  342. color: #F04992;
  343. vertical-align: middle;
  344. }
  345. .tips {
  346. font-size: 12px;
  347. color: #F04992;
  348. margin-left: 20px;
  349. }
  350. .addPhoto {
  351. margin: 20px 0 0;
  352. }
  353. .addPhoto label {
  354. margin-bottom: 14px;
  355. }
  356. .el-textarea {
  357. margin-top: 10px;
  358. }
  359. .btn {
  360. position: absolute;
  361. /* bottom: 23px; */
  362. right: 20px;
  363. }
  364. .el-button {
  365. width: 120px;
  366. height: 48px;
  367. background: linear-gradient(90deg, rgba(22, 84, 209, 1) 0%, rgba(9, 52, 173, 1) 100%);
  368. box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.2);
  369. border-radius: 10px;
  370. }
  371. .back {
  372. display: inline-block;
  373. width: 25px;
  374. height: 25px;
  375. background: url("./../assets/st-img/back.png") no-repeat;
  376. background-size: 100% 100%;
  377. vertical-align: middle;
  378. }
  379. .nopd {
  380. padding: 0;
  381. }
  382. .pointer {
  383. cursor: pointer;
  384. }
  385. .selt {
  386. margin-right: 15px;
  387. width: 160px;
  388. }
  389. .cationer .head {
  390. width: 100%;
  391. margin-bottom: 20px;
  392. }
  393. .crux {
  394. width: 230px;
  395. }
  396. /* 主体 */
  397. .nav {
  398. height: 40px;
  399. background: #5EA0F7;
  400. border-radius: 5px 5px 0px 0px;
  401. display: flex;
  402. justify-content: space-between;
  403. padding: 10px 10px 0;
  404. }
  405. .nav .list {
  406. width: 90px;
  407. height: 40px;
  408. line-height: 40px;
  409. text-align: center;
  410. cursor: pointer;
  411. }
  412. .nav .list span {
  413. color: #fff;
  414. }
  415. .listActy {
  416. background: #fff;
  417. border-radius: 5px 5px 0px 0px;
  418. }
  419. .listActy span {
  420. color: #5EA0F7 !important;
  421. }
  422. .list .quesTit {
  423. align-items: center;
  424. }
  425. .list .el-collapse-item__header {
  426. color: #666666 !important;
  427. }
  428. .list .quesTit span {
  429. color: #666666;
  430. font-size: 16px;
  431. }
  432. .list .quesTit span:nth-last-child(1) {
  433. color: #999999;
  434. font-size: 14px;
  435. margin-right: 10px;
  436. }
  437. /* 会话 */
  438. .conversationBox {
  439. margin-top: 26px;
  440. }
  441. .timer {
  442. text-align: center;
  443. margin: 10px 0;
  444. color: #999999;
  445. font-size: 12px;
  446. }
  447. .headImg {
  448. width: 40px;
  449. height: 40px;
  450. margin-right: 13px;
  451. }
  452. .headImg img {
  453. width: 40px;
  454. height: 40px;
  455. }
  456. .conversation .cont, .customer .cont {
  457. background: #ffffff;
  458. padding: 9px 8px 12px 10px;
  459. display: inline-block;
  460. border: 1px solid rgba(223, 223, 223, 1);
  461. border-radius: 5px;
  462. position: relative;
  463. }
  464. .left::after {
  465. position: absolute;
  466. content: "";
  467. display: inline-block;
  468. left: -4px;
  469. top: 5px;
  470. width: 5px;
  471. height: 9px;
  472. background: #fff;
  473. -webkit-transform: skewX(30deg);
  474. transform: skewX(30deg);
  475. /* z-index: -1; */
  476. border-left: 1px solid #dfdfdf;
  477. border-top: 1px solid #dfdfdf;
  478. }
  479. div.noafter::after {
  480. content: '';
  481. width: 0;
  482. height: 0;
  483. display: inline;
  484. position: relative;
  485. border: 0;
  486. }
  487. .conversation .cont div, .customer .cont div {
  488. color: #666666;
  489. font-size: 16px;
  490. }
  491. .customer {
  492. justify-content: space-between;
  493. }
  494. .customer .cont {
  495. margin-right: 13px;
  496. border: 0;
  497. background: #5EA0F7;
  498. }
  499. .customer .cont div {
  500. color: #FFFFFF;
  501. }
  502. .right::after {
  503. position: absolute;
  504. content: "";
  505. display: inline-block;
  506. right: -3px;
  507. top: 6px;
  508. width: 5px;
  509. height: 9px;
  510. background: #5ea0f7;
  511. -webkit-transform: skewX(-30deg);
  512. transform: skewX(-30deg);
  513. border-left: 1px solid #5ea0f7;
  514. border-top: 1px solid #5ea0f7;
  515. }
  516. .col {
  517. color: #999999;
  518. }
  519. .change {
  520. color: #5ea0f7;
  521. }
  522. .launch {
  523. box-sizing: border-box;
  524. border-top: 1px solid #DDDDDD;
  525. padding: 16px 20px 0 0;
  526. position: relative;
  527. height: 80px;
  528. }
  529. .launch button {
  530. position: absolute;
  531. right: 20px;
  532. }
  533. .noBase {
  534. width: 100%;
  535. height: 50px;
  536. line-height: 50px;
  537. background: #e0e0e0;
  538. text-align: center;
  539. }
  540. </style>