feat: 完善仪表盘总计区块内容

This commit is contained in:
2023-09-09 00:20:50 +08:00
parent 0ec5647421
commit 3440aa4faa
26 changed files with 320 additions and 75 deletions

View File

@@ -3,14 +3,25 @@ import type { TableData } from '@arco-design/web-vue/es/table/interface';
const BASE_URL = '/dashboard';
export interface AnnouncementDashboardRecord {
export interface DashboardTotalRecord {
pvCount: number;
ipCount: number;
todayPvCount: number;
newPvFromYesterday: number;
}
export interface DashboardAnnouncementRecord {
id: string;
title: string;
type: number;
}
export function getTotal() {
return axios.get<DashboardTotalRecord>(`${BASE_URL}/total`);
}
export function listAnnouncement() {
return axios.get<AnnouncementDashboardRecord[]>(`${BASE_URL}/announcement`);
return axios.get<DashboardAnnouncementRecord[]>(`${BASE_URL}/announcement`);
}
export interface ContentDataRecord {

View File

@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><path d="M18 36C8.06 36 0 27.94 0 18S8.06 0 18 0s18 8.06 18 18-8.06 18-18 18z" fill="url(#svg_0d83078816__paint0_linear_0:672)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10 11a1 1 0 00-1 1v13a1 1 0 001 1h16a1 1 0 001-1V12a1 1 0 00-1-1H10zm2.229 8.66a.2.2 0 01.038-.281l4.074-3.063a.2.2 0 01.25.007l2.357 1.99a.2.2 0 00.253.006l3.252-2.54a.2.2 0 01.277.03l.994 1.194a.2.2 0 01-.029.285l-4.497 3.57a.2.2 0 01-.25 0l-2.438-1.979a.2.2 0 00-.245-.005l-2.807 2.066a.2.2 0 01-.277-.039l-.952-1.24z" fill="#fff"/><defs><linearGradient id="svg_0d83078816__paint0_linear_0:672" x1="-6.786" y1="21.575" x2="20.433" y2="43.68" gradientUnits="userSpaceOnUse"><stop stop-color="#599AFF"/><stop offset="1" stop-color="#3D89FF"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 812 B

View File

@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_2b62ab03ed__paint0_linear_0:735)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.677 8.55c.073.666-.154 1.497-.547 2.526-.981 2.573-5.63 3.229-5.63 9.993 0 .36.049.676.126.964.362 3.35 3.404 5.967 7.101 5.967 3.943 0 7.39-3.426 7.704-7 .223-2.54.003-4.697-2.106-6.561l-.432.203a3.888 3.888 0 01-.448 1.743 3.58 3.58 0 01-.26.408c-.025.037-.05.073-.079.108a3.773 3.773 0 01-.277.312c-.04.04-.078.082-.121.122-.098.09-.201.176-.308.257-.035.026-.074.051-.11.077-.096.067-.193.13-.293.19l-.128.075c-.146.08-.298.158-.465.23.091-.177.172-.362.247-.552.02-.05.036-.101.055-.152.056-.153.106-.308.15-.465l.039-.145c.051-.2.095-.404.127-.614l.003-.012a7.227 7.227 0 00-.054-2.423c-.345-1.79-1.425-3.791-3.448-5.678l-.846.427z" fill="#fff"/><ellipse cx="17.188" cy="8.5" rx=".512" ry=".5" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.373 14.515a.25.25 0 10-.457.204l.457-.204z" fill="#fff"/><circle cx="18" cy="18" r="18" fill="url(#svg_2b62ab03ed__paint1_linear_0:735)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M22.216 12.662c2.09 1.93 3.284 4.69 3.284 7.586C25.5 24.53 22.142 28 18 28c-4.142 0-7.5-3.47-7.5-7.752 0-5.768 6.427-7.844 6.427-12.248.191.048.38.108.563.18 2.421.95 3.773 5.44 2.854 7.942a4.395 4.395 0 001.872-3.46z" fill="#fff"/><defs><linearGradient id="svg_2b62ab03ed__paint0_linear_0:735" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient><linearGradient id="svg_2b62ab03ed__paint1_linear_0:735" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_60fdab9bf6__paint0_linear_0:667)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M16.677 8.55c.073.665-.154 1.497-.547 2.526-.981 2.573-5.63 3.229-5.63 9.993 0 .36.049.676.126.964.362 3.35 3.404 5.967 7.101 5.967 3.943 0 7.39-3.426 7.704-7 .223-2.54.003-4.697-2.106-6.561l-.432.203a3.888 3.888 0 01-.448 1.743 3.588 3.588 0 01-.26.408c-.025.037-.05.073-.079.108a3.773 3.773 0 01-.277.312c-.04.04-.078.082-.121.122-.098.09-.201.176-.308.257-.035.026-.074.051-.11.077a4.45 4.45 0 01-.421.265c-.146.08-.298.158-.465.23.091-.177.172-.362.247-.552.02-.05.036-.101.055-.152.056-.153.106-.308.15-.465l.039-.145c.051-.2.095-.404.127-.614l.003-.012a7.227 7.227 0 00-.054-2.423c-.345-1.79-1.425-3.791-3.448-5.678l-.846.427z" fill="#fff"/><ellipse cx="17.188" cy="8.5" rx=".512" ry=".5" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M23.373 14.515a.25.25 0 10-.457.204l.457-.204z" fill="#fff"/><circle cx="18" cy="18" r="18" fill="url(#svg_60fdab9bf6__paint1_linear_0:667)"/><rect x="8.5" y="17.5" width="4" height="9" rx="1" fill="#fff"/><rect x="16" y="9.5" width="4" height="17" rx="1" fill="#fff"/><rect x="23.5" y="13.5" width="4" height="13" rx="1" fill="#fff"/><defs><linearGradient id="svg_60fdab9bf6__paint0_linear_0:667" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient><linearGradient id="svg_60fdab9bf6__paint1_linear_0:667" x1="-8.128" y1="18.956" x2="19.654" y2="44.109" gradientUnits="userSpaceOnUse"><stop stop-color="#FF8585"/><stop offset="1" stop-color="#FF5E5E"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -0,0 +1 @@
<svg width="24" height="24" viewBox="0 0 36 36" fill="none"><circle cx="18" cy="18" r="18" fill="url(#svg_1300b2c8f8__paint0_linear_0:785)"/><path fill-rule="evenodd" clip-rule="evenodd" d="M21.792 13.04c0 1.401-.546 2.67-1.428 3.583.445.087.884.199 1.313.334-.88 1.037-1.415 2.424-1.415 4.008 0 1.349 1.036 3.022 2.298 4.56-1.394.255-3.267.475-5.582.475-4.39 0-7.19-.791-8.148-1.113a.472.472 0 01-.318-.525c.198-1.3 1.078-5.483 4.337-6.887.393-.17.789-.318 1.185-.447a5.118 5.118 0 01-1.87-3.988c0-2.783 2.155-5.04 4.814-5.04 2.659 0 4.814 2.257 4.814 5.04z" fill="#fff"/><path fill-rule="evenodd" clip-rule="evenodd" d="M25.496 25.818C24.42 24.902 22 22.642 22 20.846 22 18.538 23.6 17 26 17s4 1.923 4 3.846c0 1.506-2.452 3.955-3.517 4.947a.739.739 0 01-.987.025zm.508-3.345c.828 0 1.5-.688 1.5-1.538 0-.85-.672-1.538-1.5-1.538s-1.5.688-1.5 1.538c0 .85.672 1.539 1.5 1.539z" fill="#fff"/><defs><linearGradient id="svg_1300b2c8f8__paint0_linear_0:785" x1="-6.027" y1="16.545" x2="17.227" y2="42.116" gradientUnits="userSpaceOnUse"><stop stop-color="#5ED1D1"/><stop offset="1" stop-color="#39C4C4"/></linearGradient></defs></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -84,12 +84,12 @@
<script lang="ts" setup>
import { ref } from 'vue';
import {
AnnouncementDashboardRecord,
DashboardAnnouncementRecord,
listAnnouncement,
} from '@/api/dashboard';
} from '@/api/common/dashboard';
import { DataRecord, get } from '@/api/system/announcement';
const dataList = ref<AnnouncementDashboardRecord[]>([]);
const dataList = ref<DashboardAnnouncementRecord[]>([]);
const dataDetail = ref<DataRecord>({});
const detailLoading = ref(false);
const detailVisible = ref(false);

