优化控制台
This commit is contained in:
parent
af14704631
commit
a647f8bd00
@ -31,8 +31,38 @@ export interface TypeConsole {
|
||||
|
||||
//获取主控台信息
|
||||
export function getConsoleInfo() {
|
||||
return http.request<TypeConsole>({
|
||||
url: '/dashboard/console',
|
||||
method: 'get',
|
||||
});
|
||||
return consoleInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟控制台数据
|
||||
*/
|
||||
const consoleInfo = {
|
||||
//访问量
|
||||
visits: {
|
||||
dayVisits: 32335,
|
||||
rise: 48,
|
||||
decline: 85,
|
||||
amount: 948113,
|
||||
},
|
||||
//销售额
|
||||
saleroom: {
|
||||
weekSaleroom: 90758,
|
||||
amount: 411553,
|
||||
degree: 38.245882,
|
||||
},
|
||||
//订单量
|
||||
orderLarge: {
|
||||
weekLarge: 35704,
|
||||
rise: 28,
|
||||
decline: 28,
|
||||
amount: 480578,
|
||||
},
|
||||
//成交额度
|
||||
volume: {
|
||||
weekLarge: 67800,
|
||||
rise: 96,
|
||||
decline: 81,
|
||||
amount: 826814,
|
||||
},
|
||||
};
|
||||
|
@ -1,113 +1,161 @@
|
||||
<template>
|
||||
<div class="console">
|
||||
<!--数据卡片-->
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
|
||||
<a-card size="small" :bordered="false" hoverable>
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<a-card title="访问量" size="small" :bordered="false" hoverable>
|
||||
<template #extra>
|
||||
<a-tag color="green">日</a-tag>
|
||||
</template>
|
||||
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
|
||||
<template v-else>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<img src="~@/assets/images/visits.svg" class="top-card-img" />
|
||||
<div class="pt-2">访问量</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<CountTo :startVal="1" :endVal="visits.dayVisits" class="text-3xl" />
|
||||
</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<div class="text-sn">
|
||||
日同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="visits.rise" />
|
||||
</div>
|
||||
<div>
|
||||
<a-typography-text type="secondary">周</a-typography-text>
|
||||
<div class="text-sn">
|
||||
周同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="visits.decline" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<a-typography-title :level="2" class="mb-0">
|
||||
<CountTo :startVal="1" :endVal="3232" class="text-3xl" />
|
||||
</a-typography-title>
|
||||
<div>
|
||||
<a-tag color="#18a058" round size="small"> +10% </a-tag>
|
||||
<ArrowUpOutlined style="color: #18a058" />
|
||||
<a-divider style="margin: 16px 0 10px 0" />
|
||||
<div class="flex justify-between py-1">
|
||||
<div class="text-sn"> 总访问量:</div>
|
||||
<div class="text-sn">
|
||||
<CountTo :startVal="1" :endVal="visits.amount" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
|
||||
<a-card size="small" :bordered="false" hoverable>
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<a-card title="销售额" size="small" :bordered="false" hoverable>
|
||||
<template #extra>
|
||||
<a-tag color="blue">周</a-tag>
|
||||
</template>
|
||||
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
|
||||
<template v-else>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<img src="~@/assets/images/sale.svg" class="top-card-img" />
|
||||
<div class="pt-2">销售额</div>
|
||||
</div>
|
||||
<div>
|
||||
<a-typography-text type="secondary">周</a-typography-text>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<CountTo prefix="¥" :startVal="1" :endVal="saleroom.weekSaleroom" class="text-3xl" />
|
||||
</div>
|
||||
<div class="flex justify-between px-2 py-1">
|
||||
<div class="flex-1 text-sn">
|
||||
<a-progress :percent="70" status="active" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<a-typography-title :level="2" class="mb-0">
|
||||
<CountTo
|
||||
prefix="¥"
|
||||
:startVal="1"
|
||||
:endVal="7856"
|
||||
class="text-3xl"
|
||||
/>
|
||||
</a-typography-title>
|
||||
<div>
|
||||
<a-tag color="#d03050" type="error" round size="small"> -20% </a-tag>
|
||||
<ArrowDownOutlined style="color: #d03050" />
|
||||
<a-divider style="margin: 16px 0 10px 0" />
|
||||
<div class="flex justify-between py-1">
|
||||
<div class="text-sn"> 总销售额:</div>
|
||||
<div class="text-sn">
|
||||
<CountTo prefix="¥" :startVal="1" :endVal="saleroom.amount" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
|
||||
<a-card size="small" :bordered="false" hoverable>
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<a-card title="订单量" size="small" :bordered="false" hoverable>
|
||||
<template #extra>
|
||||
<a-tag color="warning">周</a-tag>
|
||||
</template>
|
||||
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
|
||||
<template v-else>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<img src="~@/assets/images/order_count.svg" class="top-card-img" />
|
||||
<div class="pt-2">订单量</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<CountTo :startVal="1" :endVal="orderLarge.weekLarge" class="text-3xl" />
|
||||
</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<div class="text-sn">
|
||||
日同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
|
||||
</div>
|
||||
<div>
|
||||
<a-typography-text type="secondary">周</a-typography-text>
|
||||
<div class="text-sn">
|
||||
周同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<a-typography-title :level="2" class="mb-0">
|
||||
<CountTo :startVal="1" :endVal="9323" class="text-3xl" />
|
||||
</a-typography-title>
|
||||
<div>
|
||||
<a-tag color="#18a058" type="success" round size="small"> +35% </a-tag>
|
||||
<ArrowUpOutlined style="color: #18a058" />
|
||||
</div>
|
||||
<a-divider style="margin: 16px 0 10px 0" />
|
||||
<div class="flex justify-between py-1">
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<template v-else>
|
||||
<div class="text-sn"> 转化率:</div>
|
||||
<div class="text-sn">
|
||||
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.amount" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
|
||||
<a-card size="small" :bordered="false" hoverable>
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<a-card title="成交额" size="small" :bordered="false" hoverable>
|
||||
<template #extra>
|
||||
<a-tag color="error">月</a-tag>
|
||||
</template>
|
||||
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
|
||||
<template v-else>
|
||||
<div class="flex justify-between">
|
||||
<div>
|
||||
<img src="~@/assets/images/volume.svg" class="top-card-img" />
|
||||
<div class="pt-2">成交额</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<CountTo prefix="¥" :startVal="1" :endVal="volume.weekLarge" class="text-3xl" />
|
||||
</div>
|
||||
<div class="flex justify-between px-1 py-1">
|
||||
<div class="text-sn">
|
||||
月同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="volume.rise" />
|
||||
</div>
|
||||
<div>
|
||||
<a-typography-text type="secondary">月</a-typography-text>
|
||||
<div class="text-sn">
|
||||
月同比
|
||||
<CountTo :startVal="1" suffix="%" :endVal="volume.decline" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex justify-between">
|
||||
<a-typography-title :level="2" class="mb-0">
|
||||
<CountTo prefix="¥" :startVal="1" :endVal="9853" class="text-3xl" />
|
||||
</a-typography-title>
|
||||
<div>
|
||||
<a-tag color="#d03050" type="error" round size="small"> -5% </a-tag>
|
||||
<ArrowDownOutlined style="color: #d03050" />
|
||||
</div>
|
||||
<a-divider style="margin: 16px 0 10px 0" />
|
||||
<div class="flex justify-between py-1">
|
||||
<a-skeleton v-if="loading" :width="100" size="medium" />
|
||||
<template v-else>
|
||||
<div class="text-sn"> 总成交额:</div>
|
||||
<div class="text-sn">
|
||||
<CountTo prefix="¥" :startVal="1" :endVal="volume.amount" />
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
|
||||
<!--导航卡片-->
|
||||
<div class="mt-4">
|
||||
<a-row :gutter="[16, 16]">
|
||||
<a-col
|
||||
:xs="24"
|
||||
:sm="12"
|
||||
:md="6"
|
||||
:lg="4"
|
||||
:xl="3"
|
||||
v-for="(item, index) in iconList"
|
||||
:key="index"
|
||||
>
|
||||
<a-card size="small" :bordered="false" hoverable>
|
||||
<a-skeleton v-if="loading" :paragraph="{ rows: 1, width: '100%' }" />
|
||||
<div class="cursor-pointer py-2" v-else>
|
||||
<p class="flex justify-center">
|
||||
<component
|
||||
:is="item.icon"
|
||||
:style="{ color: item.color, fontSize: `${item.size}px` }"
|
||||
v-on="item.eventObject || {}"
|
||||
/>
|
||||
</p>
|
||||
<p class="flex justify-center mb-0"
|
||||
><span>{{ item.title }}</span></p
|
||||
>
|
||||
</div>
|
||||
</a-card>
|
||||
</a-col>
|
||||
</a-row>
|
||||
</div>
|
||||
|
||||
<a-row :gutter="[16, 16]" class="mt-4">
|
||||
<a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
|
||||
<a-card title="访问量" :bordered="false" hoverable>
|
||||
@ -163,8 +211,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted,h } from 'vue';
|
||||
import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
|
||||
import { ref, onMounted, h } from 'vue';
|
||||
import { notification } from 'ant-design-vue';
|
||||
import NewVisitAmount from './components/NewVisitAmount.vue';
|
||||
import VisitSource from './components/VisitSource.vue';
|
||||
@ -172,19 +219,113 @@
|
||||
import AreaRanking from './components/AreaRanking.vue';
|
||||
import { getConsoleInfo } from '@/api/dashboard/console';
|
||||
import { CountTo } from '@/components/CountTo/index';
|
||||
import {
|
||||
UsergroupAddOutlined,
|
||||
BarChartOutlined,
|
||||
ShoppingCartOutlined,
|
||||
AccountBookOutlined,
|
||||
CreditCardOutlined,
|
||||
MailOutlined,
|
||||
TagsOutlined,
|
||||
SettingOutlined,
|
||||
} from '@ant-design/icons-vue';
|
||||
|
||||
const loading = ref<boolean>(true);
|
||||
const visits = ref<TypeVisits>();
|
||||
const saleroom = ref<TypeSaleroom>();
|
||||
const orderLarge = ref<TypeOrderLarge>();
|
||||
const volume = ref<TypeOrderLarge>();
|
||||
/**
|
||||
* 定义参数
|
||||
*/
|
||||
const loading = ref(true);
|
||||
const visits = ref<any>({});
|
||||
const saleroom = ref<any>({});
|
||||
const orderLarge = ref<any>({});
|
||||
const volume = ref<any>({});
|
||||
|
||||
// 图标列表
|
||||
const iconList = [
|
||||
{
|
||||
icon: UsergroupAddOutlined,
|
||||
size: '32',
|
||||
title: '用户管理',
|
||||
color: '#69c0ff',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: BarChartOutlined,
|
||||
size: '32',
|
||||
title: '租户管理',
|
||||
color: '#69c0ff',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: ShoppingCartOutlined,
|
||||
size: '32',
|
||||
title: '操作日志',
|
||||
color: '#ff9c6e',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: AccountBookOutlined,
|
||||
size: '32',
|
||||
title: '参数管理',
|
||||
color: '#b37feb',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: CreditCardOutlined,
|
||||
size: '32',
|
||||
title: '字典管理',
|
||||
color: '#ffd666',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: MailOutlined,
|
||||
size: '32',
|
||||
title: '消息管理',
|
||||
color: '#5cdbd3',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: TagsOutlined,
|
||||
size: '32',
|
||||
title: '定时任务',
|
||||
color: '#ff85c0',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
{
|
||||
icon: SettingOutlined,
|
||||
size: '32',
|
||||
title: '配置管理',
|
||||
color: '#ffc069',
|
||||
eventObject: {
|
||||
click: () => {},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* 钩子函数
|
||||
*/
|
||||
onMounted(async () => {
|
||||
// const res: TypeConsole = await getConsoleInfo();
|
||||
// visits.value = res.visits;
|
||||
// saleroom.value = res.saleroom;
|
||||
// orderLarge.value = res.orderLarge;
|
||||
// volume.value = res.volume;
|
||||
const { visits, saleroom, orderLarge, volume } = await getConsoleInfo();
|
||||
visits.value = visits;
|
||||
saleroom.value = saleroom;
|
||||
orderLarge.value = orderLarge;
|
||||
volume.value = volume;
|
||||
loading.value = false;
|
||||
|
||||
loading.value = false;
|
||||
if (!localStorage.getItem('adClosed')) {
|
||||
notification.info({
|
||||
@ -200,11 +341,11 @@
|
||||
},
|
||||
'前往购买授权',
|
||||
),
|
||||
])
|
||||
});
|
||||
localStorage.setItem('adClosed', 'true');
|
||||
}
|
||||
})
|
||||
]),
|
||||
});
|
||||
localStorage.setItem('adClosed', 'true');
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
|
Loading…
Reference in New Issue
Block a user