huangzheng 6 سال پیش
والد
کامیت
600332e683
2فایلهای تغییر یافته به همراه11 افزوده شده و 7 حذف شده
  1. 6 4
      config/plugin.config.ts
  2. 5 3
      src/models/setting.ts

+ 6 - 4
config/plugin.config.ts

@@ -46,7 +46,7 @@ export default (config: any) => {
         fileName: 'css/theme-colors.css',
         matchColors: getAntdSerials('#1890ff'), // 主色系列
         // 改变样式选择器,解决样式覆盖问题
-        changeSelector(selector) {
+        changeSelector(selector: string) {
           switch (selector) {
             case '.ant-calendar-today .ant-calendar-date':
               return ':not(.ant-calendar-selected-date)' + selector;
@@ -103,10 +103,12 @@ export default (config: any) => {
     });
 };
 
-function getAntdSerials(color) {
+const getAntdSerials = (color: string) => {
+  const lightNum = 9;
+  const devide10 = 10;
   // 淡化(即less的tint)
-  const lightens = new Array(9).fill().map((t, i) => {
-    return ThemeColorReplacer.varyColor.lighten(color, i / 10);
+  const lightens = new Array(lightNum).fill().map((t, i) => {
+    return ThemeColorReplacer.varyColor.lighten(color, i / devide10);
   });
   const colorPalettes = generate(color);
   return lightens.concat(colorPalettes);

+ 5 - 3
src/models/setting.ts

@@ -12,9 +12,11 @@ export interface SettingModelType {
   };
 }
 
-const updateTheme = (newPrimaryColor:string) => {
-  const hideMessage = message.loading('正在切换主题!', 0);
-  themeColorClient.changeColor(newPrimaryColor).finally(() => hideMessage());
+const updateTheme = (newPrimaryColor?: string) => {
+  const timeOut = 0;
+  const hideMessage = message.loading('正在切换主题!', timeOut);
+  themeColorClient.changeColor(newPrimaryColor)
+    .finally(() => hideMessage());
 };
 
 /*