HotActicle.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <template>
  2. <div class="hot-article">
  3. <el-card class="popular-card">
  4. <div slot="header" class="popular-header">
  5. <img src="../../assets/img/hot-article.jpg" alt="hot-crowd" class="popular-header-img"/>
  6. <span class="popular-header-title">热门文章</span>
  7. <el-button style="float: right; padding: 3px 0;line-height: 25px" type="text" @click="goToMore()">>></el-button>
  8. </div>
  9. <div class="popular-list">
  10. <el-row class="popular-list-item" v-for="(item,index) in articleArr" :key="item.id" v-if="index<7">
  11. <el-col :span="24">
  12. <img :src="item.photoUrl" alt="logo-project" class="pull-left project-logo-img">
  13. <div style="margin-left: 55px">
  14. <div class="list-item-title" @click="gotoArticle(item)">
  15. {{item.name}}
  16. </div>
  17. <div class="project-people-reading">
  18. {{item.reading}}阅读
  19. </div>
  20. </div>
  21. </el-col>
  22. </el-row>
  23. </div>
  24. </el-card>
  25. </div>
  26. </template>
  27. <script>
  28. import Http from '@/js/http.js'
  29. export default {
  30. name: 'HotArticle',
  31. props:['articleArr'],
  32. data(){
  33. return {
  34. }
  35. },
  36. methods:{
  37. gotoArticle(item){
  38. Http.get(`/api/technical/updateranking/${item.id}`).then(()=>{
  39. this.$emit('refreshHotArticle');
  40. window.open(item.articlesUrl);
  41. });
  42. },
  43. goToMore(){
  44. this.$router.push({
  45. name: 'TechnologyMore',
  46. })
  47. },
  48. },
  49. mounted() {
  50. }
  51. }
  52. </script>
  53. <style lang="scss">
  54. @import "../../style/main";
  55. .popular-card {
  56. margin-bottom: 5px!important;
  57. }
  58. .popular-header .el-card__header{
  59. border-bottom: 2px solid rgba(0,117,203,1) !important;
  60. }
  61. .popular-card .el-card__body{
  62. padding: 0 !important;
  63. }
  64. .popular-header {
  65. height: 20px;
  66. vertical-align:middle;
  67. }
  68. .popular-header-title {
  69. display: inline-block;
  70. line-height: 20px;
  71. vertical-align:middle;
  72. }
  73. .popular-header-img {
  74. height: 25px;
  75. width: 25px;
  76. vertical-align:middle;
  77. }
  78. .popular-list {
  79. .popular-list-item {
  80. padding: 4px 10px;
  81. border-bottom: 1px solid #ccc !important;
  82. .list-item-title{
  83. cursor:pointer;
  84. font-size:14px;
  85. font-family:Source Han Sans CN;
  86. font-weight:400;
  87. color:rgba(0,0,0,1);
  88. overflow: hidden;
  89. text-overflow:ellipsis; //溢出用省略号显示
  90. white-space:nowrap; //溢出不换行
  91. }
  92. .list-item-info{
  93. font-size:14px;
  94. font-family:Adobe Heiti Std;
  95. font-weight:normal;
  96. color:rgba(153,153,153,1);
  97. overflow:hidden; //超出的文本隐藏
  98. text-overflow:ellipsis; //溢出用省略号显示
  99. white-space:nowrap; //溢出不换行
  100. }
  101. .project-logo-img {
  102. width: 44px;
  103. height: 44px;
  104. display: inline-block;
  105. margin: 2px 0;
  106. }
  107. .project-people-reading {
  108. font-size:16px;
  109. font-family:Roboto;
  110. font-weight:400;
  111. color:$--color-primary;
  112. }
  113. }
  114. }
  115. </style>