NoticeDetail.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <div class="normal-card">
  3. <div class="title-box">
  4. <div class="title">{{detailData.title}}</div>
  5. <div>
  6. <div class="descript">{{detailData.summary}}</div>
  7. <div class="info">
  8. <span class="tag">{{detailData.classname}}</span>
  9. <span>{{detailData.createdate}}</span>
  10. </div>
  11. </div>
  12. </div>
  13. <div class="text-content" v-if="detailData.content != '<p><br></p>'">
  14. <div id="fwb"></div>
  15. </div>
  16. <div class="file-content" v-if="detailData.attinfos && detailData.attinfos.length > 0">
  17. <div class="file-download">
  18. <p class="title">附件下载</p>
  19. <div class="file-list">
  20. <file-item
  21. :isDownLoad="true"
  22. :itemStyle="itemStyle"
  23. :sat_noticeid="detailData.sat_noticeid"
  24. :fileData="detailData.attinfos"
  25. @updateDownLoadRecord="updateDownLoadRecord">
  26. </file-item>
  27. </div>
  28. </div>
  29. </div>
  30. <div class="comments">
  31. <div class="score-box">
  32. <p>评分反馈</p>
  33. <div class="handle">
  34. <p>总体</p>
  35. <el-rate v-model="send.content.score" :disabled="!commentData.leavemessage == false" :colors="scoreColor"></el-rate>
  36. <p>满意</p>
  37. </div>
  38. <p>{{detailData.readpersoncount}}人评分</p>
  39. </div>
  40. <div class="text-box">
  41. <p>留言反馈</p>
  42. <div class="comment-panl">
  43. <el-input type="textarea" :rows="4" placeholder="请填写留言" resize="none" :disabled="!commentData.leavemessage == false" v-model="send.content.leavemessage">
  44. </el-input>
  45. <el-button type="success" size="small" :disabled="!commentData.leavemessage == false" @click.native="sendComment()">发表</el-button>
  46. </div>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. import FileItem from '@/components/file-block/index2'
  53. export default {
  54. name: "NoticeDetail",
  55. data () {
  56. return {
  57. //拉取数据配置
  58. param: {
  59. "classname": "saletool.notice.notice",
  60. "method": "queryNoticeMain",
  61. "content": {
  62. "sat_noticeid":4
  63. }
  64. },
  65. //发表配置
  66. send: {
  67. "classname": "saletool.notice.notice",
  68. "method": "updateReadRecord",
  69. "content": {
  70. "sat_noticeid": this.$route.query.id,
  71. "score": 0,
  72. "leavemessage": ""
  73. }
  74. },
  75. //itemfile样式
  76. itemStyle: {
  77. itemWidth: 360,
  78. margin:20,
  79. img: {
  80. width: 29,
  81. height: 29
  82. },
  83. title: 14,
  84. descript: 10
  85. },
  86. score: 0,
  87. scoreColor: ["#99A9BF", "#F7BA2A", "#FADB14"],
  88. textarea: "",
  89. //详情数据
  90. detailData: '',
  91. //评论数据
  92. commentData:''
  93. };
  94. },
  95. components: {
  96. FileItem
  97. },
  98. filters: {
  99. },
  100. computed: {},
  101. watch: {},
  102. created () {
  103. this.getNoticeDetail()
  104. this.getCommentDetail()
  105. },
  106. mounted () {
  107. },
  108. methods: {
  109. //解析富文本
  110. compileFWB () {
  111. document.getElementById('fwb').innerHTML = this.detailData.content
  112. },
  113. //获取详情数据
  114. async getNoticeDetail () {
  115. this.param.content.sat_noticeid = this.$route.query.id
  116. let res = await this.$api.requested(this.param)
  117. this.detailData = res.data
  118. this.detailData.attinfos = this.fileType.fileList(this.detailData.attinfos)
  119. this.detailData.content != '<p><br></p>' ? this.compileFWB() : ''
  120. },
  121. //发表
  122. async sendComment () {
  123. if (!this.send.content.leavemessage == true || this.send.content.score == 0) {
  124. this.$notify({
  125. title:'提示',
  126. message:'请填写评论或评分',
  127. type:'warning'
  128. })
  129. return
  130. } else {
  131. let res = await this.$api.requested(this.send)
  132. this.tool.showMessage(res,() => {
  133. this.getCommentDetail()
  134. })
  135. }
  136. },
  137. //获取评论
  138. async getCommentDetail() {
  139. let res = await this.$api.requested({
  140.     "accesstoken": "148928f55b25f5c4636d5ae7cd339f93",
  141.     "classname": "saletool.notice.notice",
  142.     "method": "queryReadRecord",
  143.     "content": {
  144.         "sat_noticeid":this.$route.query.id
  145.     }
  146. })
  147. this.commentData = res.data[0]
  148. this.send.content.score = res.data[0].score
  149. this.send.content.leavemessage = res.data[0].leavemessage
  150. },
  151. //更新下载记录
  152. async updateDownLoadRecord(data) {
  153. let res = await this.$api.requested({
  154. "classname": "saletool.notice.notice",
  155. "method": "updateDownloadRecord",
  156. "content": {
  157. "sat_noticeid":this.$route.query.id
  158. }
  159. })
  160. }
  161. }
  162. };
  163. </script>
  164. <style scoped>
  165. *{
  166. box-sizing: border-box;
  167. }
  168. .fwb-img {
  169. width: 50% !important;
  170. }
  171. .title {
  172. font-size: 14px;
  173. font-family: PingFang SC-Bold, PingFang SC;
  174. font-weight: bold;
  175. color: #333333;
  176. }
  177. .normal-card {
  178. padding: 30px;
  179. margin-top: 10px;
  180. font-family: PingFang SC-Regular;
  181. margin: 0 auto;
  182. }
  183. .normal-card .title-box {
  184. padding-bottom: 20px;
  185. border-bottom: 1px solid #eeeeee;
  186. display: flex;
  187. flex-direction: column;
  188. }
  189. .normal-card .title-box .title {
  190. line-height: 24px;
  191. padding-bottom: 10px;
  192. font-size: 25px;
  193. border-bottom: 1px solid #eeeeee;
  194. }
  195. .normal-card .title-box .descript {
  196. font-size: 14px;
  197. font-family: PingFang SC-Bold, PingFang SC;
  198. color: #333333;
  199. line-height: 24px;
  200. padding-top: 10px;
  201. }
  202. .normal-card .title-box .info {
  203. line-height: 16px;
  204. margin-top: 10px;
  205. font-size: 12px;
  206. display: flex;
  207. align-items: center;
  208. }
  209. .normal-card .title-box .info .tag {
  210. border: 1px solid #fa8c16;
  211. color: #fa8c16;
  212. margin-right: 10px;
  213. text-align: center;
  214. font-size: 10px;
  215. display: inline-block;
  216. padding: 2px 5px;
  217. }
  218. .normal-card .text-content {
  219. padding: 20px 0;
  220. border-bottom: 1px solid #eeeeee;
  221. font-size: 12px;
  222. }
  223. .normal-card .text-content #fwb {
  224. }
  225. #fwb img {
  226. width: 200px !important;
  227. }
  228. .normal-card .file-content {
  229. border-bottom: 1px solid #eeeeee;
  230. font-size: 12px;
  231. }
  232. .normal-card .file-content .title {
  233. margin: 10px 0;
  234. }
  235. .normal-card .file-content video {
  236. margin-top: 10px;
  237. }
  238. .normal-card .file-content .title {
  239. margin-bottom: 10px;
  240. }
  241. .normal-card .file-content .file-download .file-list {
  242. display: flex;
  243. flex-wrap: wrap;
  244. padding-bottom: 8px;
  245. }
  246. .normal-card .comments {
  247. margin-top: 20px;
  248. }
  249. .normal-card .comments .score-box {
  250. }
  251. .normal-card .comments .score-box p:first-child {
  252. font-size: 14px;
  253. font-family: PingFang SC-Bold, PingFang SC;
  254. font-weight: bold;
  255. color: #333333;
  256. }
  257. .normal-card .comments .score-box .handle {
  258. margin-top: 22px;
  259. display: flex;
  260. }
  261. .normal-card .comments .score-box .handle p:first-child {
  262. font-size: 14px;
  263. font-weight: 400;
  264. color: #333333;
  265. margin-right: 20px;
  266. }
  267. .normal-card .comments .score-box p:last-child {
  268. font-size: 12px;
  269. font-weight: 400;
  270. color: #999999;
  271. margin-top: 12px;
  272. }
  273. .normal-card .comments .score-box .handle p:last-child {
  274. font-size: 14px;
  275. font-weight: normal;
  276. color: #262626;
  277. margin-left: 20px;
  278. margin-top: 0;
  279. }
  280. .normal-card .comments .text-box {
  281. margin-top: 40px;
  282. }
  283. .normal-card .comments .text-box p {
  284. font-size: 14px;
  285. font-family: PingFang SC-Bold, PingFang SC;
  286. font-weight: bold;
  287. color: #333333;
  288. }
  289. .normal-card .comments .text-box .comment-panl {
  290. margin-top: 10px;
  291. }
  292. .normal-card .comments .text-box .comment-panl .el-input {
  293. min-height: 64px;
  294. }
  295. .normal-card .comments .text-box .comment-panl .el-button {
  296. background: #52c41a;
  297. margin-top: 10px;
  298. }
  299. .file-see img,video {
  300. max-width: 100%;
  301. }
  302. </style>