fix: 开屏页跳转按钮覆盖问题
This commit is contained in:
+2
-2
@@ -2,8 +2,8 @@
|
||||
"name" : "优购商城",
|
||||
"appid" : "__UNI__8B19741",
|
||||
"description" : "",
|
||||
"versionName" : "1.3.5",
|
||||
"versionCode" : 135,
|
||||
"versionName" : "1.3.6",
|
||||
"versionCode" : 136,
|
||||
"transformPx" : false,
|
||||
"app-plus" : {
|
||||
"privacy" : {
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<template>
|
||||
<view class="start-page">
|
||||
<image v-if="USE_STATIC_START_PAGE" class="bg" src="/static/startPage.jpeg" mode="aspectFill" />
|
||||
<video
|
||||
v-if="bgSrc && isVideo"
|
||||
v-if="!USE_STATIC_START_PAGE && bgSrc && isVideo"
|
||||
class="bg"
|
||||
:src="bgSrc"
|
||||
autoplay
|
||||
@@ -23,7 +24,7 @@
|
||||
@click="onMediaClick"
|
||||
/>
|
||||
<image
|
||||
v-else-if="bgSrc && !isVideo"
|
||||
v-else-if="!USE_STATIC_START_PAGE && bgSrc && !isVideo"
|
||||
class="bg"
|
||||
:src="bgSrc"
|
||||
mode="aspectFill"
|
||||
@@ -31,7 +32,10 @@
|
||||
@load="onImageLoaded"
|
||||
@click="onMediaClick"
|
||||
/>
|
||||
<view class="count-down" @click.stop="toHome">
|
||||
<cover-view v-if="!USE_STATIC_START_PAGE && bgSrc && isVideo" class="count-down" @click.stop="toHome">
|
||||
<cover-view class="count-down-text">{{ `跳过 ${countDown}s` }}</cover-view>
|
||||
</cover-view>
|
||||
<view v-else class="count-down" @click.stop="toHome">
|
||||
{{ `跳过 ${countDown}s` }}
|
||||
</view>
|
||||
</view>
|
||||
@@ -40,6 +44,8 @@
|
||||
import { ref, onMounted, onUnmounted } from 'vue'
|
||||
import * as IndexApi from '@/sheep/api/index/index'
|
||||
|
||||
const USE_STATIC_START_PAGE = false
|
||||
|
||||
const DEFAULT_IMAGE_SECONDS = 3
|
||||
const MAX_VIDEO_SECONDS = 15
|
||||
|
||||
@@ -123,6 +129,14 @@ function onMediaError() {
|
||||
|
||||
const countDown = ref(DEFAULT_IMAGE_SECONDS)
|
||||
|
||||
function closeNativeSplashIfNeeded() {
|
||||
try {
|
||||
if (typeof plus !== 'undefined' && plus?.navigator?.closeSplashscreen) {
|
||||
plus.navigator.closeSplashscreen()
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
function clearTimers() {
|
||||
if (readyFallbackTimer) clearTimeout(readyFallbackTimer)
|
||||
readyFallbackTimer = null
|
||||
@@ -158,6 +172,7 @@ function scheduleJumpAfter(seconds) {
|
||||
function onImageLoaded() {
|
||||
if (mediaReady.value) return
|
||||
mediaReady.value = true
|
||||
closeNativeSplashIfNeeded()
|
||||
startCountDown(DEFAULT_IMAGE_SECONDS)
|
||||
scheduleJumpAfter(DEFAULT_IMAGE_SECONDS + 0.2)
|
||||
}
|
||||
@@ -165,6 +180,7 @@ function onImageLoaded() {
|
||||
function onVideoReady() {
|
||||
if (!mediaReady.value) {
|
||||
mediaReady.value = true
|
||||
closeNativeSplashIfNeeded()
|
||||
}
|
||||
if (!countDownTimer) {
|
||||
startCountDown(MAX_VIDEO_SECONDS)
|
||||
@@ -175,6 +191,7 @@ function onVideoReady() {
|
||||
function onVideoMetadata(e) {
|
||||
if (!mediaReady.value) {
|
||||
mediaReady.value = true
|
||||
closeNativeSplashIfNeeded()
|
||||
}
|
||||
const duration = Number(e?.detail?.duration || e?.detail?.totalTime || 0)
|
||||
const limit = duration > 0 ? Math.min(MAX_VIDEO_SECONDS, Math.ceil(duration)) : MAX_VIDEO_SECONDS
|
||||
@@ -187,8 +204,15 @@ function onVideoEnded() {
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
closeNativeSplashIfNeeded()
|
||||
if (USE_STATIC_START_PAGE) {
|
||||
startCountDown(DEFAULT_IMAGE_SECONDS)
|
||||
scheduleJumpAfter(DEFAULT_IMAGE_SECONDS + 0.2)
|
||||
return
|
||||
}
|
||||
fetchStartPage().then((ok) => {
|
||||
if (!ok) {
|
||||
closeNativeSplashIfNeeded()
|
||||
startCountDown(DEFAULT_IMAGE_SECONDS)
|
||||
scheduleJumpAfter(DEFAULT_IMAGE_SECONDS + 0.2)
|
||||
return
|
||||
@@ -258,4 +282,10 @@ function onMediaClick() {
|
||||
background: rgba(0, 0, 0, 0.4);
|
||||
z-index: 9999;
|
||||
}
|
||||
|
||||
.count-down-text {
|
||||
color: #fff;
|
||||
font-size: 28rpx;
|
||||
line-height: 1;
|
||||
}
|
||||
</style>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 41 KiB |
Reference in New Issue
Block a user