|
- <template>
- <div>
- <div>
- <SquareTop :static="true" :staticBannerData="staticSquareBanners" :staticSwiperData="staticSquarePreferredRepos">
- </SquareTop>
- </div>
- <div class="ui container">
- <SearchBar :static="true" :staticTopicsData="staticSquareTopics" ref="searchBarRef" type="square" :sort="``"
- :searchValue="reposListQurey" :topic="``" @change="searchBarChange"></SearchBar>
- </div>
- <div class="recommend-repos-c">
- <RecommendRepos :static="true" :staticSwiperData="staticSquareRecommendRepos"></RecommendRepos>
- </div>
- <div class="ui container">
- <div class="ui grid">
- <div class="computer only ui two wide computer column">
- <ReposFilters ref="reposFiltersRef" @change="filtersChange"></ReposFilters>
- </div>
- <div class="ui sixteen wide mobile twelve wide tablet ten wide computer column">
- <ReposList ref="reposListRef" :sort="reposListSortType" :q="reposListQurey" :topic="reposListTopic">
- </ReposList>
- </div>
- <div class="computer only ui four wide computer column">
- <div>
- <ActiveUsers></ActiveUsers>
- </div>
- <div class="active-org-c">
- <ActiveOrgs></ActiveOrgs>
- </div>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- import SquareTop from '../components/SquareTop.vue';
- import SearchBar from '../components/SearchBar.vue';
- import RecommendRepos from '../components/RecommendRepos.vue';
- import ReposFilters from '../components/ReposFilters.vue';
- import ReposList from '../components/ReposList.vue';
- import ActiveUsers from '../components/ActiveUsers.vue';
- import ActiveOrgs from '../components/ActiveOrgs.vue';
-
- const staticSquareBanners = JSON.stringify(window.staticSquareBanners || []);
- const staticSquarePreferredRepos = window.staticSquarePreferredRepos || [];
- const staticSquareTopics = JSON.stringify(window.staticSquareTopics || []);
- const staticSquareRecommendRepos = window.staticSquareRecommendRepos || [];
-
- export default {
- data() {
- return {
- reposListSortType: 'mostpopular',
- reposListQurey: '',
- reposListTopic: '',
-
- staticSquareBanners: staticSquareBanners,
- staticSquarePreferredRepos: staticSquarePreferredRepos,
- staticSquareTopics: staticSquareTopics,
- staticSquareRecommendRepos: staticSquareRecommendRepos,
- };
- },
- components: {
- SquareTop,
- SearchBar,
- RecommendRepos,
- ReposFilters,
- ReposList,
- ActiveUsers,
- ActiveOrgs,
- },
- methods: {
- filtersChange(condition) {
- this.reposListSortType = condition.key;
- this.search();
- },
- searchBarChange(params) {
- this.reposListQurey = params.q || '';
- this.reposListTopic = params.topic || '';
- this.search();
- },
- search() {
- this.$nextTick(() => {
- this.$refs.reposListRef.search();
- });
- }
- },
- mounted() {
- this.$nextTick(() => {
- this.$refs.searchBarRef.setDefaultSearch({
- q: '',
- topic: '',
- });
- this.search();
- });
- },
- beforeDestroy() { },
- };
- </script>
-
- <style scoped lang="less">
- .recommend-repos-c {
- margin: 0 0 54px;
- }
-
- .active-org-c {
- margin-top: 32px;
- }
- </style>
|