diff --git a/src/@core/utils/navigator.ts b/src/@core/utils/navigator.ts index e06a48f9..e3f3782f 100644 --- a/src/@core/utils/navigator.ts +++ b/src/@core/utils/navigator.ts @@ -2,8 +2,7 @@ export async function getClipboardContent() { if (navigator.clipboard && window.isSecureContext) { return await navigator.clipboard.readText() - } - else { + } else { const input = document.createElement('textarea') document.body.appendChild(input) input.select() @@ -18,8 +17,7 @@ export async function getClipboardContent() { export async function copyToClipboard(content: string) { if (navigator.clipboard && window.isSecureContext) { await navigator.clipboard.writeText(content) - } - else { + } else { const input = document.createElement('textarea') input.value = content document.body.appendChild(input) @@ -42,3 +40,12 @@ export function urlBase64ToUint8Array(base64String: string) { } return outputArray } + +// 判断是否为PWA +export const isPWA = async (): Promise => { + if ('serviceWorker' in navigator) { + const registrations = await navigator.serviceWorker.getRegistrations() + return registrations.length > 0 + } + return (window.navigator as any).standalone === true +} diff --git a/src/components/cards/UserCard.vue b/src/components/cards/UserCard.vue index 0d6fbd9a..f340460b 100644 --- a/src/components/cards/UserCard.vue +++ b/src/components/cards/UserCard.vue @@ -92,7 +92,9 @@ const canEditUser = computed(() => { // 计算是否有用户管理权限 const canManageUser = computed(() => { - return canEditUser + if (props.user.name == currentLoginUser) return false + if (store.state.auth.superUser) return true + return false }) // 用户重新完成时 diff --git a/src/components/dialog/UserAddEditDialog.vue b/src/components/dialog/UserAddEditDialog.vue index f54ddf69..e732831c 100644 --- a/src/components/dialog/UserAddEditDialog.vue +++ b/src/components/dialog/UserAddEditDialog.vue @@ -63,7 +63,7 @@ const userForm = ref({ name: props.username ?? '', password: '', email: '', - is_active: false, + is_active: true, is_superuser: false, avatar: avatar1, is_otp: false, diff --git a/src/components/filebrowser/FileList.vue b/src/components/filebrowser/FileList.vue index 252e747d..79dd98d9 100644 --- a/src/components/filebrowser/FileList.vue +++ b/src/components/filebrowser/FileList.vue @@ -15,9 +15,7 @@ import { useDisplay } from 'vuetify' const display = useDisplay() // APP -const appMode = computed(() => { - return localStorage.getItem('MP_APPMODE') != '0' && display.mdAndDown.value -}) +const appMode = inject('appMode') // 输入参数 const inProps = defineProps({ @@ -119,7 +117,7 @@ const currentImgLink = ref('') // 大小控制 const scrollStyle = computed(() => { - return appMode.value + return appMode ? 'height: calc(100vh - 15.5rem - env(safe-area-inset-bottom) - 3.5rem)' : 'height: calc(100vh - 14.5rem - env(safe-area-inset-bottom)' }) diff --git a/src/layouts/components/DefaultLayout.vue b/src/layouts/components/DefaultLayout.vue index c95f45bd..8dbbdf09 100644 --- a/src/layouts/components/DefaultLayout.vue +++ b/src/layouts/components/DefaultLayout.vue @@ -14,9 +14,7 @@ import { NavMenu } from '@/@layouts/types' import { useDisplay } from 'vuetify' const display = useDisplay() -const appMode = computed(() => { - return localStorage.getItem('MP_APPMODE') != '0' && display.mdAndDown.value -}) +const appMode = inject('appMode') // 是否超级用户 let superUser = store.state.auth.superUser diff --git a/src/layouts/components/Footer.vue b/src/layouts/components/Footer.vue index 4b0e7d1b..57cf1b25 100644 --- a/src/layouts/components/Footer.vue +++ b/src/layouts/components/Footer.vue @@ -1,10 +1,5 @@