未验证 提交 dc4b0527 编写于 作者: C Carson 提交者: GitHub

refactor(dashboard): adjust the spacing of Card under the small screen (#1399)

Co-authored-by: Nhuguangju <huguangju@wowkai.cn>
上级 b8411c93
...@@ -14,6 +14,7 @@ export const demoListApi = (params: DemoParams) => ...@@ -14,6 +14,7 @@ export const demoListApi = (params: DemoParams) =>
url: Api.DEMO_LIST, url: Api.DEMO_LIST,
params, params,
headers: { headers: {
// @ts-ignore
ignoreCancelToken: true, ignoreCancelToken: true,
}, },
}); });
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
:title="title" :title="title"
v-bind="omit($attrs, 'class')" v-bind="omit($attrs, 'class')"
ref="headerRef" ref="headerRef"
v-if="content || $slots.headerContent || title || getHeaderSlots.length" v-if="getShowHeader"
> >
<template #default> <template #default>
<template v-if="content"> <template v-if="content">
...@@ -99,6 +99,10 @@ ...@@ -99,6 +99,10 @@
]; ];
}); });
const getShowHeader = computed(
() => props.content || slots?.headerContent || props.title || getHeaderSlots.value.length,
);
const getShowFooter = computed(() => slots?.leftFooter || slots?.rightFooter); const getShowFooter = computed(() => slots?.leftFooter || slots?.rightFooter);
const getHeaderSlots = computed(() => { const getHeaderSlots = computed(() => {
...@@ -150,6 +154,7 @@ ...@@ -150,6 +154,7 @@
getClass, getClass,
getHeaderSlots, getHeaderSlots,
prefixCls, prefixCls,
getShowHeader,
getShowFooter, getShowFooter,
omit, omit,
getContentClass, getContentClass,
......
import { tryOnMounted, tryOnUnmounted } from '@vueuse/core'; import { tryOnMounted, tryOnUnmounted, useDebounceFn } from '@vueuse/core';
import { useDebounceFn } from '@vueuse/core';
interface WindowSizeOptions { interface WindowSizeOptions {
once?: boolean; once?: boolean;
......
import { cacheCipher } from '/@/settings/encryptionSetting'; import { cacheCipher } from '/@/settings/encryptionSetting';
import type { EncryptionParams } from '/@/utils/cipher'; import type { EncryptionParams } from '/@/utils/cipher';
import { AesEncryption } from '/@/utils/cipher'; import { AesEncryption } from '/@/utils/cipher';
import { isNullOrUnDef } from '/@/utils/is'; import { isNullOrUnDef } from '/@/utils/is';
export interface CreateStorageParams extends EncryptionParams { export interface CreateStorageParams extends EncryptionParams {
...@@ -27,8 +24,8 @@ export const createStorage = ({ ...@@ -27,8 +24,8 @@ export const createStorage = ({
const encryption = new AesEncryption({ key, iv }); const encryption = new AesEncryption({ key, iv });
/** /**
*Cache class * Cache class
*Construction parameters can be passed into sessionStorage, localStorage, * Construction parameters can be passed into sessionStorage, localStorage,
* @class Cache * @class Cache
* @example * @example
*/ */
...@@ -53,11 +50,10 @@ export const createStorage = ({ ...@@ -53,11 +50,10 @@ export const createStorage = ({
} }
/** /**
* * Set cache
* Set cache
* @param {string} key * @param {string} key
* @param {*} value * @param {*} value
* @expire Expiration time in seconds * @param {*} expire Expiration time in seconds
* @memberof Cache * @memberof Cache
*/ */
set(key: string, value: any, expire: number | null = timeout) { set(key: string, value: any, expire: number | null = timeout) {
...@@ -73,8 +69,9 @@ export const createStorage = ({ ...@@ -73,8 +69,9 @@ export const createStorage = ({
} }
/** /**
*Read cache * Read cache
* @param {string} key * @param {string} key
* @param {*} def
* @memberof Cache * @memberof Cache
*/ */
get(key: string, def: any = null): any { get(key: string, def: any = null): any {
......
...@@ -3,7 +3,7 @@ import { ...@@ -3,7 +3,7 @@ import {
// FunctionalComponent, CSSProperties // FunctionalComponent, CSSProperties
} from 'vue'; } from 'vue';
import { Spin } from 'ant-design-vue'; import { Spin } from 'ant-design-vue';
import { noop } from '/@/utils/index'; import { noop } from '/@/utils';
// const Loading: FunctionalComponent<{ size: 'small' | 'default' | 'large' }> = (props) => { // const Loading: FunctionalComponent<{ size: 'small' | 'default' | 'large' }> = (props) => {
// const style: CSSProperties = { // const style: CSSProperties = {
......
...@@ -5,15 +5,14 @@ ...@@ -5,15 +5,14 @@
size="small" size="small"
:loading="loading" :loading="loading"
:title="item.title" :title="item.title"
class="md:w-1/4 w-full !md:mt-0 !mt-4" class="md:w-1/4 w-full !md:mt-0"
:class="[index + 1 < 4 && '!md:mr-4']" :class="{ '!md:mr-4': index + 1 < 4, '!mt-4': index > 0 }"
:canExpan="false"
> >
<template #extra> <template #extra>
<Tag :color="item.color">{{ item.action }}</Tag> <Tag :color="item.color">{{ item.action }}</Tag>
</template> </template>
<div class="py-4 px-4 flex justify-between"> <div class="py-4 px-4 flex justify-between items-center">
<CountTo prefix="$" :startVal="1" :endVal="item.value" class="text-2xl" /> <CountTo prefix="$" :startVal="1" :endVal="item.value" class="text-2xl" />
<Icon :icon="item.icon" :size="40" /> <Icon :icon="item.icon" :size="40" />
</div> </div>
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
const chartRef = ref<HTMLDivElement | null>(null); const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
watch( watch(
() => props.loading, () => props.loading,
() => { () => {
......
<template> <template>
<div ref="chartRef" :style="{ height, width }"></div> <div ref="chartRef" :style="{ height, width }"></div>
</template> </template>
<script lang="ts">
import { basicProps } from './props';
</script>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, Ref } from 'vue'; import { onMounted, ref, Ref } from 'vue';
import { useECharts } from '/@/hooks/web/useECharts'; import { useECharts } from '/@/hooks/web/useECharts';
import { basicProps } from './props';
defineProps({ defineProps({
...basicProps, ...basicProps,
...@@ -26,26 +28,7 @@ ...@@ -26,26 +28,7 @@
xAxis: { xAxis: {
type: 'category', type: 'category',
boundaryGap: false, boundaryGap: false,
data: [ data: [...new Array(18)].map((_item, index) => `${index + 6}:00`),
'6:00',
'7:00',
'8:00',
'9:00',
'10:00',
'11:00',
'12:00',
'13:00',
'14:00',
'15:00',
'16:00',
'17:00',
'18:00',
'19:00',
'20:00',
'21:00',
'22:00',
'23:00',
],
splitLine: { splitLine: {
show: true, show: true,
lineStyle: { lineStyle: {
......
<template> <template>
<div ref="chartRef" :style="{ height, width }"></div> <div ref="chartRef" :style="{ height, width }"></div>
</template> </template>
<script lang="ts">
import { basicProps } from './props';
</script>
<script lang="ts" setup> <script lang="ts" setup>
import { onMounted, ref, Ref } from 'vue'; import { onMounted, ref, Ref } from 'vue';
import { useECharts } from '/@/hooks/web/useECharts'; import { useECharts } from '/@/hooks/web/useECharts';
import { basicProps } from './props';
defineProps({ defineProps({
...basicProps, ...basicProps,
...@@ -26,20 +28,7 @@ ...@@ -26,20 +28,7 @@
grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true }, grid: { left: '1%', right: '1%', top: '2 %', bottom: 0, containLabel: true },
xAxis: { xAxis: {
type: 'category', type: 'category',
data: [ data: [...new Array(12)].map((_item, index) => `${index + 1}月`),
'1月',
'2月',
'3月',
'4月',
'5月',
'6月',
'7月',
'8月',
'9月',
'10月',
'11月',
'12月',
],
}, },
yAxis: { yAxis: {
type: 'value', type: 'value',
......
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
default: '300px', default: '300px',
}, },
}); });
const chartRef = ref<HTMLDivElement | null>(null); const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
watch( watch(
() => props.loading, () => props.loading,
() => { () => {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
}); });
const chartRef = ref<HTMLDivElement | null>(null); const chartRef = ref<HTMLDivElement | null>(null);
const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>); const { setOptions } = useECharts(chartRef as Ref<HTMLDivElement>);
watch( watch(
() => props.loading, () => props.loading,
() => { () => {
......
...@@ -4,19 +4,17 @@ ...@@ -4,19 +4,17 @@
<a-button type="link" size="small">更多</a-button> <a-button type="link" size="small">更多</a-button>
</template> </template>
<template v-for="item in items" :key="item"> <CardGrid v-for="item in items" :key="item" class="!md:w-1/3 !w-full">
<CardGrid class="!md:w-1/3 !w-full"> <span class="flex">
<span class="flex"> <Icon :icon="item.icon" :color="item.color" size="30" />
<Icon :icon="item.icon" :color="item.color" size="30" /> <span class="text-lg ml-4">{{ item.title }}</span>
<span class="text-lg ml-4">{{ item.title }}</span> </span>
</span> <div class="flex mt-2 h-10 text-secondary">{{ item.desc }}</div>
<div class="flex mt-2 h-10 text-secondary">{{ item.desc }}</div> <div class="flex justify-between text-secondary">
<div class="flex justify-between text-secondary"> <span>{{ item.group }}</span>
<span>{{ item.group }}</span> <span>{{ item.date }}</span>
<span>{{ item.date }}</span> </div>
</div> </CardGrid>
</CardGrid>
</template>
</Card> </Card>
</template> </template>
<script lang="ts"> <script lang="ts">
......
<template> <template>
<Card title="快捷导航" v-bind="$attrs"> <Card title="快捷导航" v-bind="$attrs">
<template v-for="item in navItems" :key="item"> <CardGrid v-for="item in navItems" :key="item">
<CardGrid> <span class="flex flex-col items-center">
<span class="flex flex-col items-center"> <Icon :icon="item.icon" :color="item.color" size="20" />
<Icon :icon="item.icon" :color="item.color" size="20" /> <span class="text-md mt-2">{{ item.title }}</span>
<span class="text-md mt-2">{{ item.title }}</span> </span>
</span> </CardGrid>
</CardGrid>
</template>
</Card> </Card>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册