2023-02-11 00:44:00 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div>
|
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<el-skeleton :loading="loading" animated>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-row :gutter="16" justify="space-between">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
|
|
|
|
|
<div class="flex items-center">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-avatar :src="avatar" :size="70" class="mr-16px">
|
|
|
|
|
<img src="@/assets/imgs/avatar.gif" alt="" />
|
|
|
|
|
</el-avatar>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<div>
|
2023-07-29 14:40:55 +08:00
|
|
|
|
<div class="text-20px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
{{ t('workplace.welcome') }} {{ username }} {{ t('workplace.happyDay') }}
|
|
|
|
|
</div>
|
|
|
|
|
<div class="mt-10px text-14px text-gray-500">
|
|
|
|
|
{{ t('workplace.toady') }},20℃ - 32℃!
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xl="12" :lg="12" :md="12" :sm="24" :xs="24">
|
2023-09-22 17:49:11 +08:00
|
|
|
|
<div class="h-70px flex items-center justify-end lt-sm:mt-10px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<div class="px-8px text-right">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.project') }}</div>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<CountTo
|
|
|
|
|
class="text-20px"
|
|
|
|
|
:start-val="0"
|
|
|
|
|
:end-val="totalSate.project"
|
|
|
|
|
:duration="2600"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<el-divider direction="vertical" />
|
|
|
|
|
<div class="px-8px text-right">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.toDo') }}</div>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<CountTo
|
|
|
|
|
class="text-20px"
|
|
|
|
|
:start-val="0"
|
|
|
|
|
:end-val="totalSate.todo"
|
|
|
|
|
:duration="2600"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<el-divider direction="vertical" border-style="dashed" />
|
|
|
|
|
<div class="px-8px text-right">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<div class="mb-16px text-14px text-gray-400">{{ t('workplace.access') }}</div>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<CountTo
|
|
|
|
|
class="text-20px"
|
|
|
|
|
:start-val="0"
|
|
|
|
|
:end-val="totalSate.access"
|
|
|
|
|
:duration="2600"
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
</div>
|
|
|
|
|
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-row class="mt-8px" :gutter="8" justify="space-between">
|
|
|
|
|
<el-col :xl="16" :lg="16" :md="24" :sm="24" :xs="24" class="mb-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
2023-09-22 17:49:11 +08:00
|
|
|
|
<div class="h-3 flex justify-between">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<span>{{ t('workplace.project') }}</span>
|
|
|
|
|
<el-link type="primary" :underline="false">{{ t('action.more') }}</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<el-row>
|
|
|
|
|
<el-col
|
|
|
|
|
v-for="(item, index) in projects"
|
|
|
|
|
:key="`card-${index}`"
|
|
|
|
|
:xl="8"
|
|
|
|
|
:lg="8"
|
|
|
|
|
:md="8"
|
|
|
|
|
:sm="24"
|
|
|
|
|
:xs="24"
|
|
|
|
|
>
|
|
|
|
|
<el-card shadow="hover">
|
|
|
|
|
<div class="flex items-center">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<Icon :icon="item.icon" :size="25" class="mr-8px" />
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<span class="text-16px">{{ item.name }}</span>
|
|
|
|
|
</div>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<div class="mt-16px text-14px text-gray-400">{{ t(item.message) }}</div>
|
|
|
|
|
<div class="mt-16px flex justify-between text-12px text-gray-400">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<span>{{ item.personal }}</span>
|
|
|
|
|
<span>{{ formatTime(item.time, 'yyyy-MM-dd') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-card shadow="never" class="mt-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<el-row :gutter="20" justify="space-between">
|
|
|
|
|
<el-col :xl="10" :lg="10" :md="24" :sm="24" :xs="24">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-card shadow="hover" class="mb-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<Echart :options="pieOptionsData" :height="280" />
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
<el-col :xl="14" :lg="14" :md="24" :sm="24" :xs="24">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-card shadow="hover" class="mb-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<Echart :options="barOptionsData" :height="280" />
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-col :xl="8" :lg="8" :md="24" :sm="24" :xs="24" class="mb-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-card shadow="never">
|
|
|
|
|
<template #header>
|
2023-09-22 17:49:11 +08:00
|
|
|
|
<div class="h-3 flex justify-between">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<span>{{ t('workplace.shortcutOperation') }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<el-row>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-col v-for="item in shortcut" :key="`team-${item.name}`" :span="8" class="mb-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<div class="flex items-center">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<Icon :icon="item.icon" class="mr-8px" />
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<el-link type="default" :underline="false" @click="setWatermark(item.name)">
|
|
|
|
|
{{ item.name }}
|
|
|
|
|
</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-card shadow="never" class="mt-8px">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<template #header>
|
2023-09-22 17:49:11 +08:00
|
|
|
|
<div class="h-3 flex justify-between">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<span>{{ t('workplace.notice') }}</span>
|
|
|
|
|
<el-link type="primary" :underline="false">{{ t('action.more') }}</el-link>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
<el-skeleton :loading="loading" animated>
|
|
|
|
|
<div v-for="(item, index) in notice" :key="`dynamics-${index}`">
|
|
|
|
|
<div class="flex items-center">
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<el-avatar :src="avatar" :size="35" class="mr-16px">
|
|
|
|
|
<img src="@/assets/imgs/avatar.gif" alt="" />
|
|
|
|
|
</el-avatar>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
<div>
|
|
|
|
|
<div class="text-14px">
|
|
|
|
|
<Highlight :keys="item.keys.map((v) => t(v))">
|
|
|
|
|
{{ item.type }} : {{ item.title }}
|
|
|
|
|
</Highlight>
|
|
|
|
|
</div>
|
2023-12-07 12:19:46 +08:00
|
|
|
|
<div class="mt-16px text-12px text-gray-400">
|
2023-02-11 00:44:00 +08:00
|
|
|
|
{{ formatTime(item.date, 'yyyy-MM-dd') }}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<el-divider />
|
|
|
|
|
</div>
|
|
|
|
|
</el-skeleton>
|
|
|
|
|
</el-card>
|
|
|
|
|
</el-col>
|
|
|
|
|
</el-row>
|
|
|
|
|
</template>
|
2023-06-21 19:35:11 +08:00
|
|
|
|
<script lang="ts" setup>
|
2023-02-11 00:44:00 +08:00
|
|
|
|
import { set } from 'lodash-es'
|
|
|
|
|
import { EChartsOption } from 'echarts'
|
|
|
|
|
import { formatTime } from '@/utils'
|
|
|
|
|
|
|
|
|
|
import { useUserStore } from '@/store/modules/user'
|
|
|
|
|
import { useWatermark } from '@/hooks/web/useWatermark'
|
|
|
|
|
import type { WorkplaceTotal, Project, Notice, Shortcut } from './types'
|
|
|
|
|
import { pieOptions, barOptions } from './echarts-data'
|
|
|
|
|
|
2023-06-21 19:14:34 +08:00
|
|
|
|
defineOptions({ name: 'Home' })
|
|
|
|
|
|
2023-02-11 00:44:00 +08:00
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
const userStore = useUserStore()
|
|
|
|
|
const { setWatermark } = useWatermark()
|
|
|
|
|
const loading = ref(true)
|
2023-12-07 12:19:46 +08:00
|
|
|
|
const avatar = userStore.getUser.avatar
|
2023-02-11 00:44:00 +08:00
|
|
|
|
const username = userStore.getUser.nickname
|
|
|
|
|
const pieOptionsData = reactive<EChartsOption>(pieOptions) as EChartsOption
|
|
|
|
|
// 获取统计数
|
|
|
|
|
let totalSate = reactive<WorkplaceTotal>({
|
|
|
|
|
project: 0,
|
|
|
|
|
access: 0,
|
|
|
|
|
todo: 0
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
const getCount = async () => {
|
|
|
|
|
const data = {
|
|
|
|
|
project: 40,
|
|
|
|
|
access: 2340,
|
|
|
|
|
todo: 10
|
|
|
|
|
}
|
|
|
|
|
totalSate = Object.assign(totalSate, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取项目数
|
|
|
|
|
let projects = reactive<Project[]>([])
|
|
|
|
|
const getProject = async () => {
|
|
|
|
|
const data = [
|
|
|
|
|
{
|
|
|
|
|
name: 'Github',
|
|
|
|
|
icon: 'akar-icons:github-fill',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Vue',
|
|
|
|
|
icon: 'logos:vue',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Angular',
|
|
|
|
|
icon: 'logos:angular-icon',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'React',
|
|
|
|
|
icon: 'logos:react',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Webpack',
|
|
|
|
|
icon: 'logos:webpack',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Vite',
|
|
|
|
|
icon: 'vscode-icons:file-type-vite',
|
|
|
|
|
message: 'workplace.introduction',
|
|
|
|
|
personal: 'Archer',
|
|
|
|
|
time: new Date()
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
projects = Object.assign(projects, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取通知公告
|
|
|
|
|
let notice = reactive<Notice[]>([])
|
|
|
|
|
const getNotice = async () => {
|
|
|
|
|
const data = [
|
|
|
|
|
{
|
|
|
|
|
title: '系统升级版本',
|
|
|
|
|
type: '通知',
|
|
|
|
|
keys: ['通知', '升级'],
|
|
|
|
|
date: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '系统凌晨维护',
|
|
|
|
|
type: '公告',
|
|
|
|
|
keys: ['公告', '维护'],
|
|
|
|
|
date: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '系统升级版本',
|
|
|
|
|
type: '通知',
|
|
|
|
|
keys: ['通知', '升级'],
|
|
|
|
|
date: new Date()
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
title: '系统凌晨维护',
|
|
|
|
|
type: '公告',
|
|
|
|
|
keys: ['公告', '维护'],
|
|
|
|
|
date: new Date()
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
notice = Object.assign(notice, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 获取快捷入口
|
|
|
|
|
let shortcut = reactive<Shortcut[]>([])
|
|
|
|
|
|
|
|
|
|
const getShortcut = async () => {
|
|
|
|
|
const data = [
|
|
|
|
|
{
|
|
|
|
|
name: 'Github',
|
|
|
|
|
icon: 'akar-icons:github-fill',
|
|
|
|
|
url: 'github.io'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Vue',
|
|
|
|
|
icon: 'logos:vue',
|
|
|
|
|
url: 'vuejs.org'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Vite',
|
|
|
|
|
icon: 'vscode-icons:file-type-vite',
|
|
|
|
|
url: 'https://vitejs.dev/'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Angular',
|
|
|
|
|
icon: 'logos:angular-icon',
|
|
|
|
|
url: 'github.io'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'React',
|
|
|
|
|
icon: 'logos:react',
|
|
|
|
|
url: 'github.io'
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'Webpack',
|
|
|
|
|
icon: 'logos:webpack',
|
|
|
|
|
url: 'github.io'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
shortcut = Object.assign(shortcut, data)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 用户来源
|
|
|
|
|
const getUserAccessSource = async () => {
|
|
|
|
|
const data = [
|
|
|
|
|
{ value: 335, name: 'analysis.directAccess' },
|
|
|
|
|
{ value: 310, name: 'analysis.mailMarketing' },
|
|
|
|
|
{ value: 234, name: 'analysis.allianceAdvertising' },
|
|
|
|
|
{ value: 135, name: 'analysis.videoAdvertising' },
|
|
|
|
|
{ value: 1548, name: 'analysis.searchEngines' }
|
|
|
|
|
]
|
|
|
|
|
set(
|
|
|
|
|
pieOptionsData,
|
|
|
|
|
'legend.data',
|
|
|
|
|
data.map((v) => t(v.name))
|
|
|
|
|
)
|
|
|
|
|
pieOptionsData!.series![0].data = data.map((v) => {
|
|
|
|
|
return {
|
|
|
|
|
name: t(v.name),
|
|
|
|
|
value: v.value
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
const barOptionsData = reactive<EChartsOption>(barOptions) as EChartsOption
|
|
|
|
|
|
|
|
|
|
// 周活跃量
|
|
|
|
|
const getWeeklyUserActivity = async () => {
|
|
|
|
|
const data = [
|
|
|
|
|
{ value: 13253, name: 'analysis.monday' },
|
|
|
|
|
{ value: 34235, name: 'analysis.tuesday' },
|
|
|
|
|
{ value: 26321, name: 'analysis.wednesday' },
|
|
|
|
|
{ value: 12340, name: 'analysis.thursday' },
|
|
|
|
|
{ value: 24643, name: 'analysis.friday' },
|
|
|
|
|
{ value: 1322, name: 'analysis.saturday' },
|
|
|
|
|
{ value: 1324, name: 'analysis.sunday' }
|
|
|
|
|
]
|
|
|
|
|
set(
|
|
|
|
|
barOptionsData,
|
|
|
|
|
'xAxis.data',
|
|
|
|
|
data.map((v) => t(v.name))
|
|
|
|
|
)
|
|
|
|
|
set(barOptionsData, 'series', [
|
|
|
|
|
{
|
|
|
|
|
name: t('analysis.activeQuantity'),
|
|
|
|
|
data: data.map((v) => v.value),
|
|
|
|
|
type: 'bar'
|
|
|
|
|
}
|
|
|
|
|
])
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const getAllApi = async () => {
|
|
|
|
|
await Promise.all([
|
|
|
|
|
getCount(),
|
|
|
|
|
getProject(),
|
|
|
|
|
getNotice(),
|
|
|
|
|
getShortcut(),
|
|
|
|
|
getUserAccessSource(),
|
|
|
|
|
getWeeklyUserActivity()
|
|
|
|
|
])
|
|
|
|
|
loading.value = false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAllApi()
|
|
|
|
|
</script>
|