Skip to content

Commit

Permalink
Merge pull request #6 from gdmuna/clover
Browse files Browse the repository at this point in the history
添加首页轮播图组件
  • Loading branch information
seeleclover authored Jun 18, 2023
2 parents a6b93b9 + 239db99 commit 2ec2f7e
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/pages/oj/views/general/Banner.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div class="block">
<Carousel
autoplay
autoplay-speed="3000"
dots="inside"
trigger="hover"
arrow="hover">
<Carousel-item v-for="item in bannerList" :key="item">
<div class="banner-item" :style="{ 'background-image': 'url(' + item.imgUrl + ')' }"></div>
</Carousel-item>
</Carousel>
</div>
</template>

<script>
export default {
name: 'Banner',
components: {},
data () {
return {
bannerList: [
{
id: 1,
imgUrl: '/static/img/lantern-1.jpg'
},
{
id: 2,
imgUrl: '/static/img/lantern-2.jpg'
}
]
}
},
mounted () {
},
methods: {
},
computed: {
}
}
</script>

<style scoped lang="less">
.banner-item {
margin: 0;
height: 400px;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
}
</style>
7 changes: 7 additions & 0 deletions src/pages/oj/views/general/Home.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<Row type="flex" justify="space-around">
<Col :span="22">
<Banner class="banner"></Banner>
<panel shadow v-if="contests.length" class="contest">
<div slot="title">
<Button type="text" class="contest-title" @click="goContest">{{contests[index].title}}</Button>
Expand Down Expand Up @@ -32,6 +33,7 @@
</template>

<script>
import Banner from './Banner.vue'
import Announcements from './Announcements.vue'
import api from '@oj/api'
import time from '@/utils/time'
Expand All @@ -40,6 +42,7 @@
export default {
name: 'home',
components: {
Banner,
Announcements
},
data () {
Expand Down Expand Up @@ -85,4 +88,8 @@
.announcement {
margin-top: 20px;
}
.banner {
margin-top: 20px;
}
</style>
Binary file added static/img/lantern-1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/lantern-2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 2ec2f7e

Please sign in to comment.