semDetail.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <div id="semDetail">
  3. <el-row>
  4. <div class="w_1200">
  5. <el-col :span="24" class="main">
  6. <el-col :span="24" class="one">
  7. <el-image :src="gongqiuImage"></el-image>
  8. </el-col>
  9. <el-col :span="24" class="two">
  10. <el-col :span="24" class="twoTop">
  11. <el-col :span="3" class="left">
  12. 浏览次数:1
  13. </el-col>
  14. <el-col :span="21" class="right"> [专题] {{ detail.title }} </el-col>
  15. </el-col>
  16. <el-col :span="24" class="twoInfo">
  17. <el-col :span="24" class="list">
  18. <el-col :span="3" class="left">
  19. <el-col :span="24" class="leftTop">
  20. 会员名称
  21. </el-col>
  22. <el-col :span="24" class="leftDown">
  23. <el-image :src="squareImage"></el-image>
  24. <el-col :span="24" class="jobname">
  25. {{ detail.uname }}
  26. </el-col>
  27. </el-col>
  28. </el-col>
  29. <el-col :span="21" class="right">
  30. <el-col :span="24" class="date">
  31. <i class="el-icon-user icon"></i>
  32. <span>文章发表于{{ detail.meta | getDate }}</span>
  33. <span>1楼</span>
  34. </el-col>
  35. <el-col :span="24" class="info">
  36. <p v-html="detail.content"></p>
  37. </el-col>
  38. <el-col :span="24" class="jubao">
  39. <span>举报</span>
  40. </el-col>
  41. </el-col>
  42. </el-col>
  43. <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
  44. <el-col :span="3" class="left">
  45. <el-col :span="24" class="leftTop">
  46. 会员名称
  47. </el-col>
  48. <el-col :span="24" class="leftDown">
  49. <el-image :src="squareImage"></el-image>
  50. <el-col :span="24" class="jobname">
  51. {{ item.uname }}
  52. </el-col>
  53. </el-col>
  54. </el-col>
  55. <el-col :span="21" class="right">
  56. <el-col :span="24" class="date">
  57. <i class="el-icon-user icon"></i>
  58. <span>评论发布于{{ item.meta | getDate }}</span>
  59. <span>{{ index + 2 }}楼</span>
  60. </el-col>
  61. <el-col :span="24" class="info">
  62. <p v-html="item.content"></p>
  63. </el-col>
  64. <el-col :span="24" class="jubao">
  65. <span>举报</span>
  66. </el-col>
  67. </el-col>
  68. </el-col>
  69. </el-col>
  70. <el-col :span="24" class="twoPage">
  71. <page :total="total" :limit="limit" position="right" @query="search"></page>
  72. </el-col>
  73. <el-col :span="24" class="twoInput">
  74. <el-col :span="3" class="left"> </el-col>
  75. <el-col :span="21" class="right">
  76. <el-col :span="24" class="waneditor">
  77. <wang-editor v-model="form.content" ref="editor"></wang-editor>
  78. </el-col>
  79. <el-col :span="24" class="btn">
  80. <el-button type="primary" @click="submit">发表评论</el-button>
  81. </el-col>
  82. </el-col>
  83. </el-col>
  84. </el-col>
  85. </el-col>
  86. </div>
  87. </el-row>
  88. </div>
  89. </template>
  90. <script>
  91. import wangEditor from '@/components/wang-editor.vue';
  92. import page from '@/components/pagination.vue';
  93. import { mapState, createNamespacedHelpers } from 'vuex';
  94. const { mapActions: comment } = createNamespacedHelpers('comment');
  95. const { mapActions: news } = createNamespacedHelpers('news');
  96. export default {
  97. name: 'semDetail',
  98. props: {},
  99. components: { page, wangEditor },
  100. data: () => ({
  101. gongqiuImage: require('@/assets/live/111.png'),
  102. squareImage: require('@/assets/live/222.png'),
  103. detail: {},
  104. list: [{ name: 'dsadas' }],
  105. total: 0,
  106. form: {},
  107. inputInfo: '',
  108. limit: 10,
  109. }),
  110. created() {
  111. this.search();
  112. this.searchinfo();
  113. },
  114. computed: {
  115. id() {
  116. return this.$route.query.id;
  117. },
  118. ...mapState(['user']),
  119. pageTitle() {
  120. return `${this.$route.meta.title}`;
  121. },
  122. },
  123. metaInfo() {
  124. return { title: this.$route.meta.title };
  125. },
  126. methods: {
  127. ...news(['fetch']),
  128. ...comment({ commentquery: 'query', commentCreate: 'create', commentUpdate: 'update' }),
  129. async searchinfo() {
  130. const res = await this.fetch(this.id);
  131. this.$set(this, `detail`, res.data);
  132. },
  133. async search({ skip = 0, limit = this.limit, newsid = this.id } = { skip: 0, limit: this.limit }) {
  134. let res = await this.commentquery({ skip, limit, newsid });
  135. console.log(res);
  136. this.$set(this, `list`, res.data);
  137. this.$set(this, `total`, res.total);
  138. },
  139. async submit() {
  140. this.form.newsid = this.id;
  141. this.form.uid = this.user.uid;
  142. let data = this.form;
  143. let res = await this.commentCreate(data);
  144. console.log(res);
  145. this.$checkRes(res, '评论成功', '评论失败');
  146. this.search();
  147. },
  148. },
  149. filters: {
  150. getDate(meta) {
  151. let createdAt = _.get(meta, `createdAt`);
  152. let date = new Date(createdAt)
  153. .toLocaleDateString()
  154. .replace('/', '-')
  155. .replace('/', '-');
  156. return date;
  157. },
  158. },
  159. };
  160. </script>
  161. <style lang="less" scoped>
  162. .w_1200 {
  163. width: 80%;
  164. margin: 0 auto;
  165. }
  166. .main {
  167. float: left;
  168. width: 100%;
  169. min-height: 600px;
  170. margin: 30px 0;
  171. }
  172. .main .one {
  173. float: left;
  174. width: 100%;
  175. height: 160px;
  176. margin: 0 0 30px 0;
  177. }
  178. .main .two {
  179. float: left;
  180. width: 100%;
  181. }
  182. .main .two .twoTop {
  183. float: left;
  184. width: 100%;
  185. height: 60px;
  186. }
  187. .main .two .twoTop .left {
  188. float: left;
  189. height: 60px;
  190. line-height: 50px;
  191. text-align: center;
  192. font-size: 18px;
  193. color: #00316e;
  194. background: #a5d2f5;
  195. border-bottom: 10px solid #044b79;
  196. }
  197. .main .two .twoTop .right {
  198. float: left;
  199. height: 60px;
  200. line-height: 50px;
  201. padding: 0 15px;
  202. font-size: 20px;
  203. color: #023658;
  204. border-bottom: 10px solid #5096d2;
  205. }
  206. .main .two .twoInfo {
  207. float: left;
  208. width: 100%;
  209. }
  210. .main .two .twoInfo .left {
  211. background: #5096d2;
  212. border-bottom: 10px solid #044b79;
  213. }
  214. .main .two .twoInfo .left .leftTop {
  215. height: 60px;
  216. line-height: 60px;
  217. text-align: center;
  218. color: #fff;
  219. font-size: 22px;
  220. border-bottom: 1px dashed #ccc;
  221. }
  222. .main .two .twoInfo .left .leftDown {
  223. height: 420px;
  224. }
  225. .main .two .twoInfo .left .leftDown .el-image {
  226. margin: 40px 18px;
  227. width: auto;
  228. height: auto;
  229. max-width: 100%;
  230. max-height: 100%;
  231. }
  232. .main .two .twoInfo .left .leftDown .jobname {
  233. text-align: center;
  234. font-size: 22px;
  235. color: #fffcae;
  236. }
  237. .main .two .twoInfo .right {
  238. padding: 0 20px;
  239. }
  240. .main .two .twoInfo .right .date {
  241. padding: 0 20px;
  242. height: 60px;
  243. line-height: 60px;
  244. border-bottom: 1px dashed #ccc;
  245. }
  246. .main .two .twoInfo .right .date .icon {
  247. font-size: 30px;
  248. color: #b6dd59;
  249. }
  250. .main .two .twoInfo .right .date span:nth-child(2) {
  251. font-size: 20px;
  252. padding: 0px 10px;
  253. position: relative;
  254. top: -2px;
  255. }
  256. .main .two .twoInfo .right .date span:last-child {
  257. font-size: 20px;
  258. float: right;
  259. }
  260. .main .two .twoInfo .right .info {
  261. height: 300px;
  262. border: 2px solid #044b79;
  263. border-radius: 10px;
  264. margin: 30px 0;
  265. padding: 20px;
  266. }
  267. .main .two .twoInfo .right .info p {
  268. font-size: 20px;
  269. overflow: auto;
  270. text-overflow: ellipsis;
  271. -webkit-line-clamp: 8;
  272. word-break: break-all;
  273. display: -webkit-box;
  274. -webkit-box-orient: vertical;
  275. line-height: 33px;
  276. height: 260px;
  277. }
  278. .main .two .twoInfo .right .jubao {
  279. height: 70px;
  280. line-height: 60px;
  281. border-top: 1px dashed #ff8b0f;
  282. border-bottom: 10px solid #5096d2;
  283. }
  284. .main .two .twoInfo .right .jubao span {
  285. float: right;
  286. color: #ff0000;
  287. font-size: 20px;
  288. }
  289. .main .two .twoPage {
  290. margin: 20px 0;
  291. }
  292. .main .two .twoInput {
  293. height: 270px;
  294. border: 2px solid #5096d2;
  295. }
  296. .main .two .twoInput .left {
  297. height: 266px;
  298. background-color: #5096d2;
  299. }
  300. .main .two .twoInput .right {
  301. padding: 20px 20px 0 20px;
  302. }
  303. /deep/.main .two .twoInput .right .waneditor .w-e-text-container {
  304. height: 140px !important;
  305. }
  306. .main .two .twoInput .right .btn {
  307. margin: 10px 0;
  308. }
  309. /deep/.main .two .twoInput .right .btn .el-button {
  310. margin: 10px 0;
  311. }
  312. </style>