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 4.0 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
3 years ago
2 years ago
3 years ago
2 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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="url_code">代码</a>
  7. <div class="divider"> / </div>
  8. <div class="active section" >贡献者&nbsp;({{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 class="username" v-if="contributor.user_name" :href="AppSubUrl +'/'+ contributor.user_name">
  18. <img src="/images/gold.png" width="24" v-show="contributor.commit_cnt > 1000"/>
  19. <img src="/images/silver.png" width="24" v-show="contributor.commit_cnt > 500 && contributor.commit_cnt < 1000"/>
  20. <img src="/images/bronze.png" width="24" v-show="contributor.commit_cnt > 50 && contributor.commit_cnt < 500"/>
  21. {{contributor.user_name}}</a>
  22. <a v-else :href="'mailto:' + contributor.email ">{{contributor.email}}</a>
  23. </div>
  24. <span class="commit-btn">Commits: {{contributor.commit_cnt}}</span>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="ui container" style="margin-top:50px;text-align:center">
  30. <el-pagination
  31. background
  32. @current-change="handleCurrentChange"
  33. :current-page="currentPage"
  34. :page-size="pageSize"
  35. layout="total, prev, pager, next"
  36. :total="totalNum">
  37. </el-pagination>
  38. </div>
  39. </div>
  40. </template>
  41. <style>
  42. .username{
  43. display: flex;
  44. align-items: center;
  45. img{
  46. margin-right: 10px;
  47. }
  48. }</style>
  49. <script>
  50. const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
  51. export default {
  52. data() {
  53. return {
  54. url:'',
  55. url_infor:'',
  56. href_:'',
  57. contributors_list:[],
  58. contributors_list_page:[],
  59. currentPage:1,
  60. pageSize:50,
  61. totalNum:0,
  62. AppSubUrl:AppSubUrl
  63. };
  64. },
  65. methods: {
  66. getContributorsList(){
  67. this.$axios.get(this.url+'/list?'+this.url_infor).then((res)=>{
  68. this.contributors_list = res.data.contributor_info
  69. this.totalNum = this.contributors_list.length
  70. this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
  71. })
  72. },
  73. handleCurrentChange(val){
  74. this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
  75. },
  76. },
  77. computed:{
  78. },
  79. watch: {
  80. },
  81. created(){
  82. const url = window.location.pathname;
  83. this.url = url;
  84. let strIndex = this.url.indexOf("contributors")
  85. this.url_code = this.url.substr(0,strIndex)
  86. this.href_ = window.location.href;
  87. let index = this.href_.indexOf("?")
  88. this.url_infor = this.href_.substring(index+1,this.href_.length)
  89. this.getContributorsList()
  90. },
  91. updated(){
  92. if(document.querySelectorAll('img[avatar]').length!==0){
  93. window.LetterAvatar.transform()
  94. }
  95. }
  96. };
  97. </script>