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.

index.vue 3.2 kB

2 years ago
2 years ago
2 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <div>
  3. <div>
  4. <SquareTop :static="true" :staticBannerData="staticSquareBanners" :staticSwiperData="staticSquarePreferredRepos">
  5. </SquareTop>
  6. </div>
  7. <div class="ui container">
  8. <SearchBar :static="true" :staticTopicsData="staticSquareTopics" ref="searchBarRef" type="square" :sort="``"
  9. :searchValue="reposListQurey" :topic="``" @change="searchBarChange"></SearchBar>
  10. </div>
  11. <div class="recommend-repos-c">
  12. <RecommendRepos :static="true" :staticSwiperData="staticSquareRecommendRepos"></RecommendRepos>
  13. </div>
  14. <div class="ui container">
  15. <div class="ui grid">
  16. <div class="computer only ui two wide computer column">
  17. <ReposFilters ref="reposFiltersRef" @change="filtersChange"></ReposFilters>
  18. </div>
  19. <div class="ui sixteen wide mobile twelve wide tablet ten wide computer column">
  20. <ReposList ref="reposListRef" :sort="reposListSortType" :q="reposListQurey" :topic="reposListTopic">
  21. </ReposList>
  22. </div>
  23. <div class="computer only ui four wide computer column">
  24. <div>
  25. <ActiveUsers></ActiveUsers>
  26. </div>
  27. <div class="active-org-c">
  28. <ActiveOrgs></ActiveOrgs>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </template>
  35. <script>
  36. import SquareTop from '../components/SquareTop.vue';
  37. import SearchBar from '../components/SearchBar.vue';
  38. import RecommendRepos from '../components/RecommendRepos.vue';
  39. import ReposFilters from '../components/ReposFilters.vue';
  40. import ReposList from '../components/ReposList.vue';
  41. import ActiveUsers from '../components/ActiveUsers.vue';
  42. import ActiveOrgs from '../components/ActiveOrgs.vue';
  43. const staticSquareBanners = JSON.stringify(window.staticSquareBanners || []);
  44. const staticSquarePreferredRepos = window.staticSquarePreferredRepos || [];
  45. const staticSquareTopics = JSON.stringify(window.staticSquareTopics || []);
  46. const staticSquareRecommendRepos = window.staticSquareRecommendRepos || [];
  47. export default {
  48. data() {
  49. return {
  50. reposListSortType: 'mostpopular',
  51. reposListQurey: '',
  52. reposListTopic: '',
  53. staticSquareBanners: staticSquareBanners,
  54. staticSquarePreferredRepos: staticSquarePreferredRepos,
  55. staticSquareTopics: staticSquareTopics,
  56. staticSquareRecommendRepos: staticSquareRecommendRepos,
  57. };
  58. },
  59. components: {
  60. SquareTop,
  61. SearchBar,
  62. RecommendRepos,
  63. ReposFilters,
  64. ReposList,
  65. ActiveUsers,
  66. ActiveOrgs,
  67. },
  68. methods: {
  69. filtersChange(condition) {
  70. this.reposListSortType = condition.key;
  71. this.search();
  72. },
  73. searchBarChange(params) {
  74. this.reposListQurey = params.q || '';
  75. this.reposListTopic = params.topic || '';
  76. this.search();
  77. },
  78. search() {
  79. this.$nextTick(() => {
  80. this.$refs.reposListRef.search();
  81. });
  82. }
  83. },
  84. mounted() {
  85. this.$nextTick(() => {
  86. this.$refs.searchBarRef.setDefaultSearch({
  87. q: '',
  88. topic: '',
  89. });
  90. this.search();
  91. });
  92. },
  93. beforeDestroy() { },
  94. };
  95. </script>
  96. <style scoped lang="less">
  97. .recommend-repos-c {
  98. margin: 0 0 54px;
  99. }
  100. .active-org-c {
  101. margin-top: 32px;
  102. }
  103. </style>