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