View File

@@ -3,22 +3,16 @@
indicator-type="slider"
show-arrow="hover"
auto-play
style="width: 100%; height: 170px; border-radius: 4px; overflow: hidden"
style="width: 100%; height: 300px; border-radius: 4px; overflow: hidden"
>
<a-carousel-item v-for="(src, idx) in imageSrc" :key="idx">
<div>
<img :src="src" style="width: 100%" />
<img :src="src" style="width: 100%" alt="QrCode" />
</div>
</a-carousel-item>
</a-carousel>
</template>
<script lang="ts" setup>
const imageSrc = [
'//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/5cc3cd1d994b7ef9db6a1f619a22addd.jpg~tplv-49unhts6dw-image.image',
'//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/f256cbcc287139e191fecea9d255a1f0.jpg~tplv-49unhts6dw-image.image',
'//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/b557ff0cd44146a2e471b477af2f30d0.jpg~tplv-49unhts6dw-image.image',
'//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/665106f4bbd2a2df96eaf7aec52f7bc3.jpg~tplv-49unhts6dw-image.image',
'//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/ea095a2c9c72b5d8f2f2818040db736d.jpg~tplv-49unhts6dw-image.image',
];
const imageSrc = ['https://doc.charles7c.top/qrcode.jpg'];
</script>

