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.4 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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">{{$i18n['code']}}</a>
  7. <div class="divider"> / </div>
  8. <div class="active section" >{{$i18n['contributors']}}&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 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. url_infor:'',
  44. href_:'',
  45. contributors_list:[],
  46. contributors_list_page:[],
  47. currentPage:1,
  48. pageSize:50,
  49. totalNum:0,
  50. AppSubUrl:AppSubUrl
  51. };
  52. },
  53. methods: {
  54. getContributorsList(){
  55. this.$axios.get(this.url+'/list?'+this.url_infor).then((res)=>{
  56. this.contributors_list = res.data.contributor_info
  57. this.totalNum = this.contributors_list.length
  58. this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
  59. })
  60. },
  61. handleCurrentChange(val){
  62. this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
  63. },
  64. },
  65. computed:{
  66. },
  67. watch: {
  68. },
  69. created(){
  70. this.$i18n = window.i18n;
  71. const url = window.location.pathname;
  72. this.url = url;
  73. let strIndex = this.url.indexOf("contributors")
  74. this.url_code = this.url.substr(0,strIndex)
  75. this.href_ = window.location.href;
  76. let index = this.href_.indexOf("?")
  77. this.url_infor = this.href_.substring(index+1,this.href_.length)
  78. this.getContributorsList()
  79. },
  80. updated(){
  81. if(document.querySelectorAll('img[avatar]').length!==0){
  82. window.LetterAvatar.transform()
  83. }
  84. }
  85. };
  86. </script>