Compare commits

..

No commits in common. "6558fd68c945f3840d34b8cf1b4070069c129778" and "fe10782e223157f6c01302f3802dbe0ff15aa1ba" have entirely different histories.

2 changed files with 89 additions and 260 deletions

View File

@ -31,38 +31,8 @@ export interface TypeConsole {
//获取主控台信息 //获取主控台信息
export function getConsoleInfo() { export function getConsoleInfo() {
return consoleInfo; return http.request<TypeConsole>({
url: '/dashboard/console',
method: 'get',
});
} }
/**
*
*/
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,
},
};

View File

@ -1,161 +1,113 @@
<template> <template>
<div class="console"> <div class="console">
<!--数据卡片-->
<a-row :gutter="[16, 16]"> <a-row :gutter="[16, 16]">
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6"> <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
<a-card title="访问量" size="small" :bordered="false" hoverable> <a-card size="small" :bordered="false" hoverable>
<template #extra> <a-skeleton v-if="loading" :width="100" size="medium" />
<a-tag color="green"></a-tag>
</template>
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
<template v-else> <template v-else>
<div class="flex justify-between px-1 py-1"> <div class="flex justify-between">
<CountTo :startVal="1" :endVal="visits.dayVisits" class="text-3xl" /> <div>
</div> <img src="~@/assets/images/visits.svg" class="top-card-img" />
<div class="flex justify-between px-1 py-1"> <div class="pt-2">访问量</div>
<div class="text-sn">
日同比
<CountTo :startVal="1" suffix="%" :endVal="visits.rise" />
</div> </div>
<div class="text-sn"> <div>
周同比 <a-typography-text type="secondary"></a-typography-text>
<CountTo :startVal="1" suffix="%" :endVal="visits.decline" />
</div> </div>
</div> </div>
<a-divider style="margin: 16px 0 10px 0" /> <div class="flex justify-between">
<div class="flex justify-between py-1"> <a-typography-title :level="2" class="mb-0">
<div class="text-sn"> 总访问量</div> <CountTo :startVal="1" :endVal="3232" class="text-3xl" />
<div class="text-sn"> </a-typography-title>
<CountTo :startVal="1" :endVal="visits.amount" /> <div>
<a-tag color="#18a058" round size="small"> +10% </a-tag>
<ArrowUpOutlined style="color: #18a058" />
</div> </div>
</div> </div>
</template> </template>
</a-card> </a-card>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6"> <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
<a-card title="销售额" size="small" :bordered="false" hoverable> <a-card size="small" :bordered="false" hoverable>
<template #extra> <a-skeleton v-if="loading" :width="100" size="medium" />
<a-tag color="blue"></a-tag>
</template>
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
<template v-else> <template v-else>
<div class="flex justify-between px-1 py-1"> <div class="flex justify-between">
<CountTo prefix="¥" :startVal="1" :endVal="saleroom.weekSaleroom" class="text-3xl" /> <div>
</div> <img src="~@/assets/images/sale.svg" class="top-card-img" />
<div class="flex justify-between px-2 py-1"> <div class="pt-2">销售额</div>
<div class="flex-1 text-sn"> </div>
<a-progress :percent="70" status="active" /> <div>
<a-typography-text type="secondary"></a-typography-text>
</div> </div>
</div> </div>
<a-divider style="margin: 16px 0 10px 0" /> <div class="flex justify-between">
<div class="flex justify-between py-1"> <a-typography-title :level="2" class="mb-0">
<div class="text-sn"> 总销售额</div> <CountTo
<div class="text-sn"> prefix="¥"
<CountTo prefix="¥" :startVal="1" :endVal="saleroom.amount" /> :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" />
</div> </div>
</div> </div>
</template> </template>
</a-card> </a-card>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6"> <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
<a-card title="订单量" size="small" :bordered="false" hoverable> <a-card size="small" :bordered="false" hoverable>
<template #extra> <a-skeleton v-if="loading" :width="100" size="medium" />
<a-tag color="warning"></a-tag>
</template>
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
<template v-else> <template v-else>
<div class="flex justify-between px-1 py-1"> <div class="flex justify-between">
<CountTo :startVal="1" :endVal="orderLarge.weekLarge" class="text-3xl" /> <div>
</div> <img src="~@/assets/images/order_count.svg" class="top-card-img" />
<div class="flex justify-between px-1 py-1"> <div class="pt-2">订单量</div>
<div class="text-sn">
日同比
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
</div> </div>
<div class="text-sn"> <div>
周同比 <a-typography-text type="secondary"></a-typography-text>
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.rise" />
</div> </div>
</div> </div>
<a-divider style="margin: 16px 0 10px 0" /> <div class="flex justify-between">
<div class="flex justify-between py-1"> <a-typography-title :level="2" class="mb-0">
<a-skeleton v-if="loading" :width="100" size="medium" /> <CountTo :startVal="1" :endVal="9323" class="text-3xl" />
<template v-else> </a-typography-title>
<div class="text-sn"> 转化率</div> <div>
<div class="text-sn"> <a-tag color="#18a058" type="success" round size="small"> +35% </a-tag>
<CountTo :startVal="1" suffix="%" :endVal="orderLarge.amount" /> <ArrowUpOutlined style="color: #18a058" />
</div> </div>
</template>
</div> </div>
</template> </template>
</a-card> </a-card>
</a-col> </a-col>
<a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6"> <a-col :xs="24" :sm="24" :md="12" :lg="8" :xl="6">
<a-card title="成交额" size="small" :bordered="false" hoverable> <a-card size="small" :bordered="false" hoverable>
<template #extra> <a-skeleton v-if="loading" :width="100" size="medium" />
<a-tag color="error"></a-tag>
</template>
<a-skeleton v-if="loading" :width="100" :paragraph="{ rows: 2, width: '100%' }" />
<template v-else> <template v-else>
<div class="flex justify-between px-1 py-1"> <div class="flex justify-between">
<CountTo prefix="¥" :startVal="1" :endVal="volume.weekLarge" class="text-3xl" /> <div>
</div> <img src="~@/assets/images/volume.svg" class="top-card-img" />
<div class="flex justify-between px-1 py-1"> <div class="pt-2">成交额</div>
<div class="text-sn">
月同比
<CountTo :startVal="1" suffix="%" :endVal="volume.rise" />
</div> </div>
<div class="text-sn"> <div>
月同比 <a-typography-text type="secondary"></a-typography-text>
<CountTo :startVal="1" suffix="%" :endVal="volume.decline" />
</div> </div>
</div> </div>
<a-divider style="margin: 16px 0 10px 0" /> <div class="flex justify-between">
<div class="flex justify-between py-1"> <a-typography-title :level="2" class="mb-0">
<a-skeleton v-if="loading" :width="100" size="medium" /> <CountTo prefix="¥" :startVal="1" :endVal="9853" class="text-3xl" />
<template v-else> </a-typography-title>
<div class="text-sn"> 总成交额</div> <div>
<div class="text-sn"> <a-tag color="#d03050" type="error" round size="small"> -5% </a-tag>
<CountTo prefix="¥" :startVal="1" :endVal="volume.amount" /> <ArrowDownOutlined style="color: #d03050" />
</div> </div>
</template>
</div> </div>
</template> </template>
</a-card> </a-card>
</a-col> </a-col>
</a-row> </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-row :gutter="[16, 16]" class="mt-4">
<a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12"> <a-col :xs="24" :sm="24" :md="24" :lg="12" :xl="12">
<a-card title="访问量" :bordered="false" hoverable> <a-card title="访问量" :bordered="false" hoverable>
@ -211,7 +163,8 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, onMounted, h } from 'vue'; import { ref, onMounted,h } from 'vue';
import { ArrowUpOutlined, ArrowDownOutlined } from '@ant-design/icons-vue';
import { notification } from 'ant-design-vue'; import { notification } from 'ant-design-vue';
import NewVisitAmount from './components/NewVisitAmount.vue'; import NewVisitAmount from './components/NewVisitAmount.vue';
import VisitSource from './components/VisitSource.vue'; import VisitSource from './components/VisitSource.vue';
@ -219,113 +172,19 @@
import AreaRanking from './components/AreaRanking.vue'; import AreaRanking from './components/AreaRanking.vue';
import { getConsoleInfo } from '@/api/dashboard/console'; import { getConsoleInfo } from '@/api/dashboard/console';
import { CountTo } from '@/components/CountTo/index'; 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 loading = ref(true); const orderLarge = ref<TypeOrderLarge>();
const visits = ref<any>({}); const volume = ref<TypeOrderLarge>();
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 () => { onMounted(async () => {
const { visits, saleroom, orderLarge, volume } = await getConsoleInfo(); // const res: TypeConsole = await getConsoleInfo();
visits.value = visits; // visits.value = res.visits;
saleroom.value = saleroom; // saleroom.value = res.saleroom;
orderLarge.value = orderLarge; // orderLarge.value = res.orderLarge;
volume.value = volume; // volume.value = res.volume;
loading.value = false;
loading.value = false; loading.value = false;
if (!localStorage.getItem('adClosed')) { if (!localStorage.getItem('adClosed')) {
notification.info({ notification.info({
@ -341,11 +200,11 @@
}, },
'前往购买授权', '前往购买授权',
), ),
]), ])
}); });
localStorage.setItem('adClosed', 'true'); localStorage.setItem('adClosed', 'true');
} }
}); })
</script> </script>
<style lang="less" scoped> <style lang="less" scoped>