PopularProject.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="popular-card">
  3. <el-card>
  4. <div slot="header" class="popular-header">
  5. <img src="../../assets/img/popular-project.png" alt="popular-project" 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 v-if="!hotCrowdTestProjectVOs.length" style="text-align: center;padding: 5px 0"><span>暂无项目</span></div>
  10. <div class="popular-list" v-else>
  11. <el-row class="popular-list-item" v-for="item in hotCrowdTestProjectVOs" :key="item.id">
  12. <el-col :span="19">
  13. <img :src="logo_background" alt="logo-project" class="pull-left project-logo-img">
  14. <div style="margin-left: 55px; cursor: pointer;" @click="goToProjectDetail(item.code)">
  15. <div class="list-item-title">
  16. {{item.name}}
  17. </div>
  18. <div class="list-item-info">
  19. {{item.description}}
  20. </div>
  21. </div>
  22. </el-col>
  23. <el-col :span="5">
  24. <div class="project-people-number">
  25. <span v-if="item.joinCount > 10000">{{item.joinCount > 10000 ? Math.floor(item.joinCount/10000) + 'w+' : item.joinCount}}人</span>
  26. <span v-else>{{item.joinCount > 1000 ? Math.floor(item.joinCount/1000) + 'k+' : item.joinCount}}人</span>
  27. </div>
  28. </el-col>
  29. </el-row>
  30. </div>
  31. </el-card>
  32. </div>
  33. </template>
  34. <script>
  35. import {CONFIG} from '../../config/index'
  36. export default {
  37. name: 'PopularProject',
  38. props:['hotCrowdTestProjectVOs'],
  39. data(){
  40. return{
  41. logo_background:CONFIG.logo_background,
  42. logo_transparent:CONFIG.logo_transparent
  43. }
  44. },
  45. methods:{
  46. goToMore(){
  47. console.log("goToMoreProject");
  48. this.$router.push({
  49. name: 'PopularProjectAndTaskList',
  50. params: {type: "project"}
  51. })
  52. },
  53. goToProjectDetail (id) {
  54. this.$router.push({name: 'Project', params: {projectId: id}})
  55. }
  56. }
  57. }
  58. </script>
  59. <style lang="scss">
  60. @import "../../style/main";
  61. .popular-card {
  62. margin-bottom: 15px;
  63. }
  64. .popular-header .el-card__header{
  65. border-bottom: 2px solid rgba(0,117,203,1) !important;
  66. }
  67. .popular-card .el-card__body{
  68. padding: 0 !important;
  69. }
  70. .popular-header {
  71. height: 15px;
  72. vertical-align:middle;
  73. }
  74. .popular-header-title {
  75. display: inline-block;
  76. line-height: 20px;
  77. vertical-align:middle;
  78. }
  79. .popular-header-img {
  80. height: 25px;
  81. width: 25px;
  82. vertical-align:middle;
  83. }
  84. .popular-list {
  85. .popular-list-item {
  86. padding: 10px 10px;
  87. border-bottom: 1px solid #ccc !important;
  88. .list-item-title{
  89. font-size:14px;
  90. font-family:Source Han Sans CN;
  91. font-weight:400;
  92. color:rgba(0,0,0,1);
  93. overflow: hidden;
  94. text-overflow:ellipsis; //溢出用省略号显示
  95. white-space:nowrap; //溢出不换行
  96. }
  97. .list-item-info{
  98. font-size:14px;
  99. font-family:Adobe Heiti Std;
  100. font-weight:normal;
  101. color:rgba(153,153,153,1);
  102. overflow:hidden; //超出的文本隐藏
  103. text-overflow:ellipsis; //溢出用省略号显示
  104. white-space:nowrap; //溢出不换行
  105. }
  106. .project-logo-img {
  107. width: 44px;
  108. height: 44px;
  109. display: inline-block;
  110. margin: 2px 0;
  111. }
  112. .project-people-number {
  113. font-size:16px;
  114. font-family:Roboto;
  115. font-weight:400;
  116. color:$--color-primary;
  117. line-height: 48px;
  118. }
  119. }
  120. }
  121. </style>