mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-07-12 16:01:35 +08:00
fix dashboard config
This commit is contained in:
@@ -10,6 +10,7 @@ import MediaServerLatest from '@/views/dashboard/MediaServerLatest.vue'
|
|||||||
import MediaServerLibrary from '@/views/dashboard/MediaServerLibrary.vue'
|
import MediaServerLibrary from '@/views/dashboard/MediaServerLibrary.vue'
|
||||||
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
|
import MediaServerPlaying from '@/views/dashboard/MediaServerPlaying.vue'
|
||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
|
import { isNullOrEmptyObject } from '@/@core/utils'
|
||||||
|
|
||||||
// 仪表盘配置
|
// 仪表盘配置
|
||||||
const dashboard_names = {
|
const dashboard_names = {
|
||||||
@@ -41,23 +42,24 @@ const default_config = {
|
|||||||
playing: true,
|
playing: true,
|
||||||
latest: true,
|
latest: true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 初始化默认值
|
||||||
const config = ref(JSON.parse(localStorage.getItem('MP_DASHBOARD') || '{}'))
|
const config = ref(JSON.parse(localStorage.getItem('MP_DASHBOARD') || '{}'))
|
||||||
if (Object.keys(config.value).length === 0) {
|
if (isNullOrEmptyObject(config.value)) {
|
||||||
config.value = default_config
|
config.value = default_config
|
||||||
localStorage.setItem('MP_DASHBOARD', JSON.stringify(config.value))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置项目
|
// 设置项目
|
||||||
function setDashboardConfig() {
|
function setDashboardConfig() {
|
||||||
const data = JSON.stringify(config.value)
|
const data = JSON.stringify(config.value)
|
||||||
localStorage.setItem('MP_DASHBOARD', data)
|
localStorage.setItem('MP_DASHBOARD', data)
|
||||||
dialog.value = false
|
|
||||||
// 保存到服务端
|
// 保存到服务端
|
||||||
api.post('/user/config/Dashboard', data, {
|
api.post('/user/config/Dashboard', data, {
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
dialog.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ function login() {
|
|||||||
store.dispatch('auth/updateSuperUser', superuser)
|
store.dispatch('auth/updateSuperUser', superuser)
|
||||||
store.dispatch('auth/updateUserName', username)
|
store.dispatch('auth/updateUserName', username)
|
||||||
store.dispatch('auth/updateAvatar', avatar)
|
store.dispatch('auth/updateAvatar', avatar)
|
||||||
|
|
||||||
|
// 登录后处理
|
||||||
afterLogin()
|
afterLogin()
|
||||||
})
|
})
|
||||||
.catch((error: any) => {
|
.catch((error: any) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user