mirror of
https://github.com/jxxghp/MoviePilot-Frontend.git
synced 2026-05-12 19:40:41 +08:00
fix
This commit is contained in:
@@ -161,6 +161,7 @@ function login() {
|
||||
const superuser = response.super_user
|
||||
const username = response.user_name
|
||||
const avatar = response.avatar
|
||||
const level = response.level
|
||||
|
||||
// 更新token和remember状态到Vuex Store
|
||||
store.dispatch('auth/updateToken', token)
|
||||
@@ -168,6 +169,7 @@ function login() {
|
||||
store.dispatch('auth/updateSuperUser', superuser)
|
||||
store.dispatch('auth/updateUserName', username)
|
||||
store.dispatch('auth/updateAvatar', avatar)
|
||||
store.dispatch('auth/updateLevel', level)
|
||||
|
||||
// 登录后处理
|
||||
afterLogin(superuser)
|
||||
|
||||
@@ -8,6 +8,7 @@ interface AuthState {
|
||||
userName: string
|
||||
avatar: string
|
||||
originalPath: string | null
|
||||
level: number
|
||||
}
|
||||
|
||||
// 定义根状态类型
|
||||
@@ -25,6 +26,7 @@ const authModule: Module<AuthState, RootState> = {
|
||||
userName: '',
|
||||
avatar: '',
|
||||
originalPath: null,
|
||||
level: 1,
|
||||
},
|
||||
mutations: {
|
||||
setToken(state, token: string) {
|
||||
@@ -45,6 +47,12 @@ const authModule: Module<AuthState, RootState> = {
|
||||
setAvatar(state, avatar: string) {
|
||||
state.avatar = avatar
|
||||
},
|
||||
setOriginalPath(state, originalPath: string) {
|
||||
state.originalPath = originalPath
|
||||
},
|
||||
setLevel(state, level: number) {
|
||||
state.level = level
|
||||
},
|
||||
},
|
||||
actions: {
|
||||
updateToken({ commit }, token: string) {
|
||||
@@ -65,6 +73,12 @@ const authModule: Module<AuthState, RootState> = {
|
||||
updateAvatar({ commit }, avatar: string) {
|
||||
commit('setAvatar', avatar)
|
||||
},
|
||||
updateOriginalPath({ commit }, originalPath: string) {
|
||||
commit('setOriginalPath', originalPath)
|
||||
},
|
||||
updateLevel({ commit }, level: number) {
|
||||
commit('setLevel', level)
|
||||
},
|
||||
},
|
||||
getters: {
|
||||
getToken: state => state.token,
|
||||
@@ -72,6 +86,8 @@ const authModule: Module<AuthState, RootState> = {
|
||||
getSuperUser: state => state.superUser,
|
||||
getUserName: state => state.userName,
|
||||
getAvatar: state => state.avatar,
|
||||
getOriginalPath: state => state.originalPath,
|
||||
getLevel: state => state.level,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import api from '@/api'
|
||||
import { FileItem, MediaDirectory } from '@/api/types'
|
||||
import FileBrowser from '@/components/FileBrowser.vue'
|
||||
import store from '@/store'
|
||||
|
||||
const endpoints = {
|
||||
list: {
|
||||
@@ -30,6 +31,11 @@ const endpoints = {
|
||||
},
|
||||
}
|
||||
|
||||
const user_level = store.state.auth.level
|
||||
|
||||
// 用户存储
|
||||
const userStorage = user_level > 1 ? 'local,aliyun,u115' : 'local'
|
||||
|
||||
// 当前目录
|
||||
const path = ref<string>('')
|
||||
|
||||
@@ -112,7 +118,7 @@ onBeforeMount(loadDownloadDirectories)
|
||||
<template>
|
||||
<div>
|
||||
<FileBrowser
|
||||
storages="local,aliyun,u115"
|
||||
:storages="userStorage"
|
||||
:tree="false"
|
||||
:path="path"
|
||||
:fileid="fileid"
|
||||
|
||||
Reference in New Issue
Block a user