feat: 登录提示语根据语言设置&&主题颜色保存

Former-commit-id: d31b3c6adc4e620b4509e46119c43e64b53e48ad
This commit is contained in:
april
2023-09-26 18:24:04 +08:00
parent 4e8d9f744d
commit 07f189f585
6 changed files with 93 additions and 12 deletions

View File

@@ -76,14 +76,21 @@ const themeColors = ref<string[]>([
*/
function changeThemeColor(color: string) {
document.documentElement.style.setProperty("--el-color-primary", color);
// settingsStore.changeSetting({ key: "layout", value: color });
settingsStore.changeSetting({ key: "themeColor", value: color });
}
const currentThemeColor = computed(() => {
return settingsStore.themeColor;
});
onMounted(() => {
window.document.body.setAttribute("layout", settingsStore.layout);
const theme =
localStorage.getItem("vueuse-color-scheme") || defaultSettings.theme;
localStorage.setItem("vueuse-color-scheme", theme);
document.documentElement.style.setProperty(
"--el-color-primary",
settingsStore.themeColor
);
});
</script>
@@ -126,10 +133,12 @@ onMounted(() => {
<li
v-for="(color, index) in themeColors"
:key="index"
class="inline-block w-[30px] h-[30px] cursor-pointer"
class="inline-block w-[30px] h-[30px] cursor-pointer theme-wrap"
:style="{ background: color }"
@click="changeThemeColor(color)"
></li>
>
<i-ep-check v-show="color === currentThemeColor" />
</li>
</ul>
<el-divider>导航设置</el-divider>
@@ -240,5 +249,12 @@ onMounted(() => {
box-shadow: 0 0 1px #888;
}
}
.theme-wrap {
display: flex;
align-items: center;
justify-content: center;
color: #fff;
}
}
</style>

View File

@@ -121,7 +121,8 @@ function isFirstView() {
try {
return (
(selectedTag.value as TagView).fullPath === "/dashboard" ||
(selectedTag.value as TagView).fullPath === tagsViewStore.visitedViews[1].fullPath
(selectedTag.value as TagView).fullPath ===
tagsViewStore.visitedViews[1].fullPath
);
} catch (err) {
return false;