You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

489 lines
10 KiB

<template>
<view class="wrap">
<image class="bg" :src="require('@/static/qus-bg.jpg')" mode=""></image>
<view class="navBarBox">
<!-- <image class="navBarBox-top" :src="require('@/static/home-top.png')" mode=""></image> -->
<!-- 状态栏占位 -->
<view class="statusBar" :style="{paddingTop: navBarTop+'px'}"></view>
<image class="navBarBox-title" :style="{marginTop: navBarTop+'rpx'}" :src="require('@/static/booklogo.png')"
mode=""></image>
</view>
<view class="book">
<u-swiper @change="changeSwiper" :class="{'opacity0':addOpcity}" :list="bookList" :effect3d="true"
:circular="true" :indicator="true" img-mode="widthFix" effect3d-previous-margin="140"
:autoplay="false"></u-swiper>
</view>
<view class="videoLine">
<block v-if="videoList.length>0">
<view class="videoLine-item" v-for="item in videoList" @click="playVideos(item.video.url)">
<view class="videoLine-item-image">
<image class="videoLine-item-image-play"
:src="require('@/packages/static/detail-videoplay.png')"></image>
<image class="videoLine-item-image-image" :src="item.image.url"></image>
</view>
<view class="videoLine-item-title">
<view>{{item.title}}</view>
</view>
</view>
</block>
</view>
<!-- 全屏播放 -->
<view class="playvideo" v-if="playvideo" @click="playvideo=false">
<view class="playvideowrap">
<video ref="videos" id="videos" :show-fullscreen-btn="false" :autoplay="true" @play="playFullScreen" :src="videoUrl?videoUrl:''"
play-btn-position="center"></video>
<view class="closevideo" @click="playvideo=false,videoUrl=''">X</view>
</view>
</view>
<!-- 文章 -->
<view class="articleLine">
<block v-if="articleList.length>0">
<view class="articleLine-item" v-for="item in articleList" @click="goArticle(item.id)">
<view class="articleLine-item-image">
<image class="articleLine-item-image-image" :src="item.image.url"></image>
</view>
<view class="articleLine-item-title">
<view>
{{item.title}}
</view>
</view>
</view>
</block>
</view>
<tabbar :currentPage="2"></tabbar>
</view>
</template>
<script>
import tabbar from '@/components/tabbar/tabbar.vue'
import {
shareInfo
} from "@/common/util.js"
export default {
components: {
tabbar
},
data() {
return {
navBarTop: 0,
bookList: [],
bookIndex: 0,
swiperHeight: 0,
addOpcity: true,
articleList: [],
videoList: [],
playvideo: false,
videoUrl: '',
}
},
onShareAppMessage() {
return shareInfo
},
onShareTimeline() {
return shareInfo
},
onLoad() {
const MenuButton = uni.getMenuButtonBoundingClientRect()
this.navBarTop = MenuButton.top //左侧文字与右侧胶囊对齐
this.getBooks()
this.getVideos()
this.getArticles()
},
onShow() {
let that = this
uni.getSystemInfo({
success: function(info) {
console.log('屏幕的高度:' + info.windowHeight);
that.swiperHeight = info.windowHeight * .7 * 2
console.log(that.swiperHeight)
console.log('屏幕的宽度:' + info.windowWidth);
}
});
},
methods: {
changeSwiper(e) {
console.log(e)
this.addOpcity = false
},
changeBook(e) {
console.log(e)
this.bookIndex = e.detail.current
},
getBooks() {
var that = this;
var host = "https://gbyuyue.szgmbwg.org.cn"
uni.request({
url: host + '/api/mobile/book/index',
data: {
page: 1,
page_size: 99,
sort_name: 'datetime',
sort_type: "ASC",
},
success: function(res) {
console.log("res", res)
let arr = []
res.data.data.map(item => {
arr.push({
image: item.image.url,
id: item.id,
title: item.name
})
})
that.bookList = arr
that.addOpcity = true
console.log(that.bookList)
},
fail: function(res) {
}
})
},
playFullScreen() {
let videoContext = uni.createVideoContext('videos', this)
videoContext.requestFullScreen()
},
async getVideos() {
const res = await this.$u.api.baseFormIndex1({
table_name: "map_point_videos",
page: 1,
page_size: 999,
sort_name: 'sort',
sort_type: 'ASC',
'filter[0][key]': 'type',
'filter[0][op]': 'eq',
'filter[0][value]': 2,
})
this.videoList = res.data
},
playVideos(url) {
if (!url) {
return
}
this.videoUrl = url
this.playvideo = true
},
async getArticles() {
const res = await this.$u.api.baseFormIndex({
table_name: "map_point_image_articles",
page: 1,
page_size: 999,
sort_name: 'sort',
sort_type: 'ASC',
'filter[0][key]': 'type',
'filter[0][op]': 'eq',
'filter[0][value]': 2,
})
this.articleList = res.data
},
goArticle(e) {
uni.navigateTo({
url: '/packages/detail/articleDetail?id=' + e,
});
},
}
}
</script>
<style lang="scss">
.wrap {
width: 100vw;
height: 100vh;
padding-bottom: 135rpx;
overflow: scroll;
.bg {
height: 100vh;
width: 100vw;
position: absolute;
top: 0;
left: 0;
}
.navBarBox {
// height: 299rpx;
position: relative;
padding-bottom: 30rpx;
top: 0;
left: 0;
width: 100%;
&-title {
width: 171rpx;
height: 269rpx;
margin: 0 auto;
position: relative;
display: block;
}
.navBar {
display: flex;
position: relative;
align-items: center;
justify-content: space-between;
padding: 30rpx;
}
}
.playvideo {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 999;
background-color: rgba(0, 0, 0, 0.6);
&>.playvideowrap {
width: 95%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
video {
width: 100%
}
::v-deep .u-indicator-item-round.u-indicator-item-round-active {
background-color: #bf3022;
}
.closevideo {
color: #fff;
width: 50rpx;
height: 50rpx;
border: 1px solid #fff;
border-radius: 50rpx;
position: absolute;
text-align: center;
line-height: 50rpx;
/* display: inline-block; */
right: 0rpx;
top: -25rpx // transform: translate(0,-50%);
}
}
}
.book {
// padding: 175rpx 0;
height: 50vh;
padding-bottom: 0;
swiper {
height: calc(50vh - 200rpx) !important;
background-color: transparent !important;
image {
height: 85%;
}
}
::v-deep .u-swiper-wrap {
height: 100%;
}
::v-deep .u-swiper-indicator {
bottom: 150rpx !important;
}
::v-deep .u-list-image-wrap {
// background-color: #fff;
}
.opacity0 swiper swiper-item:last-child {
opacity: 0;
}
::v-deep .u-swiper-image {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%) scale(1.7);
}
::v-deep .u-swiper-title {
height: 15%;
display: flex;
align-items: center;
justify-content: space-around;
color: #333;
font-size: 38rpx;
background-color: #fff;
overflow: auto;
white-space: break-spaces;
text-overflow: clip;
text-align: center;
}
::v-deep .u-indicator-item-round-active {
background-color: #9f4946;
}
&-item {
padding: 0 30rpx;
// transform: scale(.7);
// margin:0 80rpx;
}
&-img {
background-color: #fff;
height: 70%;
image {
width: calc(100vw - 160rpx);
height: 70%;
}
}
&-title {
text-align: center;
padding: 75rpx 30rpx;
background-color: #ffffff;
display: flex;
align-items: center;
justify-content: space-around;
font-size: 42rpx;
color: #000;
}
}
.videoLine {
position: relative;
z-index: 99;
padding: 0rpx 30rpx;
width: 100%;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
margin-top: -80rpx;
background:linear-gradient(to bottom,transparent,#f6f3ef) ;
padding-bottom:40rpx;
&-item {
font-size: 0;
border-radius: 10rpx;
background-color: #ffffff;
width: 690rpx;
height: 420rpx;
margin-bottom: 30rpx;
&-image {
width: 690rpx;
height: 340rpx;
border-radius: 10rpx 10rpx 0 0;
position: relative;
&-image {
width: 690rpx;
height: 340rpx;
display: block;
border-radius: 10rpx 10rpx 0 0;
}
&-play {
width: 67rpx;
height: 68rpx;
background-size: 100% 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
z-index: 10;
}
}
&-title {
height: 80rpx;
position: relative;
&>view {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 0 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5;
font-size: 28rpx;
text-align: center;
}
}
}
}
.articleLine {
position: relative;
z-index: 99;
padding: 70rpx 30rpx;
display: flex;
width: 100%;
overflow-x: scroll;
&-item {
font-size: 0;
border-radius: 10rpx;
background-color: #fef7e7;
margin-right: 30rpx;
width: 615rpx;
height: 385rpx;
&-image {
width: 615rpx;
height: 305rpx;
border-radius: 10rpx 10rpx 0 0;
position: relative;
&-image {
width: 615rpx;
height: 305rpx;
display: block;
border-radius: 10rpx 10rpx 0 0;
}
}
&-title {
height: 80rpx;
position: relative;
&>view {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
padding: 0 10rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.5;
font-size: 28rpx;
text-align: center;
}
}
}
}
}
</style>