complaintDetail.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547
  1. <template>
  2. <div class="mainBox">
  3. <div class="layerBox">
  4. <tableTitle :name="tableDivTitle" />
  5. <el-row>
  6. <template>
  7. <!-- 在此位置下面写 -->
  8. <div class="article-detail">
  9. <div class="article-card">
  10. <div class="article-title">
  11. {{ dataInfo.title }}
  12. </div>
  13. <div class="article-meta">
  14. <div class="left">
  15. <span>投诉地区:北京市-大兴区</span>
  16. <span>投诉类型:公安</span>
  17. </div>
  18. <span class="happenTime">发生日期:2023-08-01 10:00:00</span>
  19. </div>
  20. <el-divider> </el-divider>
  21. <div class="detail_title">
  22. <div class="title">
  23. 事件描述:
  24. </div>
  25. </div>
  26. <div class="background-color">
  27. <div class="article-author">
  28. <div class="article_box">
  29. <div class="article_panel" :class="{ collapsed: !isExpanded }">
  30. <div v-html="dataInfo.content"></div>
  31. </div>
  32. <span class="article_panel_btn" v-if="showReadMoreBtn && !isExpanded"
  33. @click="toggleExpand">
  34. 阅读全文
  35. <i class="el-icon-arrow-down"></i>
  36. </span>
  37. </div>
  38. </div>
  39. </div>
  40. <div>我的要求:</div>
  41. <div class="background-color">
  42. <div class="article-author">
  43. <div class="article_box">
  44. <div class="article_panel" :class="{ collapsed: !isExpanded }">
  45. <div v-html="dataInfo.content"></div>
  46. </div>
  47. <span class="article_panel_btn" v-if="showReadMoreBtn && !isExpanded"
  48. @click="toggleExpand">
  49. 阅读全文
  50. <i class="el-icon-arrow-down"></i>
  51. </span>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="comment-section">
  57. <div class="box_1 clearfix">
  58. <div class="box_in">附件:</div>
  59. </div>
  60. <!-- <div class="comment-list">
  61. <div class="comment_li" v-for="(per_obj, keys) in replyList" :key="keys">
  62. <el-avatar class="comment_li_img" :src="per_obj.avatar" />
  63. <div class="comment_li_name">{{ per_obj.nickname }}:</div>
  64. <div class="comment_li_text">
  65. {{ per_obj.content }}
  66. </div>
  67. <div class="comment_li_time">{{ per_obj.created_at }}</div>
  68. </div>
  69. </div> -->
  70. <!-- <div class="alignBox">
  71. <el-row>
  72. <el-col :span="24">
  73. <el-pagination :current-page="getApiData.page" @size-change="handleSizeChange"
  74. @current-change="handleCurrentChange" :page-size="5"
  75. layout="total, prev, pager, next, jumper" :total="allCount"></el-pagination>
  76. </el-col>
  77. </el-row>
  78. </div> -->
  79. <div class="comment-actions">
  80. <el-button type="info" @click="goBack">返回</el-button>
  81. <!-- <el-button type="info" plain>信息按钮</el-button> -->
  82. <!-- <el-button type="primary" @click="viewGroupChat">查看群聊</el-button> -->
  83. </div>
  84. </div>
  85. </div>
  86. </template>
  87. </el-row>
  88. </div>
  89. </div>
  90. </template>
  91. <script>
  92. //表格标题
  93. import tableTitle from './components/tableTitle';
  94. //引入公用样式
  95. import '@/styles/global.less';
  96. import InputTag from '@/components/InputTag'
  97. import { getTopicDataInfo, getTopicReply } from '@/api/chat'
  98. import emitter from '@/eventBus';
  99. export default {
  100. components: {
  101. tableTitle,//表格标题
  102. InputTag
  103. },
  104. data() {
  105. let self = this;
  106. return {
  107. id: '',
  108. dataInfo: {},
  109. isExpanded: false, // btn添加展开状态
  110. showReadMoreBtn: false,
  111. //1.列表和分页相关 start ------------------------------------------------------------>
  112. tableDivTitle: "通知详情",
  113. getApiData: {
  114. page: 1,//当前是第几页
  115. pageSize: 5,//一共多少条
  116. },
  117. allCount: 0,//总条数
  118. replyList: [],
  119. currentGroupId: null
  120. }
  121. },
  122. methods: {
  123. //1.4 列表内容分页
  124. //直接跳转
  125. handleSizeChange(val) {
  126. this.getApiData.page = val;
  127. this.getTopicReplyList();
  128. },
  129. //1.5 点击分页
  130. handleCurrentChange(val) {
  131. this.getApiData.page = val;
  132. this.getTopicReplyList();
  133. },
  134. toggleExpand() { // 添加切换方法
  135. this.isExpanded = true;
  136. },
  137. checkPanelHeight() {
  138. this.$nextTick(() => {
  139. const panel = this.$el.querySelector('.article_panel');
  140. if (panel) {
  141. this.showReadMoreBtn = panel.scrollHeight > 270;
  142. }
  143. });
  144. },
  145. getDataINfo() {
  146. getTopicDataInfo({
  147. id: self.id
  148. }).then(data => {
  149. // this.loading=false;
  150. console.log("返回数据", data.data);
  151. this.dataInfo = data.data;
  152. console.log("赋值:", self.dataInfo)
  153. })
  154. },
  155. getTopicReplyList() {
  156. getTopicReply({
  157. id: self.id,
  158. page: this.getApiData.page,
  159. page_size: this.getApiData.pageSize
  160. }).then(data => {
  161. this.replyList = data.data.data;
  162. this.allCount = data.data.total;
  163. })
  164. },
  165. goBack() {
  166. this.$router.back();
  167. },
  168. viewGroupChat() {
  169. console.log('[businessDistrictDetail] 触发 view-group-chat 事件,id1:', this.dataInfo);
  170. emitter.emit('view-group-chat', this.dataInfo);
  171. },
  172. handleViewGroupChat(ids) {
  173. console.log('[businessDistrictDetail] 收到 view-group-chat 事件,id2:', ids);
  174. // 这里一般不需要监听自己发的事件,除非有特殊需求
  175. },
  176. getMainData() {
  177. let data = {
  178. id: 41
  179. };
  180. this.$store.dispatch('news/getNoticeInfo', data).then(res => {
  181. console.log('详情数据', res);
  182. this.dataInfo = res.data;
  183. })
  184. },
  185. },
  186. mounted() {
  187. // 1.获取详情数据
  188. self.id = this.$route.query.id + '';
  189. this.getDataINfo();
  190. this.getTopicReplyList();
  191. this.checkPanelHeight();
  192. // 可选:如果你需要监听(一般只在调试时用)
  193. emitter.on('view-group-chat', this.handleViewGroupChat);
  194. this.getMainData();
  195. },
  196. beforeDestroy() {
  197. emitter.off('view-group-chat', this.handleViewGroupChat);
  198. },
  199. // watch: {
  200. // 'dataInfo.content': function () {
  201. // this.checkPanelHeight();
  202. // }
  203. // }
  204. }
  205. </script>
  206. <style scoped lang="less">
  207. .article-detail {
  208. // padding: 24px;
  209. // background: #f5f7fa;
  210. min-height: 100vh;
  211. .article-card {
  212. margin-bottom: 24px;
  213. padding: 24px 0px;
  214. background: #fff;
  215. .article-title {
  216. font-family: Microsoft YaHei, Microsoft YaHei;
  217. font-weight: bold;
  218. font-size: 28px;
  219. color: #333333;
  220. display: flex;
  221. align-items: center;
  222. .article-tag {
  223. margin-left: 30px;
  224. }
  225. }
  226. .article-meta {
  227. margin-top: 31px;
  228. color: #888;
  229. font-size: 16px;
  230. display: block;
  231. height: 40px;
  232. .left {
  233. float: left;
  234. }
  235. .article-link {
  236. margin-left: 12px;
  237. }
  238. .happenTime {
  239. float: right;
  240. margin-right: 20px;
  241. }
  242. }
  243. .detail_title {
  244. height: 40px;
  245. line-height: 40px;
  246. border-bottom: 1px solid #E1E1E1;
  247. margin-bottom: 40px;
  248. .title {
  249. width: 103px;
  250. font-size: 22px;
  251. font-weight: bold;
  252. color: #5570f1;
  253. border-bottom: 3px solid #5570f1;
  254. }
  255. }
  256. .article-author {
  257. margin-top: 12px;
  258. color: #999;
  259. font-size: 18px;
  260. span {
  261. font-weight: 400;
  262. font-size: 18px;
  263. color: #6A82F3;
  264. text-align: center;
  265. // margin-right: 16px;
  266. display: block;
  267. line-height: 30px;
  268. }
  269. }
  270. }
  271. .comment-section {
  272. // padding: 24px 32px;
  273. background: #fff;
  274. border-radius: 8px;
  275. .comment-title {
  276. font-weight: bold;
  277. font-size: 22px;
  278. color: #5570F1;
  279. // font-size: 16px;
  280. // font-weight: bold;
  281. // color: #333;
  282. margin-bottom: 8px;
  283. text-align: left;
  284. }
  285. // 蓝色短分割线,宽度10%,居中
  286. .el-divider {
  287. margin: 8px auto 16px auto;
  288. border: none;
  289. height: 0;
  290. width: 10%;
  291. min-width: 40px;
  292. max-width: 100px;
  293. border-top: 2px solid #5570F1;
  294. border-radius: 2px;
  295. background: transparent;
  296. }
  297. .comment-list {
  298. margin-top: 40px;
  299. margin-bottom: 16px;
  300. min-height: 200px;
  301. .comment_li {
  302. background: #FAFAFA;
  303. border: solid 1px #E1E1E1;
  304. overflow: hidden;
  305. margin-bottom: 20px;
  306. }
  307. .comment_li_img {
  308. float: left;
  309. width: 52px;
  310. height: 52px;
  311. border-radius: 50%;
  312. margin: 30px 0px 30px 30px;
  313. }
  314. .comment_li_name {
  315. float: left;
  316. margin: 44px 0px 44px 20px;
  317. color: #333;
  318. font-size: 16px;
  319. line-height: 24px;
  320. }
  321. .comment_li_text {
  322. float: left;
  323. margin: 45px 0px 11px 20px;
  324. color: #333;
  325. font-size: 16px;
  326. line-height: 24px;
  327. font-weight: bold;
  328. max-width: 1000px;
  329. }
  330. .comment_li_time {
  331. float: right;
  332. margin: 44px 30px 44px 0px;
  333. color: #999;
  334. font-size: 16px;
  335. line-height: 24px;
  336. }
  337. .comment-item {
  338. display: flex;
  339. align-items: center;
  340. padding: 12px 0;
  341. border-bottom: 1px solid #f0f0f0;
  342. &:last-child {
  343. border-bottom: none;
  344. }
  345. .comment-avatar {
  346. width: 36px;
  347. height: 36px;
  348. margin-right: 12px;
  349. }
  350. .comment-content {
  351. .comment-user {
  352. font-size: 15px;
  353. color: #555;
  354. font-weight: 500;
  355. }
  356. .comment-time {
  357. font-size: 12px;
  358. color: #aaa;
  359. margin-top: 2px;
  360. }
  361. }
  362. }
  363. }
  364. .comment-actions {
  365. display: flex;
  366. justify-content: center;
  367. gap: 16px;
  368. margin-top: 12px;
  369. }
  370. }
  371. .article-meta-item1 {
  372. position: relative;
  373. padding-left: 27px;
  374. &::before {
  375. content: '';
  376. display: inline-block;
  377. width: 20px;
  378. height: 20px;
  379. background: url('../../assets/notice/notice1.png') no-repeat center center;
  380. background-size: contain;
  381. position: absolute;
  382. left: 0;
  383. top: 50%;
  384. transform: translateY(-50%);
  385. margin-right: 4px;
  386. }
  387. }
  388. .article-meta-item2 {
  389. position: relative;
  390. padding-left: 27px;
  391. margin-left: 40px;
  392. &::before {
  393. content: '';
  394. display: inline-block;
  395. width: 20px;
  396. height: 20px;
  397. background: url('../../assets/notice/notice2.png') no-repeat center center;
  398. background-size: contain;
  399. position: absolute;
  400. left: 0;
  401. top: 50%;
  402. transform: translateY(-50%);
  403. margin-right: 4px;
  404. }
  405. }
  406. .article-meta-item3 {
  407. position: relative;
  408. padding-left: 27px;
  409. margin-left: 40px;
  410. &::before {
  411. content: '';
  412. display: inline-block;
  413. width: 20px;
  414. height: 20px;
  415. background: url('http://img.bjzxtw.org.cn/master/www/admin/wechat.png') no-repeat center center;
  416. background-size: contain;
  417. position: absolute;
  418. left: 0;
  419. top: 50%;
  420. transform: translateY(-50%);
  421. margin-right: 4px;
  422. }
  423. }
  424. .top-button {
  425. margin-left: 30px;
  426. }
  427. .background-color {
  428. min-height: 617px;
  429. background: #f0f2f5;
  430. padding: 10px 20px 0px 20px;
  431. }
  432. .clearfix::after {
  433. content: '';
  434. display: block;
  435. height: 0;
  436. visibility: hidden;
  437. clear: both;
  438. }
  439. .box_1 {
  440. border-bottom: solid 1px #E9EDF7;
  441. box-sizing: border-box;
  442. }
  443. .box_in {
  444. font-weight: bold;
  445. float: left;
  446. font-size: 22px;
  447. color: #5570F1;
  448. height: 33px;
  449. line-height: 33px;
  450. border-bottom: solid 2px #5570F1;
  451. margin-bottom: -1px;
  452. }
  453. }
  454. .article_box {
  455. margin-top: 11;
  456. overflow: hidden;
  457. }
  458. .article_panel {
  459. transition: max-height 0.3s;
  460. overflow: hidden;
  461. position: relative;
  462. max-height: none;
  463. // 展开时无高度限制
  464. &.collapsed {
  465. max-height: 270px; // 固定高度
  466. // 可选:加渐变遮罩
  467. &::after {
  468. content: '';
  469. position: absolute;
  470. left: 0;
  471. right: 0;
  472. bottom: 0;
  473. // height: 36px;
  474. background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 80%);
  475. pointer-events: none;
  476. }
  477. }
  478. }
  479. .article_panel_btn {
  480. display: inline-block;
  481. color: #5570F1;
  482. cursor: pointer;
  483. margin-top: 8px;
  484. font-size: 15px;
  485. }
  486. .dot1 {
  487. word-break: keep-all;
  488. white-space: nowrap;
  489. overflow: hidden;
  490. text-overflow: ellipsis;
  491. }
  492. </style>