RuoYi
2024-06-30 c01ac5ccacb2dc6ba1bf239c03370469b59a2ffc
src/layout/components/Settings/index.vue
@@ -38,7 +38,7 @@
    <div class="drawer-item">
      <span>开启 TopNav</span>
      <span class="comp-style">
        <el-switch v-model="settingsStore.topNav" class="drawer-switch" />
        <el-switch v-model="settingsStore.topNav" @change="topNavChange" class="drawer-switch" />
      </span>
    </div>
@@ -98,14 +98,24 @@
const storeSettings = computed(() => settingsStore);
const predefineColors = ref(["#409EFF", "#ff4500", "#ff8c00", "#ffd700", "#90ee90", "#00ced1", "#1e90ff", "#c71585"]);
/** 是否需要topnav */
function topNavChange(val) {
  if (!val) {
    appStore.toggleSideBarHide(false);
    permissionStore.setSidebarRouters(permissionStore.defaultRoutes);
  }
}
function themeChange(val) {
  settingsStore.theme = val;
  handleThemeStyle(val);
}
function handleTheme(val) {
  settingsStore.sideTheme = val;
  sideTheme.value = val;
}
function saveSetting() {
  proxy.$modal.loading("正在保存到本地,请稍候...");
  let layoutSetting = {
@@ -120,11 +130,13 @@
  localStorage.setItem("layout-setting", JSON.stringify(layoutSetting));
  setTimeout(proxy.$modal.closeLoading(), 1000)
}
function resetSetting() {
  proxy.$modal.loading("正在清除设置缓存并刷新,请稍候...");
  localStorage.removeItem("layout-setting")
  setTimeout("window.location.reload()", 1000)
}
function openSetting() {
  showSettings.value = true;
}