ArtPanel.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <div class="ArtPanel-group-box" :style="{height:height}">
  3. <div class="group-title">
  4. {{ title }}
  5. <el-link @click="showMoreArt(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="art_list_block">
  9. <div
  10. v-for="(item, index) in dataList"
  11. :key="index"
  12. class="item"
  13. @click="showDetail(item)"
  14. >
  15. <div class="icon">
  16. <i class="el-icon-s-comment" />
  17. </div>
  18. <div class="info">
  19. <div class="lf clearfix">
  20. <h4>{{ item.artTitle }}</h4>
  21. </div>
  22. <div class="rt">
  23. <div class="el-tag-time">
  24. <span style="padding-left:0;color:#c4c1c1;font-size: 10px;">{{ item.issuedAt }}</span>
  25. </div>
  26. <div class="el-tag-art">
  27. <el-tag v-if="item.artCatId>=10 && item.artCatId <20" size="mini" class="custom-tag tag-1">平安医院</el-tag>
  28. <el-tag v-if="item.artCatId>=20 && item.artCatId <30" size="mini" class="custom-tag tag-2">质量医院</el-tag>
  29. <el-tag v-if="item.artCatId>=31 && item.artCatId <40" size="mini" class="custom-tag tag-3">满意医院</el-tag>
  30. <el-tag v-if="item.artCatId>=40 && item.artCatId <50" size="mini" class="custom-tag tag-4">智慧医院</el-tag>
  31. <el-tag v-if="item.artCatId>=50 && item.artCatId <60" size="mini" class="custom-tag tag-5">健康医院</el-tag>
  32. <el-tag v-if="item.artCatId>=60 && item.artCatId <69" size="mini" class="custom-tag tag-6">节约型医院</el-tag>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </vuescroll>
  39. <ArtDetail ref="ArtDetail" />
  40. </div>
  41. </template>
  42. <script>
  43. import vuescroll from 'vuescroll'
  44. import { getRecentArtByList } from '@/api/system/artApi'
  45. import ArtDetail from '@/views/system/art/components/ArtDetail'
  46. export default {
  47. name: 'ArtPanel',
  48. components: {
  49. vuescroll,
  50. ArtDetail
  51. },
  52. props: {
  53. title: {
  54. type: [String],
  55. default: '最新动态'
  56. },
  57. artCatId: {
  58. type: [String, Number],
  59. default: undefined
  60. },
  61. artCatList: {
  62. type: [String, Number],
  63. default: undefined
  64. },
  65. more: {
  66. type: [String],
  67. default: undefined
  68. },
  69. height: {
  70. type: [String],
  71. default: 'calc(100vh - 85px)'
  72. }
  73. },
  74. data() {
  75. return {
  76. ops: {
  77. bar: {
  78. keepShow: false,
  79. background: 'rgba(144, 147, 153, 0.4)',
  80. onlyShowBarOnScroll: false
  81. }
  82. },
  83. listLoading: false,
  84. dataList: [],
  85. conditions: {
  86. artCatId: this.artCatId,
  87. artCatList: this.artCatList
  88. }
  89. }
  90. },
  91. mounted() {
  92. this.getData()
  93. },
  94. methods: {
  95. getData() {
  96. getRecentArtByList(this.conditions).then((resp) => {
  97. const { code, msg, data } = resp
  98. if (code === 200) {
  99. this.dataList = data
  100. } else {
  101. this.$message.error(msg)
  102. }
  103. }).catch((error) => {
  104. console.log(error)
  105. })
  106. },
  107. showMoreArt(data, title) {
  108. let path = '/hos/news/index'
  109. if (this.more) {
  110. path = this.more
  111. }
  112. this.$router.push({
  113. path
  114. })
  115. },
  116. showDetail(item) {
  117. const { artId } = item
  118. this.$refs.ArtDetail.showModel(artId)
  119. }
  120. }
  121. }
  122. </script>
  123. <style lang="scss" scoped>
  124. .ArtPanel-group-box {
  125. width: calc(100% - 15px);
  126. border-top: 4px solid #1F3C51;
  127. background-color: #0C3242;
  128. border-radius: 5px 5px 0 0;
  129. padding: 15px;
  130. .group-title {
  131. font-size: 16px;
  132. color: #FFF;
  133. margin-bottom: 15px;
  134. font-weight: bold;
  135. .el-link {
  136. float: right;
  137. font-size: 14px;
  138. color: #C1C6C8;
  139. -webkit-text-fill-color: #C1C6C8;
  140. }
  141. }
  142. .group-content{
  143. height: 80%;
  144. overflow: auto;
  145. }
  146. .art_list_block{
  147. margin-top: 20px;
  148. .item{
  149. display: flex;
  150. justify-content: flex-start;
  151. line-height: 1;
  152. margin-bottom: 15px;
  153. position: relative;
  154. cursor: pointer;
  155. .info{
  156. width: 100%;
  157. .lf{
  158. float: left;
  159. }
  160. .rt{
  161. margin-top: 20px;
  162. .el-tag-time{
  163. text-align: left;
  164. float: left;
  165. }
  166. .el-tag-art{
  167. float: right;
  168. text-align: right;
  169. .custom-tag{
  170. color:#fff;
  171. border-color:#eaeaea;
  172. background-color:transparent;
  173. &.tag-1{color: #b97741;border-color:#b97741;}
  174. &.tag-2{color: #97cd38;border-color:#97cd38;}
  175. &.tag-3{color: #dc5a2c;border-color:#dc5a2c;}
  176. &.tag-4{color: #414ab9;border-color:#414ab9;}
  177. &.tag-5{color: #c13ac9;border-color:#c13ac9;}
  178. &.tag-6{color: #29c761;border-color:#29c761;}
  179. }
  180. }
  181. }
  182. }
  183. .tag{
  184. height: 24px;
  185. display: inline-block;
  186. position: absolute;
  187. right: 0;
  188. top: 0;
  189. padding: 0px 4px;
  190. line-height: 24px;
  191. font-size: 12px;
  192. color: #fff;
  193. border-radius: 4px;
  194. box-sizing: border-box;
  195. white-space: nowrap;
  196. border: 1px solid #d9d0c8;
  197. &.none{
  198. background-color: transparent;
  199. border-color: transparent;
  200. }
  201. }
  202. p,h4{
  203. margin: 0;
  204. font-size: 14px;
  205. }
  206. p{
  207. padding-top: 6px;
  208. font-size: 8px;
  209. color: #f5f5f5;
  210. }
  211. h4{
  212. .status{
  213. font-size: 12px;
  214. }
  215. }
  216. .custom-tag{
  217. color:#fff;
  218. border-color:#eaeaea;
  219. background-color:transparent;
  220. &.tag-2{color: #b97741;border-color:#b97741;}
  221. &.tag-3{color: #97cd38;border-color:#97cd38;}
  222. &.tag-4{color: #dc5a2c;border-color:#dc5a2c;}
  223. &.tag-5{color: #414ab9;border-color:#414ab9;}
  224. &.tag-6{color: #c13ac9;border-color:#c13ac9;}
  225. &.tag-7{color: #29c761;border-color:#29c761;}
  226. }
  227. .icon{
  228. width: 45px;
  229. height: 45px;
  230. font-size: 26px;
  231. }
  232. }
  233. }
  234. }
  235. </style>