feat: 版本更新、列表记录数量取值、

This commit is contained in:
2026-06-12 17:08:16 +08:00
parent 795de5ff62
commit fd282413d8
5 changed files with 206 additions and 25 deletions
+11 -1
View File
@@ -87,7 +87,17 @@
let cardPages = ref(null);
let height = ref('100%');
let sysInfo = uni.getSystemInfoSync();
height.value = sysInfo.windowHeight - sysInfo.statusBarHeight - uni.upx2px(88) + 'px';
const headerHeight = uni.upx2px(248);
const headerMargin = uni.upx2px(64);
const listTopMargin = uni.upx2px(16);
height.value =
sysInfo.windowHeight -
sysInfo.statusBarHeight -
uni.upx2px(88) -
headerHeight -
headerMargin -
listTopMargin +
'px';
const sum_list = ref([{
text: '总人数',
value: 0,
+1 -1
View File
@@ -88,7 +88,7 @@
const items = Array.isArray(order?.items) ? order.items : [];
const firstItem = items[0] || {};
const titleText = firstItem?.spuName || order?.no || '-';
const qty = Number(order?.productCount ?? 0) || 0;
const qty = Number(firstItem?.count ?? 0) || 0;
const statusText = formatOrderStatus(order || {});
const sumItemTotalPrice = items.reduce((acc, cur) => acc + (Number(cur?.totalPrice) || 0), 0);
const sumItemTotalRevenue = items.reduce((acc, cur) => acc + (Number(cur?.totalRevenue) || 0), 0);
+172 -20
View File
@@ -34,7 +34,7 @@
@click="onMediaClick"
/>
<view
v-if="(USE_STATIC_START_PAGE || bgSrc) && mediaReady && countDown > 0"
v-if="(USE_STATIC_START_PAGE || bgSrc) && mediaReady && countDown > 0 && !useNativeSkip"
class="count-down"
@click.stop="toHome"
>
@@ -49,24 +49,29 @@
</view>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue'
import { ref, onMounted, onUnmounted, watch } 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 = 9
const FIXED_VIDEO_SECONDS = 5
const bgSrc = ref('')
const jumpUrl = ref('')
const isVideo = ref(false)
const mediaReady = ref(false)
const isLoading = ref(false)
const useNativeSkip = ref(false)
let downloadToken = 0
let readyFallbackTimer = null
let countDownTimer = null
let jumpTimer = null
let videoCountdownBootTimer = null
let nativeSkipView = null
let nativeSkipViewId = ''
let plusReadyListenerBound = false
let lastVideoTime = 0
const normalizeAppFileUrl = (path) => {
const p = String(path || '')
@@ -149,6 +154,120 @@ function closeNativeSplashIfNeeded() {
} catch (e) {}
}
function destroyNativeSkipView() {
try {
if (!nativeSkipView) return
if (typeof nativeSkipView.hide === 'function') nativeSkipView.hide()
if (typeof nativeSkipView.close === 'function') nativeSkipView.close()
} catch (e) {}
nativeSkipView = null
nativeSkipViewId = ''
useNativeSkip.value = false
}
function ensureNativeSkipView() {
try {
if (typeof plus === 'undefined') return
if (nativeSkipView) return
const screenWidth = Number(plus?.screen?.resolutionWidth || 0)
if (!screenWidth) return
const pxPerRpx = screenWidth / 750
const widthPx = Math.round(pxPerRpx * 180)
const heightPx = Math.round(pxPerRpx * 64)
const rightPx = Math.round(pxPerRpx * 60)
const topPx = Math.round(pxPerRpx * 100)
const leftPx = Math.max(0, screenWidth - rightPx - widthPx)
const radiusPx = Math.round(heightPx / 2)
const fontPx = Math.round(pxPerRpx * 28)
nativeSkipViewId = `start-page-skip-${Date.now()}-${Math.floor(Math.random() * 1e6)}`
nativeSkipView = new plus.nativeObj.View(
nativeSkipViewId,
{
top: `${topPx}px`,
left: `${leftPx}px`,
width: `${widthPx}px`,
height: `${heightPx}px`,
},
[]
)
nativeSkipView.drawRect(
{
color: 'rgba(0,0,0,0.4)',
radius: `${radiusPx}px`,
},
{
top: '0px',
left: '0px',
width: `${widthPx}px`,
height: `${heightPx}px`,
},
'bg'
)
nativeSkipView.addEventListener('click', () => {
toHome()
})
nativeSkipView.drawText(
getSkipText(),
{
top: '0px',
left: '0px',
width: `${widthPx}px`,
height: `${heightPx}px`,
},
{
size: `${fontPx}px`,
color: '#ffffff',
align: 'center',
verticalAlign: 'middle',
},
'text'
)
try {
const wv = typeof plus?.webview?.currentWebview === 'function' ? plus.webview.currentWebview() : null
if (wv && typeof wv.append === 'function') {
wv.append(nativeSkipView)
}
} catch (e) {}
nativeSkipView.show()
useNativeSkip.value = true
} catch (e) {
destroyNativeSkipView()
}
}
function updateNativeSkipText() {
try {
if (!nativeSkipView) return
const screenWidth = Number(plus?.screen?.resolutionWidth || 0)
if (!screenWidth) return
const pxPerRpx = screenWidth / 750
const widthPx = Math.round(pxPerRpx * 180)
const heightPx = Math.round(pxPerRpx * 64)
const fontPx = Math.round(pxPerRpx * 28)
nativeSkipView.drawText(
getSkipText(),
{
top: '0px',
left: '0px',
width: `${widthPx}px`,
height: `${heightPx}px`,
},
{
size: `${fontPx}px`,
color: '#ffffff',
align: 'center',
verticalAlign: 'middle',
},
'text'
)
} catch (e) {}
}
function clearTimers() {
if (readyFallbackTimer) clearTimeout(readyFallbackTimer)
readyFallbackTimer = null
@@ -158,6 +277,7 @@ function clearTimers() {
jumpTimer = null
if (videoCountdownBootTimer) clearTimeout(videoCountdownBootTimer)
videoCountdownBootTimer = null
destroyNativeSkipView()
}
function startCountDown(seconds) {
@@ -203,8 +323,8 @@ function onVideoReady() {
videoCountdownBootTimer = setTimeout(() => {
videoCountdownBootTimer = null
if (countDownTimer) return
startCountDown(MAX_VIDEO_SECONDS)
scheduleJumpAfter(MAX_VIDEO_SECONDS + 0.2)
startCountDown(FIXED_VIDEO_SECONDS)
scheduleJumpAfter(FIXED_VIDEO_SECONDS + 0.2)
}, 300)
}
@@ -218,24 +338,22 @@ function onVideoMetadata(e) {
isLoading.value = false
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
startCountDown(limit)
scheduleJumpAfter(limit + 0.2)
startCountDown(FIXED_VIDEO_SECONDS)
scheduleJumpAfter(FIXED_VIDEO_SECONDS + 0.2)
}
function onVideoTimeUpdate(e) {
const duration = Number(e?.detail?.duration || e?.detail?.totalTime || 0)
if (!Number.isFinite(duration) || duration <= 0) return
const limit = Math.min(MAX_VIDEO_SECONDS, Math.ceil(duration))
if (countDown.value === limit) return
if (countDownTimer && countDown.value < MAX_VIDEO_SECONDS) return
if (videoCountdownBootTimer) {
clearTimeout(videoCountdownBootTimer)
videoCountdownBootTimer = null
const currentTime = Number(e?.detail?.currentTime || 0)
if (!Number.isFinite(currentTime) || currentTime <= 0) return
const loopDetected = lastVideoTime > 0.4 && currentTime + 0.2 < lastVideoTime
lastVideoTime = currentTime
if (loopDetected) {
toHome()
return
}
if (currentTime + 0.12 >= FIXED_VIDEO_SECONDS) {
toHome()
}
startCountDown(limit)
scheduleJumpAfter(limit + 0.2)
}
function onVideoEnded() {
@@ -288,6 +406,39 @@ function onMediaClick() {
return
}
}
watch(
[() => isVideo.value, () => countDown.value],
([v, s]) => {
if (!v || s <= 0) {
destroyNativeSkipView()
return
}
if (typeof plus !== 'undefined') {
ensureNativeSkipView()
updateNativeSkipText()
return
}
if (plusReadyListenerBound) return
plusReadyListenerBound = true
try {
if (typeof document !== 'undefined' && document?.addEventListener) {
document.addEventListener(
'plusready',
() => {
plusReadyListenerBound = false
if (isVideo.value && countDown.value > 0) {
ensureNativeSkipView()
updateNativeSkipText()
}
},
{ once: true }
)
}
} catch (e) {}
},
{ immediate: true }
)
</script>
<style lang="scss" scoped>
.start-page {
@@ -303,6 +454,7 @@ function onMediaClick() {
inset: 0;
width: 100vw;
height: 100vh;
z-index: 0;
}
.count-down {
position: absolute;
@@ -315,7 +467,7 @@ function onMediaClick() {
line-height: 32rpx;
color: #fff;
background: rgba(0, 0, 0, 0.4);
z-index: 9999;
z-index: 999999;
display: flex;
align-items: center;
justify-content: center;