feat: 看板数据

This commit is contained in:
zhanghao 2026-07-07 15:58:40 +08:00
parent a24733f6ea
commit 9d37c56b8d
3 changed files with 50 additions and 8 deletions

View File

@ -37,3 +37,10 @@ export function getCorpusListApi(params) {
params: params params: params
}) })
} }
export function getDashboardApi() {
return request({
url: '/tts/corpus/dashboard/stats',
method: 'get'
})
}

View File

@ -18,38 +18,54 @@
</template> </template>
<script setup> <script setup>
import { ref } from 'vue'
import SvgIcon from "@/components/SvgIcon"; import SvgIcon from "@/components/SvgIcon";
import { getDashboardApi } from '@/api/corpusManger/corpus.js'
import { onMounted } from "vue";
const stats = [ const stats = ref([
{ {
iconName: 'task', iconName: 'task',
label: '语料总量(条)', label: '语料总量(条)',
value: '856,420', value: 14,
trend: '+12.4%', trend: '+12.4%',
trendClass: 'up' trendClass: 'up'
}, },
{ {
iconName: 'add', iconName: 'add',
label: '核心功能分类(个)', label: '核心功能分类(个)',
value: '12,680', value: '4',
trend: '+8.7%', trend: '+8.7%',
trendClass: 'up', trendClass: 'up',
}, },
{ {
iconName: 'language', iconName: 'language',
label: '多语种数量(种)', label: '多语种数量(种)',
value: '12', value: 2,
trend: '—', trend: '—',
trendClass: 'neutral' trendClass: 'neutral'
}, },
{ {
iconName: 'consuming', iconName: 'consuming',
label: '今日新增语料(条)', label: '今日新增语料(条)',
value: '36', value: 3,
trend: '+3.2%', trend: '+3.2%',
trendClass: 'up' trendClass: 'up'
} }
] ])
const getDashboard = async () => {
const res = await getDashboardApi()
if (res.code === 200) {
stats.value[0].value = res.data.totalCorpus
stats.value[2].value = res.data.totalLanguages
stats.value[3].value = res.data.todayCorpus
}
}
onMounted(() => {
getDashboard()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@ -19,8 +19,9 @@
<script setup> <script setup>
import SvgIcon from "@/components/SvgIcon"; import SvgIcon from "@/components/SvgIcon";
import { getDashboardApi } from '@/api/corpusManger/speech_synthesis.js'
const stats = [ const stats = ref([
{ {
iconName: 'task', iconName: 'task',
label: '合成任务总数(条)', label: '合成任务总数(条)',
@ -56,7 +57,25 @@ const stats = [
trend: '-5.6%', trend: '-5.6%',
trendClass: 'down' trendClass: 'down'
} }
] ])
const getDashboard = async () => {
const res = await getDashboardApi()
if (res.code === 200) {
stats.value[0].value = res.data.totalTasks
stats.value[0].trend = res.data.totalTasksGrowth
stats.value[1].value = res.data.todayTasks
stats.value[1].trend = res.data.todayTasksGrowth
stats.value[2].value = res.data.totalLanguages
stats.value[3].value = res.data.totalVoices
stats.value[4].value = res.data.avgDuration
stats.value[4].trend = res.data.avgDurationGrowth
}
}
onMounted(() => {
getDashboard()
})
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>