feat:最新

This commit is contained in:
李伊帆
2026-11-02 08:14:48 +08:00
parent 98402548eb
commit 2ec91cca26
8 changed files with 45 additions and 14 deletions

View File

@@ -23,7 +23,7 @@ withDefaults(
visible?: boolean
title?: string
desc?: string
/** 顶部留白(状态栏+导航),保证返回可点 */
/** 顶部留白(状态栏+导航),保证返回/设置可点 */
topOffsetPx?: number
}>(),
{

View File

@@ -34,7 +34,8 @@
.device-detail-hero__bar {
position: relative;
z-index: 1;
/* 高于连接遮罩,保证加载中返回/设置可点 */
z-index: 10001;
height: 88rpx;
display: flex;
align-items: center;

View File

@@ -158,12 +158,12 @@
/>
<run-mode-explain-dialog v-model:visible="runModeExplainVisible" />
<!-- 页面居中加载,挡住下方操作区;顶栏返回仍可点 -->
<!-- 页面居中加载,挡住下方操作区;顶栏返回/设置仍可点 -->
<ble-reconnect-loading
:visible="showReconnectLoading"
:title="reconnectLoadingTitle"
:desc="reconnectLoadingDesc"
:top-offset-px="statusBarHeight + 44"
:top-offset-px="statusBarHeight + navBarHeightPx"
/>
</view>
</template>
@@ -178,6 +178,8 @@ import RunModeExplainDialog from './components/run-mode-explain-dialog/index.vue
import { useDeviceDetail } from './use-device-detail'
const statusBarHeight = ref(uni.getSystemInfoSync().statusBarHeight ?? 0)
/** 与 .device-detail-hero__bar 高度 88rpx 对齐,避免遮罩盖住设置按钮 */
const navBarHeightPx = uni.upx2px(88)
const { scrollStyle: detailScrollStyle } = usePageScrollHeight({
topSelector: '.device-detail-hero',
})

View File

@@ -288,7 +288,6 @@ export function useDeviceDetail() {
}
function onSettings() {
if (showReconnectLoading.value) return
if (!deviceId.value) {
uni.showToast({ title: '设备信息不完整', icon: 'none' })
return

View File

@@ -3,6 +3,10 @@ import { computed, ref } from 'vue'
import { cancelAccount, logout } from '@/api/auth'
import { fetchProfile } from '@/api/profile'
import { getErrorMessage } from '@/utils/api-error'
import {
beginVoluntaryLogout,
endVoluntaryLogout,
} from '@/utils/auth-session'
import { teardownMessageInbox } from '@/hooks/use-message-inbox'
import { clearLocalUserData } from '@/utils/clear-local-user-data'
import { clearAppFileCacheOnDevice } from '@/pages/mine/storage/storage.utils'
@@ -86,9 +90,10 @@ export function usePrivacy() {
async function onConfirmCancelAccount() {
if (cancelingAccount.value) return
cancelingAccount.value = true
beginVoluntaryLogout()
try {
await cancelAccount()
teardownMessageInbox()
await cancelAccount()
clearLocalUserData()
try {
await clearAppFileCacheOnDevice()
@@ -98,10 +103,13 @@ export function usePrivacy() {
uni.showToast({ title: '账号已注销', icon: 'success' })
uni.reLaunch({ url: '/pages/login/index' })
} catch (err) {
endVoluntaryLogout()
uni.showToast({ title: getErrorMessage(err, '注销失败'), icon: 'none' })
} finally {
cancelingAccount.value = false
}
// 成功跳转后稍后再关,避免在途 401 仍弹「登录状态异常」
setTimeout(() => endVoluntaryLogout(), 1500)
}
function onLogout() {
@@ -111,17 +119,19 @@ export function usePrivacy() {
success: (res) => {
if (!res.confirm) return
void (async () => {
beginVoluntaryLogout()
try {
await logout()
} catch (err) {
uni.showToast({
title: getErrorMessage(err, '退出登录失败'),
icon: 'none',
})
} finally {
// 先停消息通道,避免 logout 后在途请求 401 误报
teardownMessageInbox()
try {
await logout()
} catch {
// 服务端退出失败仍清本地登录态
}
clearLocalUserData()
uni.reLaunch({ url: '/pages/login/index' })
} finally {
setTimeout(() => endVoluntaryLogout(), 1500)
}
})()
},