View File

@@ -20,7 +20,7 @@
import { ref } from 'vue';
import { graphic } from 'echarts';
import useLoading from '@/hooks/loading';
import { queryContentData, ContentDataRecord } from '@/api/dashboard';
import { queryContentData, ContentDataRecord } from '@/api/common/dashboard';
import useChartOption from '@/hooks/chart-option';
import { ToolTipFormatterParams } from '@/types/echarts';
import { AnyObject } from '@/types/global';

View File

@@ -6,21 +6,17 @@
>
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/288b89194e657603ff40db39e8072640.svg~tplv-49unhts6dw-image.image"
/>
<svg-icon icon-class="popularity" />
</a-avatar>
<a-statistic
:title="$t('workplace.onlineContent')"
:value="373.5"
:precision="1"
:title="$t('workplace.pvCount')"
:value="totalData.pvCount"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
W+ <span class="unit">{{ $t('workplace.pecs') }}</span>
<span class="unit">{{ $t('workplace.unit.times') }}</span>
</template>
</a-statistic>
</a-space>
@@ -31,20 +27,17 @@
>
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/fdc66b07224cdf18843c6076c2587eb5.svg~tplv-49unhts6dw-image.image"
/>
<svg-icon icon-class="same-city" />
</a-avatar>
<a-statistic
:title="$t('workplace.putIn')"
:value="368"
:title="$t('workplace.ipCount')"
:value="totalData.ipCount"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
<span class="unit">{{ $t('workplace.unit.pecs') }}</span>
</template>
</a-statistic>
</a-space>
@@ -55,20 +48,17 @@
>
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/77d74c9a245adeae1ec7fb5d4539738d.svg~tplv-49unhts6dw-image.image"
/>
<svg-icon icon-class="hot" />
</a-avatar>
<a-statistic
:title="$t('workplace.newDay')"
:value="8874"
:title="$t('workplace.todayPvCount')"
:value="totalData.todayPvCount"
:value-from="0"
animation
show-group-separator
>
<template #suffix>
<span class="unit">{{ $t('workplace.pecs') }}</span>
<span class="unit">{{ $t('workplace.unit.times') }}</span>
</template>
</a-statistic>
</a-space>
@@ -80,19 +70,26 @@
>
<a-space>
<a-avatar :size="54" class="col-avatar">
<img
alt="avatar"
src="//p3-armor.byteimg.com/tos-cn-i-49unhts6dw/c8b36e26d2b9bb5dbf9b74dd6d7345af.svg~tplv-49unhts6dw-image.image"
/>
<svg-icon icon-class="data" />
</a-avatar>
<a-statistic
:title="$t('workplace.newFromYesterday')"
:value="2.8"
:title="$t('workplace.newPvFromYesterday')"
:value="totalData.newPvFromYesterday"
:precision="1"
:value-from="0"
animation
>
<template #suffix> % <icon-caret-up class="up-icon" /> </template>
<template #suffix>
%
<icon-caret-up
v-if="totalData.newPvFromYesterday > 0"
class="up-icon"
/>
<icon-caret-down
v-if="totalData.newPvFromYesterday < 0"
class="down-icon"
/>
</template>
</a-statistic>
</a-space>
</a-grid-item>
@@ -102,7 +99,30 @@
</a-grid>
</template>
<script lang="ts" setup></script>
<script lang="ts" setup>
import { ref } from 'vue';
import { DashboardTotalRecord, getTotal } from '@/api/common/dashboard';
const totalData = ref<DashboardTotalRecord>({
pvCount: 0,
ipCount: 0,
todayPvCount: 0,
newPvFromYesterday: 0.0,
});
/**
* 查询总计信息
*/
const getData = async () => {
try {
const { data } = await getTotal();
totalData.value = data;
} catch (err) {
// you can report use errorHandler or other
}
};
getData();
</script>
<style lang="less" scoped>
.arco-grid.panel {
@@ -120,6 +140,9 @@
.up-icon {
color: rgb(var(--red-6));
}
.down-icon {
color: rgb(var(--green-6));
}
.unit {
margin-left: 8px;
color: rgb(var(--gray-8));

View File

@@ -75,7 +75,7 @@
<script lang="ts" setup>
import { ref } from 'vue';
import useLoading from '@/hooks/loading';
import { queryPopularList } from '@/api/dashboard';
import { queryPopularList } from '@/api/common/dashboard';
import type { TableData } from '@arco-design/web-vue/es/table/interface';
const type = ref('text');

View File

@@ -4,10 +4,10 @@ export default {
'workplace.balance': 'Balance (CNY)',
'workplace.order.pending': 'Pending',
'workplace.order.pendingRenewal': 'Renewal Order',
'workplace.onlineContent': 'Online Content',
'workplace.putIn': 'Put In',
'workplace.newDay': 'Daily Additional Comments',
'workplace.newFromYesterday': 'New From Yesterday',
'workplace.pvCount': 'Pv Count',
'workplace.ipCount': 'Ip Count',
'workplace.todayPvCount': 'Today Pv Count',
'workplace.newPvFromYesterday': 'New Pv From Yesterday',
'workplace.minute': 'Min',
'workplace.docs': 'Documents',
'workplace.docs.intro': 'Project Introduction',
@@ -28,5 +28,6 @@ export default {
'workplace.popularContent.image': 'image',
'workplace.popularContent.video': 'video',
'workplace.categoriesPercent': 'Categories Percent',
'workplace.pecs': 'pecs',
'workplace.unit.pecs': 'pecs',
'workplace.unit.times': 'times',
};

View File

@@ -4,10 +4,10 @@ export default {
'workplace.balance': '余额(元)',
'workplace.order.pending': '待支付',
'workplace.order.pendingRenewal': '待续费订单',
'workplace.onlineContent': '线上总内容',
'workplace.putIn': '投放中内容',
'workplace.newDay': '日新增评论',
'workplace.newFromYesterday': '较昨日新增',
'workplace.pvCount': '浏览量(PV)',
'workplace.ipCount': 'IP数',
'workplace.todayPvCount': '今日浏览量',
'workplace.newPvFromYesterday': '较昨日新增',
'workplace.minute': '分钟',
'workplace.docs': '帮助文档',
'workplace.docs.intro': '项目简介',
@@ -28,5 +28,6 @@ export default {
'workplace.popularContent.image': '图片',
'workplace.popularContent.video': '视频',
'workplace.categoriesPercent': '内容类型占比',
'workplace.pecs': '个',
'workplace.unit.pecs': '个',
'workplace.unit.times': '次',
};

View File

@@ -13,7 +13,8 @@ export default {
'realTimeMonitor.list.title.duration': 'Duration',
'realTimeMonitor.list.title.id': 'ID',
'realTimeMonitor.list.tip.rotations': 'Rotations ',
'realTimeMonitor.list.tip.rest': ', The program list is not visible to viewers',
'realTimeMonitor.list.tip.rest':
', The program list is not visible to viewers',
'realTimeMonitor.list.tag.auditFailed': 'Audit Failed',
'realTimeMonitor.tab.title.liveMethod': 'Live Method',
'realTimeMonitor.tab.title.onlinePopulation': 'Online Population',