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

4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
3 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <div class="ui container">
  3. <div class="row git-user-content" >
  4. <h3 class="ui header">
  5. <div class="ui breadcrumb" id ='contri'>
  6. <a class="section" :href="url_code"> {{$t('message.code')}}</a>
  7. <div class="divider"> / </div>
  8. <div class="active section" >{{$t('message.contributor')}} &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 type="text/javascript">
  38. import enLocale from 'element-ui/lib/locale/lang/en'
  39. import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
  40. import locale from 'element-ui/lib/locale'
  41. const {AppSubUrl, StaticUrlPrefix, csrf} = window.config;
  42. export default {
  43. data() {
  44. return {
  45. url:'',
  46. url_infor:'',
  47. href_:'',
  48. contributors_list:[],
  49. contributors_list_page:[],
  50. currentPage:1,
  51. pageSize:50,
  52. totalNum:0,
  53. AppSubUrl:AppSubUrl,
  54. };
  55. },
  56. methods: {
  57. getContributorsList(){
  58. this.$axios.get(this.url+'/list?'+this.url_infor).then((res)=>{
  59. this.contributors_list = res.data.contributor_info
  60. this.totalNum = this.contributors_list.length
  61. this.contributors_list_page = this.contributors_list.slice(0,this.pageSize)
  62. })
  63. },
  64. handleCurrentChange(val){
  65. this.contributors_list_page = this.contributors_list.slice((val-1)*this.pageSize,val*this.pageSize)
  66. },
  67. getLang(){
  68. this.text_langName = document.getElementById("menutext_1").innerText
  69. if (this.text_langName == '简体中文'){
  70. this.$i18n.locale = 'zh'
  71. locale.use(zhLocale)
  72. }
  73. else if (this.text_langName == 'English'){
  74. this.$i18n.locale = 'en'
  75. locale.use(enLocale)
  76. }
  77. }
  78. },
  79. computed:{
  80. },
  81. watch: {
  82. },
  83. created(){
  84. console.log(this)
  85. const url = window.location.pathname;
  86. this.url = url;
  87. let strIndex = this.url.indexOf("contributors")
  88. this.url_code = this.url.substr(0,strIndex)
  89. this.href_ = window.location.href;
  90. let index = this.href_.indexOf("?")
  91. this.url_infor = this.href_.substring(index+1,this.href_.length)
  92. this.getContributorsList()
  93. this.text_langName=''
  94. this.getLang()
  95. },
  96. updated(){
  97. if(document.querySelectorAll('img[avatar]').length!==0){
  98. window.LetterAvatar.transform()
  99. }
  100. },
  101. mounted(){
  102. this.getLang()
  103. }
  104. };
  105. </script>
  106. <style scoped>
  107. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active {
  108. background-color: #5bb973;
  109. color: #FFF;
  110. }
  111. /deep/ .el-pagination.is-background .el-pager li.active {
  112. color: #fff;
  113. cursor: default;
  114. }
  115. /deep/ .el-pagination.is-background .el-pager li:hover {
  116. color: #5bb973;
  117. }
  118. /deep/ .el-pagination.is-background .el-pager li:not(.disabled):hover {
  119. color: #5bb973;
  120. }
  121. /deep/ .el-pagination.is-background .el-pager li:not(.disabled).active:hover {
  122. background-color: #5bb973;
  123. color: #FFF;
  124. }
  125. </style>