ArtPanel.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <div class="ArtPanel-group-box" :style="{height:height}">
  3. <div class="group-title">
  4. {{ title }}
  5. <el-link @click="showMoreArtData(dataList,'最新动态');">更多 <i class="el-icon-caret-right" /></el-link>
  6. </div>
  7. <vuescroll v-if="dataList" :ops="ops" style="height: calc(100% - 40px)">
  8. <div class="task-management">
  9. <div
  10. v-for="(item, index) in dataList"
  11. :key="index"
  12. class="item"
  13. @click="showNewsDetail(item)"
  14. >
  15. <div class="icon">
  16. <i class="el-icon-s-comment" />
  17. </div>
  18. <div class="info">
  19. <span class="tag ">{{ item.artCatTitle }}</span>
  20. <h4>{{ item.artTitle }}</h4>
  21. <p>
  22. <span style="padding-left:0;color:#c4c1c1;font-size: 10px;">{{ item.issuedAt }}</span>
  23. </p>
  24. </div>
  25. </div>
  26. </div>
  27. </vuescroll>
  28. <ArtDetail ref="NewsDetail" />
  29. </div>
  30. </template>
  31. <script>
  32. import vuescroll from 'vuescroll'
  33. import { getRecentArtByList } from '@/api/system/artApi'
  34. import ArtDetail from '@/views/system/art/artDetail'
  35. export default {
  36. name: 'ArtPanel',
  37. components: {
  38. vuescroll,
  39. ArtDetail
  40. },
  41. props: {
  42. title: {
  43. type: [String],
  44. default: '最新动态'
  45. },
  46. more: {
  47. type: [String],
  48. default: undefined
  49. },
  50. height: {
  51. type: [String],
  52. default: 'calc(100vh - 85px)'
  53. }
  54. },
  55. data() {
  56. return {
  57. ops: {
  58. bar: {
  59. keepShow: false,
  60. background: 'rgba(144, 147, 153, 0.4)',
  61. onlyShowBarOnScroll: false
  62. }
  63. },
  64. listLoading: false,
  65. dataList: [],
  66. conditions: {}
  67. }
  68. },
  69. mounted() {
  70. this.getData()
  71. },
  72. methods: {
  73. getData() {
  74. getRecentArtByList(this.conditions).then((resp) => {
  75. const { code, msg, data } = resp
  76. if (code === 200) {
  77. this.dataList = data
  78. } else {
  79. this.$message.error(msg)
  80. }
  81. }).catch((error) => {
  82. console.log(error)
  83. })
  84. },
  85. showMoreArtData(data, title) {
  86. let path = '/hos/news/index'
  87. if (this.more) {
  88. path = this.more
  89. }
  90. this.$router.push({
  91. path
  92. })
  93. },
  94. showNewsDetail(item) {
  95. const { artId } = item
  96. this.$refs.NewsDetail.showModel(artId)
  97. }
  98. }
  99. }
  100. </script>
  101. <style lang="scss" scoped>
  102. .ArtPanel-group-box {
  103. width: calc(100% - 15px);
  104. background-color: #0C3242;
  105. border-radius: 5px 5px 0 0;
  106. padding: 15px;
  107. .group-title {
  108. font-size: 16px;
  109. color: #FFF;
  110. margin-bottom: 15px;
  111. font-weight: bold;
  112. .el-link {
  113. float: right;
  114. font-size: 14px;
  115. color: #C1C6C8;
  116. -webkit-text-fill-color: #C1C6C8;
  117. }
  118. }
  119. .group-content{
  120. height: 80%;
  121. overflow: auto;
  122. }
  123. .task-management{
  124. margin-top: 20px;
  125. .item{
  126. display: flex;
  127. justify-content: flex-start;
  128. line-height: 1;
  129. margin-bottom: 15px;
  130. position: relative;
  131. cursor: pointer;
  132. .tag{
  133. height: 24px;
  134. display: inline-block;
  135. position: absolute;
  136. right: 0;
  137. top: 0;
  138. padding: 0px 4px;
  139. line-height: 24px;
  140. font-size: 12px;
  141. color: #fff;
  142. border-radius: 4px;
  143. box-sizing: border-box;
  144. white-space: nowrap;
  145. border: 1px solid #d9d0c8;
  146. &.none{
  147. background-color: transparent;
  148. border-color: transparent;
  149. }
  150. }
  151. p,h4{
  152. margin: 0;
  153. font-size: 14px;
  154. }
  155. p{
  156. padding-top: 6px;
  157. font-size: 8px;
  158. color: #f5f5f5;
  159. }
  160. h4{
  161. .status{
  162. font-size: 12px;
  163. }
  164. }
  165. .icon{
  166. width: 45px;
  167. height: 45px;
  168. font-size: 26px;
  169. }
  170. }
  171. }
  172. }
  173. </style>