fix: 修复启动页面视频背景下文字遮挡问题、新增更多参数配置

This commit is contained in:
小莫唐尼 2024-07-10 17:17:24 +08:00
parent ad6719e201
commit c3349ae070

View File

@ -1,478 +1,499 @@
<template> <template>
<view class="app-page bg-gradient-blue-lighten-b" :style="pageStyle"> <view class="app-page bg-gradient-blue-lighten-b" :class="calcPageClass" :style="calcPageStyle">
<view v-if="!calcUseVideoBackground" class="tn-satr"> <view v-if="calcBackgroundType!=='video'" class="tn-satr">
<view class="sky"></view> <view class="sky"></view>
<view class="stars"> <view class="stars">
<view class="falling-stars"> <view class="falling-stars">
<view class="star-fall"></view> <view class="star-fall"></view>
<view class="star-fall"></view> <view class="star-fall"></view>
<view class="star-fall"></view> <view class="star-fall"></view>
<view class="star-fall"></view> <view class="star-fall"></view>
</view> </view>
<view class="small-stars"> <view class="small-stars">
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
</view> </view>
<view class="medium-stars"> <view class="medium-stars">
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
<view class="star"></view> <view class="star"></view>
</view> </view>
</view> </view>
</view> </view>
<video v-else class="video-bg" :src="bg" :loop="true" :autoplay="true" :muted="true" :controls="false" <video v-else class="video-bg" :object-fit="startConfig.bgVideoFit" :src="startConfig.bgVideo" :loop="true" :autoplay="true"
:show-fullscreen-btn="false" :show-play-btn="false" :show-center-play-btn="false" :show-loading="false" :muted="true" :controls="false" :show-fullscreen-btn="false" :show-play-btn="false"
:enable-progress-gesture="false" :show-progress="false"></video> :show-center-play-btn="false" :show-loading="false" :enable-progress-gesture="false"
:show-progress="false"></video>
<view v-if="startConfig.title || startConfig.logo" class="user-info__container flex flex-col flex-center"> <cover-view v-if="startConfig.title || startConfig.logo" class="title-container">
<image v-if="startConfig.logo" class="user-info__avatar" :src="$utils.checkImageUrl(startConfig.logo)" <cover-view v-if="startConfig.logo" class="app-logo">
mode="aspectFill"></image> <cover-image class="app-logo-image" :src="$utils.checkImageUrl(startConfig.logo)"
<view v-if="startConfig.title " class="user-info__nick-name" :style="startConfig.titleStyle"> {{ startConfig.title }} </view> mode="aspectFill"></cover-image>
</view> </cover-view>
<cover-view class="btn-group"> <cover-view v-if="startConfig.title" class="app-title" :style="startConfig.titleStyle">
<view v-if="startConfig.desc1 || startConfig.desc2" class="text-align-center" :style="startConfig.descStyle" style="color:white;padding: 60vh 0 0 0;"> {{ startConfig.title }}
<view class="" style="font-size: 44rpx;" v-if="startConfig.desc1">{{ startConfig.desc1 }}</view> </cover-view>
<view class="mt-30 text-size-m" v-if="startConfig.desc2">{{ startConfig.desc2 }}</view> </cover-view>
</view>
<view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;"> <cover-view v-if="startConfig.desc1 || startConfig.desc2" class="bottom-container">
<view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()" <cover-view class="text-align-center" :style="startConfig.descStyle"
:style="startConfig.btnStyle">{{ startConfig.btnText || '开始体验' }}</view> style="color:white;padding: 60vh 0 0 0;">
</view> <cover-view class="" style="font-size: 44rpx;" v-if="startConfig.desc1">{{ startConfig.desc1 }}
</cover-view> </cover-view>
<!-- 波浪效果 --> <cover-view class="mt-30 text-size-m" v-if="startConfig.desc2">{{ startConfig.desc2 }}</cover-view>
<wave v-if="startConfig.useWave"></wave> </cover-view>
</view>
<cover-view class="" style="padding: 120rpx 200rpx;z-index: 999;position: relative;">
<cover-view class="start-btn" :class="[startConfig.btnClass]" @click="fnStart()"
:style="startConfig.btnStyle">{{ startConfig.btnText || '开始体验' }}
</cover-view>
</cover-view>
</cover-view>
<!-- 波浪效果 -->
<wave v-if="startConfig.useWave"></wave>
</view>
</template> </template>
<script> <script>
import wave from '@/components/wave/wave.vue'; import wave from '@/components/wave/wave.vue';
export default { export default {
components: { components: {
wave wave
}, },
data() { computed: {
return { startConfig() {
bg: "https://thalo.925i.cn/upload/92739970-24856955-start.mp4" return this.$tm.vx.getters().getConfigs.appConfig.startConfig;
} },
}, calcBackgroundType() {
computed: { return this.startConfig.backgroundType;
startConfig() { },
return this.$tm.vx.getters().getConfigs.appConfig.startConfig; calcPageClass() {
}, if (this.calcBackgroundType === 'color') {
calcUseVideoBackground() { return [this.startConfig.bg]
return this.startConfig.useVideoBackground; }
}, return []
pageStyle() { },
if (this.calcUseVideoBackground) { calcPageStyle() {
return { if (this.calcBackgroundType === 'color') {
background: '#ffffff' return {}
} }
} if (this.calcBackgroundType === 'image') {
if (this.startConfig.bg) { return {
const _bg = this.$utils.checkIsUrl(this.startConfig.bg) ? backgroundImage: `url(${this.$utils.checkImageUrl(this.startConfig.bgImage)})!important`,
`url(${this.$utils.checkImageUrl(this.startConfig.bg)})` : this backgroundSize: this.startConfig.bgImageFit
.startConfig.bg; }
return { }
background: _bg + '!important' if (this.calcBackgroundType === 'video') {
}; return {
} background: '#ffffff'
return {}; }
} }
}, return {};
methods: { }
fnStart() { },
uni.switchTab({ methods: {
url: '/pages/tabbar/home/home', fnStart() {
success: () => { uni.switchTab({
uni.setStorageSync('APP_HAS_STARTED', true); url: '/pages/tabbar/home/home',
} success: () => {
}); uni.setStorageSync('APP_HAS_STARTED', true);
} }
} });
}; }
}
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.app-page { .app-page {
width: 100vw; position: relative;
height: 100vh; width: 100vw;
} height: 100vh;
background-size: cover;
background-repeat: no-repeat;
}
.start-btn { .start-btn {
box-sizing: border-box; box-sizing: border-box;
background-color: transparent; background-color: transparent;
padding: 16rpx 50rpx; padding: 16rpx 50rpx;
border-radius: 50rpx; border-radius: 50rpx;
border: 2rpx solid #ffffff; border: 2rpx solid #ffffff;
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
font-size: 28rpx; font-size: 28rpx;
} }
.btn-group { .bottom-container {
position: fixed; position: absolute;
bottom: 50rpx; bottom: 50rpx;
left: 50%; left: 50%;
transform: translateX(-50%); transform: translateX(-50%);
z-index: 10; z-index: 999;
} }
.video-bg { .video-bg {
width: 100vw; position: absolute;
height: 100vh; left: 0;
z-index: 0; top: 0;
} width: 100vw;
height: 100vh;
z-index: 0;
}
/* 用户信息 start */ .title-container {
.user-info { width: 100vw;
&__container { position: absolute;
position: absolute; top: 20vh;
top: 25vh; left: 0;
left: 50%; z-index: 999;
-webkit-transform: translate(-50%, -50%); display: flex;
transform: translate(-50%, -50%); flex-direction: column;
} align-items: center;
justify-content: center;
}
&__avatar { .app-logo {
width: 200rpx; width: 200rpx;
height: 200rpx; height: 200rpx;
border: 8rpx solid rgba(255, 255, 255, 0.05); border: 8rpx solid rgba(255, 255, 255, 0.35);
border-radius: 50%; border-radius: 50%;
overflow: hidden; box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15);
box-shadow: 0rpx 0rpx 80rpx 0rpx rgba(0, 0, 0, 0.15); overflow: hidden;
}
&__nick-name { &-image {
color: #ffffff; width: 100%;
margin-top: 26rpx; height: 100%;
font-size: 36rpx; }
font-weight: 600; }
text-align: center;
}
}
/* 用户信息 end */ .app-title {
color: #ffffff;
margin-top: 26rpx;
font-size: 36rpx;
font-weight: 600;
text-align: center;
}
/* 流星*/
.tn-satr {
position: fixed;
width: 100%;
height: 600px;
overflow: hidden;
flex-shrink: 0;
z-index: 998;
}
.stars { .tn-satr {
position: absolute; position: fixed;
z-index: 1; width: 100%;
width: 100%; height: 600px;
height: 400px; overflow: hidden;
} flex-shrink: 0;
z-index: 998;
}
.star { .stars {
border-radius: 50%; position: absolute;
background: #ffffff; z-index: 1;
box-shadow: 0px 0px 6px 0px rgba(255, 255, 255, 0.8); width: 100%;
} height: 400px;
}
.small-stars .star { .star {
position: absolute; border-radius: 50%;
width: 3px; background: #ffffff;
height: 3px; box-shadow: 0 0 6px 0 rgba(255, 255, 255, 0.8);
} }
.small-stars .star:nth-child(2n) { .small-stars .star {
opacity: 0; position: absolute;
-webkit-animation: star-blink 1.2s linear infinite alternate; width: 3px;
animation: star-blink 1.2s linear infinite alternate; height: 3px;
} }
.small-stars .star:nth-child(1) { .small-stars .star:nth-child(2n) {
left: 40px; opacity: 0;
bottom: 50px; -webkit-animation: star-blink 1.2s linear infinite alternate;
} animation: star-blink 1.2s linear infinite alternate;
}
.small-stars .star:nth-child(2) { .small-stars .star:nth-child(1) {
left: 200px; left: 40px;
bottom: 40px; bottom: 50px;
} }
.small-stars .star:nth-child(3) { .small-stars .star:nth-child(2) {
left: 60px; left: 200px;
bottom: 120px; bottom: 40px;
} }
.small-stars .star:nth-child(4) { .small-stars .star:nth-child(3) {
left: 140px; left: 60px;
bottom: 250px; bottom: 120px;
} }
.small-stars .star:nth-child(5) { .small-stars .star:nth-child(4) {
left: 400px; left: 140px;
bottom: 300px; bottom: 250px;
} }
.small-stars .star:nth-child(6) { .small-stars .star:nth-child(5) {
left: 170px; left: 400px;
bottom: 80px; bottom: 300px;
} }
.small-stars .star:nth-child(7) { .small-stars .star:nth-child(6) {
left: 200px; left: 170px;
bottom: 360px; bottom: 80px;
-webkit-animation-delay: 0.2s; }
animation-delay: 0.2s;
}
.small-stars .star:nth-child(8) { .small-stars .star:nth-child(7) {
left: 250px; left: 200px;
bottom: 320px; bottom: 360px;
} -webkit-animation-delay: 0.2s;
animation-delay: 0.2s;
}
.small-stars .star:nth-child(9) { .small-stars .star:nth-child(8) {
left: 300px; left: 250px;
bottom: 340px; bottom: 320px;
} }
.small-stars .star:nth-child(10) { .small-stars .star:nth-child(9) {
left: 130px; left: 300px;
bottom: 320px; bottom: 340px;
-webkit-animation-delay: 0.5s; }
animation-delay: 0.5s;
}
.small-stars .star:nth-child(11) { .small-stars .star:nth-child(10) {
left: 230px; left: 130px;
bottom: 330px; bottom: 320px;
-webkit-animation-delay: 7s; -webkit-animation-delay: 0.5s;
animation-delay: 7s; animation-delay: 0.5s;
} }
.small-stars .star:nth-child(12) { .small-stars .star:nth-child(11) {
left: 300px; left: 230px;
bottom: 360px; bottom: 330px;
-webkit-animation-delay: 0.3s; -webkit-animation-delay: 7s;
animation-delay: 0.3s; animation-delay: 7s;
} }
@-webkit-keyframes star-blink { .small-stars .star:nth-child(12) {
50% { left: 300px;
width: 3px; bottom: 360px;
height: 3px; -webkit-animation-delay: 0.3s;
opacity: 1; animation-delay: 0.3s;
} }
}
@keyframes star-blink { @-webkit-keyframes star-blink {
50% { 50% {
width: 3px; width: 3px;
height: 3px; height: 3px;
opacity: 1; opacity: 1;
} }
} }
.medium-stars .star { @keyframes star-blink {
position: absolute; 50% {
width: 3px; width: 3px;
height: 3px; height: 3px;
opacity: 0; opacity: 1;
-webkit-animation: star-blink 1.2s ease-in infinite alternate; }
animation: star-blink 1.2s ease-in infinite alternate; }
}
.medium-stars .star:nth-child(1) { .medium-stars .star {
left: 300px; position: absolute;
bottom: 50px; width: 3px;
} height: 3px;
opacity: 0;
-webkit-animation: star-blink 1.2s ease-in infinite alternate;
animation: star-blink 1.2s ease-in infinite alternate;
}
.medium-stars .star:nth-child(2) { .medium-stars .star:nth-child(1) {
left: 400px; left: 300px;
bottom: 40px; bottom: 50px;
-webkit-animation-delay: 0.4s; }
animation-delay: 0.4s;
}
.medium-stars .star:nth-child(3) { .medium-stars .star:nth-child(2) {
left: 330px; left: 400px;
bottom: 300px; bottom: 40px;
-webkit-animation-delay: 0.2s; -webkit-animation-delay: 0.4s;
animation-delay: 0.2s; animation-delay: 0.4s;
} }
.medium-stars .star:nth-child(4) { .medium-stars .star:nth-child(3) {
left: 460px; left: 330px;
bottom: 300px; bottom: 300px;
-webkit-animation-delay: 0.9s; -webkit-animation-delay: 0.2s;
animation-delay: 0.9s; animation-delay: 0.2s;
} }
.medium-stars .star:nth-child(5) { .medium-stars .star:nth-child(4) {
left: 300px; left: 460px;
bottom: 150px; bottom: 300px;
-webkit-animation-delay: 1.2s; -webkit-animation-delay: 0.9s;
animation-delay: 1.2s; animation-delay: 0.9s;
} }
.medium-stars .star:nth-child(6) { .medium-stars .star:nth-child(5) {
left: 440px; left: 300px;
bottom: 120px; bottom: 150px;
-webkit-animation-delay: 1s; -webkit-animation-delay: 1.2s;
animation-delay: 1s; animation-delay: 1.2s;
} }
.medium-stars .star:nth-child(7) { .medium-stars .star:nth-child(6) {
left: 200px; left: 440px;
bottom: 140px; bottom: 120px;
-webkit-animation-delay: 0.8s; -webkit-animation-delay: 1s;
animation-delay: 0.8s; animation-delay: 1s;
} }
.medium-stars .star:nth-child(8) { .medium-stars .star:nth-child(7) {
left: 30px; left: 200px;
bottom: 480px; bottom: 140px;
-webkit-animation-delay: 0.3s; -webkit-animation-delay: 0.8s;
animation-delay: 0.3s; animation-delay: 0.8s;
} }
.medium-stars .star:nth-child(9) { .medium-stars .star:nth-child(8) {
left: 460px; left: 30px;
bottom: 400px; bottom: 480px;
-webkit-animation-delay: 1.2s; -webkit-animation-delay: 0.3s;
animation-delay: 1.2s; animation-delay: 0.3s;
} }
.medium-stars .star:nth-child(10) { .medium-stars .star:nth-child(9) {
left: 150px; left: 460px;
bottom: 10px; bottom: 400px;
-webkit-animation-delay: 1s; -webkit-animation-delay: 1.2s;
animation-delay: 1s; animation-delay: 1.2s;
} }
.medium-stars .star:nth-child(11) { .medium-stars .star:nth-child(10) {
left: 420px; left: 150px;
bottom: 450px; bottom: 10px;
-webkit-animation-delay: 1.2s; -webkit-animation-delay: 1s;
animation-delay: 1.2s; animation-delay: 1s;
} }
.medium-stars .star:nth-child(12) { .medium-stars .star:nth-child(11) {
left: 340px; left: 420px;
bottom: 180px; bottom: 450px;
-webkit-animation-delay: 1.1s; -webkit-animation-delay: 1.2s;
animation-delay: 1.1s; animation-delay: 1.2s;
} }
@keyframes star-blink { .medium-stars .star:nth-child(12) {
50% { left: 340px;
width: 4px; bottom: 180px;
height: 4px; -webkit-animation-delay: 1.1s;
opacity: 1; animation-delay: 1.1s;
} }
}
.star-fall { @keyframes star-blink {
position: relative; 50% {
border-radius: 2px; width: 4px;
width: 80px; height: 4px;
height: 2px; opacity: 1;
overflow: hidden; }
-webkit-transform: rotate(-20deg); }
transform: rotate(-20deg);
}
.star-fall:after { .star-fall {
content: ''; position: relative;
position: absolute; border-radius: 2px;
width: 50px; width: 80px;
height: 2px; height: 2px;
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4))); overflow: hidden;
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%); -webkit-transform: rotate(-20deg);
left: 100%; transform: rotate(-20deg);
-webkit-animation: star-fall 3.6s linear infinite; }
animation: star-fall 3.6s linear infinite;
}
.star-fall:nth-child(1) { .star-fall:after {
left: 80px; content: '';
bottom: -100px; position: absolute;
} width: 50px;
height: 2px;
background: -webkit-gradient(linear, right top, left top, from(rgba(0, 0, 0, 0)), to(rgba(255, 255, 255, 0.4)));
background: linear-gradient(to left, rgba(0, 0, 0, 0) 0%, rgba(255, 255, 255, 0.4) 100%);
left: 100%;
-webkit-animation: star-fall 3.6s linear infinite;
animation: star-fall 3.6s linear infinite;
}
.star-fall:nth-child(1):after { .star-fall:nth-child(1) {
-webkit-animation-delay: 2.4s; left: 80px;
animation-delay: 2.4s; bottom: -100px;
} }
.star-fall:nth-child(2) { .star-fall:nth-child(1):after {
left: 200px; -webkit-animation-delay: 2.4s;
bottom: -200px; animation-delay: 2.4s;
} }
.star-fall:nth-child(2):after { .star-fall:nth-child(2) {
-webkit-animation-delay: 2s; left: 200px;
animation-delay: 2s; bottom: -200px;
} }
.star-fall:nth-child(3) { .star-fall:nth-child(2):after {
left: 430px; -webkit-animation-delay: 2s;
bottom: -50px; animation-delay: 2s;
} }
.star-fall:nth-child(3):after { .star-fall:nth-child(3) {
-webkit-animation-delay: 3.6s; left: 430px;
animation-delay: 3.6s; bottom: -50px;
} }
.star-fall:nth-child(4) { .star-fall:nth-child(3):after {
left: 400px; -webkit-animation-delay: 3.6s;
bottom: 100px; animation-delay: 3.6s;
} }
.star-fall:nth-child(4):after { .star-fall:nth-child(4) {
-webkit-animation-delay: 0.2s; left: 400px;
animation-delay: 0.2s; bottom: 100px;
} }
@-webkit-keyframes star-fall { .star-fall:nth-child(4):after {
20% { -webkit-animation-delay: 0.2s;
left: -100%; animation-delay: 0.2s;
} }
100% { @-webkit-keyframes star-fall {
left: -100%; 20% {
} left: -100%;
} }
@keyframes star-fall { 100% {
20% { left: -100%;
left: -100%; }
} }
100% { @keyframes star-fall {
left: -100%; 20% {
} left: -100%;
} }
100% {
left: -100%;
}
}
</style> </style>