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