mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2025-12-11 10:22:48 +00:00
Update common.ts
This commit is contained in:
parent
070dd9ff61
commit
981fd22caa
@ -628,20 +628,21 @@ export function setThemeColor (path: string) {
|
||||
let currTheme = {};
|
||||
if (route != 'app') {
|
||||
try {
|
||||
currTheme = theme_color_list[route];
|
||||
if(currTheme && currTheme.theme){
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||
}else if( !currTheme && current_theme_color){
|
||||
configStore.themeColor = ''
|
||||
}else{
|
||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||
}
|
||||
currTheme = theme_color_list[route];
|
||||
if (currTheme && currTheme.theme) {
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync("current_theme_color", JSON.stringify(themeColorToHex(currTheme.theme)))
|
||||
} else if (!currTheme && current_theme_color) {
|
||||
configStore.themeColor = ""
|
||||
} else {
|
||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0]
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync("current_theme_color", JSON.stringify(themeColorToHex(currTheme.theme)))
|
||||
}
|
||||
} catch (e) {
|
||||
// 设置插件应用的主色调发生错误,若不存在则使用最后有效的主色调
|
||||
if(!current_theme_color && theme_color_list){
|
||||
|
||||
if(!current_theme_color && theme_color_list && theme_color_list.length>0){
|
||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||
@ -650,11 +651,11 @@ export function setThemeColor (path: string) {
|
||||
}
|
||||
}
|
||||
|
||||
}else if(!current_theme_color && theme_color_list){
|
||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0];
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync('current_theme_color', JSON.stringify(themeColorToHex(currTheme.theme)));
|
||||
}
|
||||
}else if (!current_theme_color && theme_color_list && theme_color_list.length > 0) {
|
||||
currTheme = theme_color_list.app || Object.values(theme_color_list)[0]
|
||||
configStore.themeColor = themeColorToHex(currTheme.theme)
|
||||
uni.setStorageSync("current_theme_color", JSON.stringify(themeColorToHex(currTheme.theme)))
|
||||
}
|
||||
}
|
||||
|
||||
export function themeColorToHex (param: any) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user