统计图显示失败

This commit is contained in:
Mrtangl 2022-04-19 16:54:54 +08:00
parent efd707ecc3
commit 5e609f41af
3 changed files with 16 additions and 4 deletions

View File

@ -3,10 +3,11 @@
<!-- <input class="search-input" placeholder="请输入搜索内容…" type="text" /> --> <!-- <input class="search-input" placeholder="请输入搜索内容…" type="text" /> -->
<div class="admin-info flex flex-center m-l-40"> <div class="admin-info flex flex-center m-l-40">
<el-avatar :size="40" :src="userInfo.avatar"></el-avatar> <el-avatar :size="40" :src="userInfo.avatar"></el-avatar>
<div class="m-l-10"> <div class="m-l-10">
<el-dropdown trigger="hover" @command="handleCommand"> <el-dropdown trigger="hover" @command="handleCommand">
<div class="flex flex-center"> <div class="flex flex-center">
{{ userInfo.name }} {{ userInfo.username }}
<el-icon class="el-icon--right"><arrow-down /></el-icon> <el-icon class="el-icon--right"><arrow-down /></el-icon>
</div> </div>
<template #dropdown> <template #dropdown>
@ -33,6 +34,8 @@ export default defineComponent({
setup() { setup() {
const { store, router } = useAdmin() const { store, router } = useAdmin()
const userInfo = computed(() => store.getters.userInfo) const userInfo = computed(() => store.getters.userInfo)
console.log(userInfo, 'userInfo')
const handleCommand = (command: string) => { const handleCommand = (command: string) => {
switch (command) { switch (command) {
case 'logout': case 'logout':

View File

@ -18,7 +18,9 @@ const user: Module<UserModule, any> = {
cache.set(TOKEN, data) cache.set(TOKEN, data)
}, },
setUser(state, data) { setUser(state, data) {
state.user = data console.log(data, 'data____')
state.user = data.user
} }
}, },
actions: { actions: {

View File

@ -199,9 +199,16 @@ const getSystemCache = async () => {
formData.value.dbSize = res.dbSize || '' formData.value.dbSize = res.dbSize || ''
statisticalData.commandChartOption.series[0].data = res.commandStats statisticalData.commandChartOption.series[0].data = res.commandStats
statisticalData.memoryChartOption.series[0].data = res.info.used_memory_human
statisticalData.memoryChartOption.series[0].data[0].value = (
res.info.used_memory /
1024 /
1024
).toFixed(2)
statisticalData.memoryChartOption.series[0].detail.formatter = '{value}' + 'M'
console.log(res.info.used_memory_human, '-------------------------+')
console.log( console.log(
statisticalData.memoryChartOption.series[0].data, (res.info.used_memory / 1024 / 1024).toFixed(2),
'-------------------------+' '-------------------------+'
) )
}) })