-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: 修复许可证失效主题切换错误问题 #7075
Merged
+3
−6
Merged
fix: 修复许可证失效主题切换错误问题 #7075
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -300,14 +300,14 @@ const search = async () => { | |
if (isProductPro.value) { | ||
const xpackRes = await getXpackSetting(); | ||
if (xpackRes) { | ||
form.theme = xpackRes.data.theme || globalStore.themeConfig.theme; | ||
form.theme = xpackRes.data.theme || globalStore.themeConfig.theme || 'light'; | ||
form.themeColor = JSON.parse(xpackRes.data.themeColor); | ||
globalStore.themeConfig.themeColor = xpackRes.data.themeColor; | ||
globalStore.themeConfig.theme = form.theme; | ||
form.proxyDocker = xpackRes.data.proxyDocker; | ||
} | ||
} else { | ||
form.theme = res.data.theme; | ||
form.theme = globalStore.themeConfig.theme || res.data.theme || 'light'; | ||
} | ||
}; | ||
|
||
|
@@ -395,10 +395,6 @@ const onSave = async (key: string, val: any) => { | |
} | ||
globalStore.themeConfig.primary = color; | ||
setPrimaryColor(color); | ||
MsgSuccess(i18n.t('commons.msg.operationSuccess')); | ||
loading.value = false; | ||
await search(); | ||
return; | ||
} | ||
} | ||
if (key === 'MenuTabs') { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个代码库中的函数是用于设置主题颜色和配置页面标题的。然而在当前版本中(2021年9月),它可能不再符合最新的设计标准或最佳实践。 建议修改此片段以遵循如下原则:
以下是根据上述指示进行调整后的代码: let theme;
// 根据需要从不同的来源获取主题信息
function getThemeInfo() {
// 模拟不同的数据来源并返回一个对象
}
const setThemePreference = (newTheme) => {}; 这样可以在不同场景下轻松地改变默认的配色方案和其他外观参数而不影响整个应用的可读性。 |
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
在这个代码中没有发现明显的错误或优化问题。
themeConfig
对象应该使用JSON.stringify来避免字符串格式化时丢失信息的问题。这样在异步操作后的数据结构可能会发生变化,如果不进行转换,可能会引发解析错误或者影响其他函数的结果准确性。所以可以改写为:
这个版本的逻辑更清晰,并确保了数据的安全性和有效性。