From aa15f061ba185b05f22c98a0a979c72d08bcd974 Mon Sep 17 00:00:00 2001 From: king <18310653075@163.com> Date: 星期二, 11 二月 2025 09:42:38 +0800 Subject: [PATCH] 2025-02-11 --- src/tabviews/home/index.jsx | 58 ++++++++++++++++++++++++++-------------------------------- 1 files changed, 26 insertions(+), 32 deletions(-) diff --git a/src/tabviews/home/index.jsx b/src/tabviews/home/index.jsx index a6a8a60..b26fe42 100644 --- a/src/tabviews/home/index.jsx +++ b/src/tabviews/home/index.jsx @@ -16,7 +16,7 @@ state = { loading: true, - background: sessionStorage.getItem('home_background'), + background: sessionStorage.getItem('home_background') || 'unset', waiting: true, view: '' } @@ -39,11 +39,11 @@ check = (times) => { times++ - if ((window.GLOB.mkThdMenus.length > 0 && window.GLOB.mkActions.loaded) || times > 50) { + if ((window.GLOB.mkThdMenus.size > 0 && window.GLOB.mkActions.loaded) || times > 50) { this.setState({ waiting: false }) - } else { + } else if (!window.GLOB.$error) { setTimeout(() => { this.check(times) }, 200) @@ -56,42 +56,36 @@ MenuID: this.props.MenuID } Api.getCacheConfig(_param).then(result => { - if (result.status) { - if (result.LongParam) { - let config = '' + let view = 'default' + if (result.status && result.LongParam) { + let config = '' - try { // 閰嶇疆淇℃伅瑙f瀽 - config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) - } catch (e) { - console.warn('Parse Failure') - config = '' - } - - if (!config || !config.enabled) { - this.setState({ - loading: false, - waiting: false, - view: 'default' - }) - } else { - this.setState({ - loading: false, - view: 'custom' - }) - } - } else { - this.setState({ - loading: false, - waiting: false, - view: 'default' - }) + try { // 閰嶇疆淇℃伅瑙f瀽 + config = JSON.parse(window.decodeURIComponent(window.atob(result.LongParam))) + } catch (e) { + console.warn('Parse Failure') + config = '' } - } else { + + if (config && config.enabled) { + view = 'custom' + } + } + + if (view === 'default') { this.setState({ loading: false, waiting: false, view: 'default' }) + } else { + this.setState({ + loading: false, + view: 'custom' + }) + } + + if (!result.status) { notification.warning({ top: 92, message: result.message, -- Gitblit v1.8.0