fix:OTA弹窗+wifi页面结构样式修改

This commit is contained in:
2026-06-01 16:44:08 +08:00
parent 8ef64f8f42
commit 7a00c1bb1f
25 changed files with 1139 additions and 1 deletions
+62 -1
View File
@@ -6,6 +6,7 @@ import AppFooter from "@/components/AppFooter.vue";
import UserHeader from "@/components/UserHeader.vue";
import Signin from "@/components/Signin.vue";
import BubbleTip from "@/components/BubbleTip.vue";
import OtaModal from "@/components/OtaModal.vue";
import {
checkUserBindAPI,
@@ -36,6 +37,44 @@ const showModal = ref(false);
const showGuide = ref(false);
const scoreRankList = ref([]);
// OTA 相关
const otaVisible = ref(false);
const otaState = ref("new_version");
const OTA_MOCK = {
hasUpdate: true,
version: "V8.7.0",
description: "新版本将优化智能弓体验",
details: "升级前请确保:\n1、智能弓已开启,且电量充足\n2、所处稳定的 Wi-Fi 环境中。",
forceUpdate: false,
};
const checkOtaUpdate = () => {
if (!OTA_MOCK.hasUpdate) return;
const dismissedAt = uni.getStorageSync("ota_dismissed_at");
const now = Date.now();
if (dismissedAt && now - dismissedAt < 24 * 60 * 60 * 1000) return;
otaState.value = "new_version";
otaVisible.value = true;
};
const handleOtaDismiss = () => {
uni.setStorageSync("ota_dismissed_at", Date.now());
otaVisible.value = false;
};
const handleOtaUpdate = () => {
otaVisible.value = false;
uni.navigateTo({ url: "/pages/ota-wifi" });
};
const handleOtaDone = () => {
otaVisible.value = false;
};
const handleOtaRetry = () => {
otaVisible.value = false;
};
// 提取积分榜接口返回的榜单数组,兼容数组和对象两种返回格式。
const getScoreRankData = (result) => {
if (Array.isArray(result)) return result;
@@ -63,7 +102,15 @@ const toRankListPage = () => {
});
};
onShow(async () => {
onShow(async (options) => {
// 检查是否从 OTA 更新页面返回
if (options && options.updateResult) {
otaState.value = options.updateResult;
otaVisible.value = true;
} else {
checkOtaUpdate();
}
const env = uni.getAccountInfoSync().miniProgram.envVersion;
const token = uni.getStorageSync(`${env}_token`);
@@ -158,6 +205,20 @@ onShareTimeline(() => {
<template>
<Container :isHome="true" :showBackToGame="true">
<!-- OTA 升级弹窗使用 visible 控制显隐description 为副标题changelog 为详细说明 -->
<OtaModal
:visible="otaVisible"
:state="otaState"
:version="OTA_MOCK.version"
:description="OTA_MOCK.description"
:changelog="OTA_MOCK.details"
:forceUpdate="OTA_MOCK.forceUpdate"
@update="handleOtaUpdate"
@skip="handleOtaDismiss"
@close="handleOtaDismiss"
@done="handleOtaDone"
@retry="handleOtaRetry"
/>
<view class="container">
<view class="top-theme">
<!-- <image