duy 5 ماه پیش
والد
کامیت
3b820d1b3a
2فایلهای تغییر یافته به همراه15 افزوده شده و 5 حذف شده
  1. 9 3
      src/store/modules/useProject.js
  2. 6 2
      src/views/config/index.vue

+ 9 - 3
src/store/modules/useProject.js

@@ -1,4 +1,4 @@
-import { computed, ref, watch } from 'vue'
+import { computed, nextTick, ref, watch } from 'vue'
 import { useAppStore } from '~src/store'
 import { isNullES } from 'js-fast-way'
 import { setElementMainColor } from 'js-fast-way'
@@ -31,10 +31,16 @@ export function useProject() {
         const id = '1891312830718746625'
         let isYunNan = pid === id
         if (isYunNan) {
+            useAppState.setThemeVal('light')
             setElementMainColor('#409eff')
-            let colorName = 'blue'
+            let colorName = 'light-blue'
             let theme = 'light'
-            document.documentElement.setAttribute('class', `${theme} color-${colorName}`)
+            nextTick(() => {
+                useAppState.setThemeVal('light')
+                useAppState.setTheme('light')
+                useAppState.setColorName('light-blue')
+                document.documentElement.setAttribute('class', `${theme} color-${colorName}`)
+            })
             return
         }
     }

+ 6 - 2
src/views/config/index.vue

@@ -1,6 +1,6 @@
 <template>
     <hc-new-card action-size="lg" class="hc-config-index" scrollbar>
-        <div class="text-lg font-medium mb-4">主题模式</div>
+        <div class="mb-4 text-lg font-medium">主题模式</div>
         <div class="hc-theme-box mb-8">
             <el-radio-group v-model="UserTheme" @change="ThemeTabsUpdate">
                 <template v-for="item in ThemeDatas" :key="index">
@@ -16,7 +16,7 @@
             </el-radio-group>
         </div>
 
-        <div class="text-lg font-medium mb-4">主题色</div>
+        <div class="mb-4 text-lg font-medium">主题色</div>
         <div class="hc-theme-box color-box mb-4">
             <template v-for="(item, index) in ColorConfigData" :key="index">
                 <div v-if="index < 5" :class="UserColorNmae === item.name ? 'active' : ''" class="item">
@@ -112,6 +112,8 @@ const ThemeConfigClick = (item) => {
     ThemeTabsUpdate(item?.key)
 }
 const ThemeTabsUpdate = (val) => {
+    console.log(val, 'val')
+    
     UserTheme.value = val
     useAppState.setTheme(val)
     if (val === 'auto') {
@@ -120,6 +122,8 @@ const ThemeTabsUpdate = (val) => {
         useAppState.setThemeVal(val)
     }
     let colorName = UserColorNmae.value || 'green'
+    console.log(colorName, 'colorName')
+    
     document.documentElement.setAttribute('class', `${val} color-${colorName}`)
 }