You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Contributors.vue 3.6 kB

3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div class="ui container">
  3. <div class="row git-user-content">
  4. <h3 class="ui header">
  5. <div class="ui breadcrumb">
  6. <a class="section" href="/">代码</a>
  7. <div class="divider"> / </div>
  8. <div class="active section" >贡献者({{totalNum}})</div>
  9. </div>
  10. </h3>
  11. <div class="ui horizontal relaxed list">
  12. <div class="item user-list-item" v-for="(contributor,i) in contributors_list_page" >
  13. <a v-if="contributor.user_name" :href="AppSubUrl +'/'+ contributor.user_name"><img class="ui avatar s16 image js-popover-card" :src="contributor.rel_avatar_link"></a>
  14. <a v-else :href="'mailto:' + contributor.email "><img class="ui avatar s16 image js-popover-card" :avatar="contributor.email"></a>
  15. <div class="content">
  16. <div class="header" >
  17. <a v-if="contributor.user_name" :href="AppSubUrl +'/'+ contributor.user_name">{{contributor.user_name}}</a>
  18. <a v-else :href="'mailto:' + contributor.email ">{{contributor.email}}</a>
  19. </div>
  20. <span class="commit-btn">Commits: {{contributor.commit_cnt}}</span>
  21. </div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="ui container" style="margin-top:50px;text-align:center">
  26. <el-pagination
  27. background
  28. @current-change="handleCurrentChange"
  29. :current-page="currentPage"
  30. :page-size="pageSize"
  31. layout="total, prev, pager, next"
  32. :total="totalNum">
  33. </el-pagination>
  34. </div>
  35. </div>
  36. </template>
  37. <script>
  38. const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
  39. export default {
  40. data() {
  41. return {
  42. url:'',
  43. contributors_list:[],
  44. contributors_list_page:[],
  45. currentPage:1,
  46. pageSize:50,
  47. totalNum:0,
  48. AppSubUrl:AppSubUrl
  49. };
  50. },
  51. methods: {
  52. getContributorsList(){
  53. this.$axios.get(this.url+'/contributors/list').then((res)=>{
  54. this.contributors_list = res.data.contributor_info
  55. this.totalNum = this.contributors_list.length
  56. this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
  57. })
  58. },
  59. handleCurrentChange(val){
  60. this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
  61. },
  62. },
  63. computed:{
  64. },
  65. watch: {
  66. },
  67. created(){
  68. this.url=document.head.querySelector("[property~='og:url'][content]").content
  69. this.getContributorsList()
  70. },
  71. updated(){
  72. if(document.querySelectorAll('img[avatar]').length!==0){
  73. window.LetterAvatar.transform()
  74. }
  75. }
  76. };
  77. </script>
  78. <style scoped>
  79. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  80. background-color: #5bb973;
  81. color: #FFF;
  82. }
  83. /deep/ .el-pagination.is-background .el-pager li.active {
  84. color: #fff;
  85. cursor: default;
  86. }
  87. /deep/ .el-pagination.is-background .el-pager li:hover {
  88. color: #5bb973;
  89. }
  90. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  91. color: #5bb973;
  92. }
  93. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  94. background-color: #5bb973;
  95. color: #FFF;
  96. }
  97. </style>