style: 优化暗黑主题下组件的样式
This commit is contained in:
parent
8f09eee8e5
commit
2c0f311041
@ -5,7 +5,7 @@ import { localStg } from '@/utils/storage';
|
|||||||
import systemLogo from '@/assets/svg-icon/full-logo.svg?raw';
|
import systemLogo from '@/assets/svg-icon/full-logo.svg?raw';
|
||||||
|
|
||||||
export function setupLoading() {
|
export function setupLoading() {
|
||||||
const themeColor = localStg.get('themeColor') || '#646cff';
|
const themeColor = localStg.get('themeColor') || '#22aae3';
|
||||||
|
|
||||||
const { r, g, b } = getRgbOfColor(themeColor);
|
const { r, g, b } = getRgbOfColor(themeColor);
|
||||||
|
|
||||||
@ -27,14 +27,14 @@ export function setupLoading() {
|
|||||||
.join('\n');
|
.join('\n');
|
||||||
|
|
||||||
const loading = `
|
const loading = `
|
||||||
<div class="fixed-center flex-col" style="${primaryColor}">
|
<div class="fixed-center flex-col dark:bg-#121212" style="${primaryColor}">
|
||||||
${logoWithClass}
|
${logoWithClass}
|
||||||
<div class="w-42px h-42px my-36px">
|
<div class="w-42px h-42px my-36px">
|
||||||
<div class="relative h-full animate-spin">
|
<div class="relative h-full animate-spin">
|
||||||
${dot}
|
${dot}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<h2 class="text-18px font-500 pt-32px w-80% text-center text-#646464">${$t('system.desc')}</h2>
|
<h2 class="text-18px font-500 pt-32px w-80% text-center text-#646464 dark:#d6d6d6">${$t('system.desc')}</h2>
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
const app = document.getElementById('app');
|
const app = document.getElementById('app');
|
||||||
|
@ -2,10 +2,13 @@
|
|||||||
import { computed, nextTick, onUnmounted, reactive } from 'vue';
|
import { computed, nextTick, onUnmounted, reactive } from 'vue';
|
||||||
import { createReusableTemplate } from '@vueuse/core';
|
import { createReusableTemplate } from '@vueuse/core';
|
||||||
import { useRouter } from 'vue-router';
|
import { useRouter } from 'vue-router';
|
||||||
|
import { getColorPalette } from '@sa/utils';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
import DardRetryChart from './card-retry-chart.vue';
|
import DardRetryChart from './card-retry-chart.vue';
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'CardData'
|
name: 'CardData'
|
||||||
@ -207,7 +210,9 @@ interface GradientBgProps {
|
|||||||
const [DefineGradientBg, GradientBg] = createReusableTemplate<GradientBgProps>();
|
const [DefineGradientBg, GradientBg] = createReusableTemplate<GradientBgProps>();
|
||||||
|
|
||||||
function getGradientColor(color: CardData['color']) {
|
function getGradientColor(color: CardData['color']) {
|
||||||
return `linear-gradient(to bottom right, ${color.start}, ${color.end})`;
|
const start = themeStore.darkMode ? getColorPalette(color.start, 7) : color.start;
|
||||||
|
const end = themeStore.darkMode ? getColorPalette(color.end, 7) : color.end;
|
||||||
|
return `linear-gradient(to bottom right, ${start}, ${end})`;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { watch } from 'vue';
|
import { watch } from 'vue';
|
||||||
|
import { getColorPalette } from '@sa/utils';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useEcharts } from '@/hooks/common/echarts';
|
import { useEcharts } from '@/hooks/common/echarts';
|
||||||
|
import { useThemeStore } from '@/store/modules/theme';
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'PieRetryChart'
|
name: 'PieRetryChart'
|
||||||
@ -18,6 +20,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
const themeStore = useThemeStore();
|
||||||
|
|
||||||
const { domRef, updateOptions } = useEcharts(() => ({
|
const { domRef, updateOptions } = useEcharts(() => ({
|
||||||
tooltip: {
|
tooltip: {
|
||||||
@ -33,14 +36,14 @@ const { domRef, updateOptions } = useEcharts(() => ({
|
|||||||
},
|
},
|
||||||
series: [
|
series: [
|
||||||
{
|
{
|
||||||
color: ['#5da8ff', '#8e9dff', '#fedc69', '#26deca'],
|
color: [getColor('#5da8ff'), getColor('#8e9dff'), getColor('#fedc69'), getColor('#26deca')],
|
||||||
name: $t('page.home.retryTab.pie.title'),
|
name: $t('page.home.retryTab.pie.title'),
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: ['45%', '75%'],
|
radius: ['45%', '75%'],
|
||||||
avoidLabelOverlap: false,
|
avoidLabelOverlap: false,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
borderColor: '#fff',
|
borderColor: themeStore.darkMode ? '#18181c' : '#fff',
|
||||||
borderWidth: 1
|
borderWidth: 1
|
||||||
},
|
},
|
||||||
label: {
|
label: {
|
||||||
@ -61,6 +64,10 @@ const { domRef, updateOptions } = useEcharts(() => ({
|
|||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
function getColor(color: string) {
|
||||||
|
return themeStore.darkMode ? getColorPalette(color, 7) : color;
|
||||||
|
}
|
||||||
|
|
||||||
const getData = async () => {
|
const getData = async () => {
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
setTimeout(resolve, 1);
|
setTimeout(resolve, 1);
|
||||||
@ -71,9 +78,16 @@ const getData = async () => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateLocale();
|
||||||
|
};
|
||||||
|
|
||||||
|
function updateLocale() {
|
||||||
updateOptions((opts, factory) => {
|
updateOptions((opts, factory) => {
|
||||||
const originOpts = factory();
|
const originOpts = factory();
|
||||||
opts.series[0].name = originOpts.series[0].name;
|
opts.series[0].name = originOpts.series[0].name;
|
||||||
|
opts.series[0].color = originOpts.series[0].color;
|
||||||
|
opts.series[0].itemStyle.borderColor = originOpts.series[0].itemStyle.borderColor;
|
||||||
|
|
||||||
if (props.type === 0) {
|
if (props.type === 0) {
|
||||||
const retryTask = props.modelValue.retryTask;
|
const retryTask = props.modelValue.retryTask;
|
||||||
opts.series[0].data = [
|
opts.series[0].data = [
|
||||||
@ -103,19 +117,19 @@ const getData = async () => {
|
|||||||
}
|
}
|
||||||
return opts;
|
return opts;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => appStore.locale,
|
() => appStore.locale,
|
||||||
() => {
|
() => {
|
||||||
getData();
|
updateLocale();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
watch(
|
watch(
|
||||||
() => props.modelValue,
|
() => themeStore.darkMode,
|
||||||
() => {
|
() => {
|
||||||
getData();
|
updateLocale();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -126,6 +140,13 @@ watch(
|
|||||||
},
|
},
|
||||||
{ immediate: true }
|
{ immediate: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
|
watch(
|
||||||
|
() => props.modelValue,
|
||||||
|
() => {
|
||||||
|
getData();
|
||||||
|
}
|
||||||
|
);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -228,15 +228,15 @@ watch(
|
|||||||
.retry-table-number {
|
.retry-table-number {
|
||||||
padding: 3px 7px;
|
padding: 3px 7px;
|
||||||
background-color: #f4f4f4;
|
background-color: #f4f4f4;
|
||||||
color: #555;
|
color: #d6d6d6;
|
||||||
text-shadow: none !important;
|
text-shadow: none !important;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark .retry-table-number {
|
.dark .retry-table-number {
|
||||||
background: #000;
|
background: #2c2c2c;
|
||||||
color: #aaa;
|
color: #d6d6d6;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -304,18 +304,18 @@ watch(
|
|||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
.retry-tab-badge {
|
.retry-tab-badge {
|
||||||
background: #000;
|
background: #2c2c2c;
|
||||||
color: #aaa;
|
color: #d6d6d6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.retry-tab-rank {
|
.retry-tab-rank {
|
||||||
&__list {
|
&__list {
|
||||||
&--index {
|
&--index {
|
||||||
color: #aaa;
|
color: #d6d6d6;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--item {
|
&--item {
|
||||||
border: 1px solid #000;
|
border: 1px solid #646464;
|
||||||
}
|
}
|
||||||
|
|
||||||
&--item:hover {
|
&--item:hover {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useNaiveForm } from '@/hooks/common/form';
|
import { useNaiveForm } from '@/hooks/common/form';
|
||||||
@ -16,6 +17,8 @@ const emit = defineEmits<Emits>();
|
|||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
const title = ref(appStore.isMobile ? $t('common.search') : undefined);
|
||||||
|
|
||||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||||
|
|
||||||
const model = defineModel<Api.Namespace.NamespaceSearchParams>('model', { required: true });
|
const model = defineModel<Api.Namespace.NamespaceSearchParams>('model', { required: true });
|
||||||
@ -32,7 +35,7 @@ async function search() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NCard :bordered="false" size="small" class="card-wrapper">
|
<NCard :title="title" :bordered="false" size="small" class="card-wrapper">
|
||||||
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80" :show-feedback="appStore.isMobile">
|
<NForm ref="formRef" :model="model" label-placement="left" :label-width="80" :show-feedback="appStore.isMobile">
|
||||||
<NGrid responsive="screen" item-responsive>
|
<NGrid responsive="screen" item-responsive>
|
||||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.namespace.keyword')" path="userName" class="pr-24px">
|
<NFormItemGi span="24 s:12 m:6" :label="$t('page.namespace.keyword')" path="userName" class="pr-24px">
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue';
|
||||||
import { $t } from '@/locales';
|
import { $t } from '@/locales';
|
||||||
import { useAppStore } from '@/store/modules/app';
|
import { useAppStore } from '@/store/modules/app';
|
||||||
import { useNaiveForm } from '@/hooks/common/form';
|
import { useNaiveForm } from '@/hooks/common/form';
|
||||||
@ -16,6 +17,8 @@ const emit = defineEmits<Emits>();
|
|||||||
|
|
||||||
const appStore = useAppStore();
|
const appStore = useAppStore();
|
||||||
|
|
||||||
|
const title = ref(appStore.isMobile ? $t('common.search') : undefined);
|
||||||
|
|
||||||
const { formRef, validate, restoreValidation } = useNaiveForm();
|
const { formRef, validate, restoreValidation } = useNaiveForm();
|
||||||
|
|
||||||
const model = defineModel<Api.Dashboard.DashboardPodsParams>('model', { required: true });
|
const model = defineModel<Api.Dashboard.DashboardPodsParams>('model', { required: true });
|
||||||
@ -32,7 +35,7 @@ async function search() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<NCard :bordered="false" size="small" class="card-wrapper">
|
<NCard :title="title" :bordered="false" size="small" class="card-wrapper">
|
||||||
<NForm ref="formRef" :model="model" label-placement="left" :label-width="60" :show-feedback="appStore.isMobile">
|
<NForm ref="formRef" :model="model" label-placement="left" :label-width="60" :show-feedback="appStore.isMobile">
|
||||||
<NGrid responsive="screen" item-responsive>
|
<NGrid responsive="screen" item-responsive>
|
||||||
<NFormItemGi span="24 s:12 m:6" :label="$t('page.pods.groupName')" path="groupName" class="pr-24px">
|
<NFormItemGi span="24 s:12 m:6" :label="$t('page.pods.groupName')" path="groupName" class="pr-24px">
|
||||||
|
Loading…
Reference in New Issue
Block a user