15 changed files with 1489 additions and 688 deletions
-
BINsrc/assets/images/page4_03-b.png
-
BINsrc/assets/images/pageOne-1-b.png
-
BINsrc/assets/images/pageOne-2-b.png
-
4src/assets/json/lib.json
-
13src/assets/styles/font-some.css
-
220src/assets/styles/index.scss
-
247src/components/echart/todayCircle.vue
-
263src/components/echart/yearCircle.vue
-
2src/main.js
-
14src/views/index.vue
-
522src/views/map/index.vue
-
172src/views/pageFive/index.vue
-
125src/views/pageFour/index.vue
-
3src/views/pageOne/index.vue
-
102src/views/pageThree/index.vue
|
After Width: 1835 | Height: 1201 | Size: 69 KiB |
|
After Width: 267 | Height: 128 | Size: 25 KiB |
|
After Width: 267 | Height: 128 | Size: 28 KiB |
@ -1,4 +1,4 @@ |
|||
{ |
|||
"大湾城市书房":[114.664064,30.478882], |
|||
"张家湾城市书房":[114.635376,30.532215] |
|||
"葛店城市书房·大湾分馆":[114.664064,30.478882], |
|||
"葛店城市书房·张家湾分馆":[114.635376,30.532215] |
|||
} |
|||
@ -0,0 +1,172 @@ |
|||
<template> |
|||
<div class="page-wrapper" style="padding: 0 !important; z-index: 9999;"> |
|||
<el-carousel |
|||
ref="carousel" |
|||
indicator-position="none" |
|||
:autoplay="false" |
|||
:autoplay-hover-pause="true" |
|||
@setActiveItem="setActiveItem" |
|||
@change="carouselChange" |
|||
> |
|||
<div v-if="slideData && slideData.length > 0"> |
|||
<el-carousel-item v-for="(item, index) in slideData" :key="index"> |
|||
<video |
|||
ref="videos" |
|||
class="tsgz-video" |
|||
width="100%" |
|||
height="100%" |
|||
controls |
|||
preload="auto" |
|||
:src="item.cover" |
|||
:poster="poster" |
|||
autoplay |
|||
type="video/mp4" |
|||
muted |
|||
@ended="playNextVideo(index)" |
|||
@loadedmetadata="playVideo" |
|||
> |
|||
您的浏览器不支持 video 标签。 |
|||
</video> |
|||
</el-carousel-item> |
|||
</div> |
|||
<el-empty |
|||
v-else |
|||
description="暂无视频" |
|||
style="height: 100vh" |
|||
:image-size="100" |
|||
image="" |
|||
/> |
|||
</el-carousel> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { FetchTotalResource } from '@/api/library' |
|||
export default { |
|||
name: 'PageFive', |
|||
components: { |
|||
}, |
|||
data() { |
|||
return { |
|||
poster: require('@/assets/images/poster.png'), |
|||
videoIndex: 0, |
|||
slideData: [] |
|||
} |
|||
}, |
|||
computed: { |
|||
}, |
|||
beforeDestroy() { |
|||
this.destroy() |
|||
}, |
|||
created() { |
|||
}, |
|||
activated() { |
|||
this.getVideoResource() |
|||
this.load() |
|||
}, |
|||
deactivated() { |
|||
this.destroy() |
|||
}, |
|||
mounted() { |
|||
}, |
|||
methods: { |
|||
load() { |
|||
const videos = this.$refs.videos |
|||
if (videos) { |
|||
videos[this.videoIndex].load() |
|||
videos[this.videoIndex].currentTime = localStorage.getItem('videoCurrentTime') ? localStorage.getItem('videoCurrentTime') : 0 |
|||
} |
|||
}, |
|||
destroy() { |
|||
localStorage.setItem('videoIndex', this.videoIndex) |
|||
localStorage.setItem('videoCurrentTime', this.$refs.videos[this.videoIndex].currentTime) |
|||
this.$refs.videos[this.videoIndex].pause() |
|||
}, |
|||
// 视频资源 |
|||
getVideoResource() { |
|||
FetchTotalResource().then(res => { |
|||
const result = JSON.parse(res.data) |
|||
const linkSrc = process.env.NODE_ENV === 'production' ? window.g.ApiUrl : process.env.VUE_APP_BASE_API |
|||
this.slideData = result.map((item, index) => { |
|||
if (item.filePath) { |
|||
item.cover = linkSrc + '/downloadFile' + item.filePath |
|||
} else { |
|||
item.cover = null |
|||
} |
|||
return item |
|||
}) |
|||
// 下次进入页面时优先缓存的部分 |
|||
if (localStorage.getItem('videoIndex')) { |
|||
this.videoIndex = parseInt(localStorage.getItem('videoIndex')) |
|||
this.$nextTick(() => { |
|||
this.$refs.carousel.setActiveItem(this.videoIndex) |
|||
const videos = this.$refs.videos |
|||
const nextVideo = videos[this.videoIndex] |
|||
videos.forEach((video) => { |
|||
video.pause() |
|||
video.currentTime = 0 |
|||
}) |
|||
setTimeout(() => { |
|||
nextVideo.currentTime = localStorage.getItem('videoCurrentTime') ? localStorage.getItem('videoCurrentTime') : 0 |
|||
nextVideo.play() |
|||
}, 2000) |
|||
}) |
|||
} |
|||
}).catch(error => { |
|||
console.error('Error', error) |
|||
}) |
|||
}, |
|||
playVideo() { |
|||
this.$refs.videos[this.videoIndex].play().catch(error => { |
|||
console.error(error) |
|||
}) |
|||
}, |
|||
setActiveItem(index) { |
|||
this.$refs.carousel.setActiveItem(index) |
|||
}, |
|||
carouselChange(index) { |
|||
const videos = this.$refs.videos |
|||
this.videoIndex = index |
|||
videos.forEach((video) => { |
|||
video.currentTime = 0 // 将视频回到起始时间 |
|||
video.pause() // 暂停视频播放 |
|||
}) |
|||
videos[index].play() |
|||
}, |
|||
playNextVideo(index) { |
|||
const videos = this.$refs.videos |
|||
let nextIndex = index |
|||
this.videoIndex = nextIndex |
|||
if (index < this.slideData.length - 1) { |
|||
nextIndex = nextIndex + 1 |
|||
} else { |
|||
nextIndex = 0 |
|||
} |
|||
const carousel = this.$refs.carousel |
|||
carousel.setActiveItem(nextIndex) |
|||
const nextVideo = videos[nextIndex] |
|||
videos.forEach((video) => { |
|||
video.pause() |
|||
video.currentTime = 0 |
|||
}) |
|||
setTimeout(() => { |
|||
nextVideo.play() |
|||
}, 1000) |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "~@/assets/styles/index.scss"; |
|||
.el-carousel { |
|||
margin-top: 0 !important; |
|||
} |
|||
::v-deep .el-carousel__container{ |
|||
height: 100vh !important; |
|||
} |
|||
video { |
|||
width: 100%; |
|||
height: 100%; |
|||
} |
|||
</style> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue