增加前端格式检查配置

This commit is contained in:
yml2213
2026-06-08 06:40:33 +08:00
parent 79ea3a476c
commit 500f511185
150 changed files with 7254 additions and 4013 deletions
+25 -9
View File
@@ -1,7 +1,17 @@
import { defineStore } from 'pinia'
import { fetchAdminMe, loginAdmin, type AdminRole, type AdminUser } from '@/features/admin/api/adminAuth'
import { clearAuthStorage, getAccessToken, getRefreshToken, setAuthTokens } from '@/utils/authStorage'
import {
fetchAdminMe,
loginAdmin,
type AdminRole,
type AdminUser,
} from '@/features/admin/api/adminAuth'
import {
clearAuthStorage,
getAccessToken,
getRefreshToken,
setAuthTokens,
} from '@/utils/authStorage'
export const useAdminSessionStore = defineStore('adminSession', {
state: () => ({
@@ -10,19 +20,22 @@ export const useAdminSessionStore = defineStore('adminSession', {
adminId: Number(localStorage.getItem('admin_id') || 0),
username: localStorage.getItem('admin_username') || '',
nickname: '',
supportStatus: (localStorage.getItem('admin_support_status') || 'offline') as 'online' | 'offline' | 'busy',
supportStatus: (localStorage.getItem('admin_support_status') || 'offline') as
| 'online'
| 'offline'
| 'busy',
roles: [] as AdminRole[],
permissions: [] as string[],
}),
getters: {
hasPermission: (state) => {
hasPermission: state => {
return (code: string) => state.permissions.includes(code) || state.permissions.includes('*')
},
hasRole: (state) => {
return (code: string) => state.roles.some((r) => r.code === code)
hasRole: state => {
return (code: string) => state.roles.some(r => r.code === code)
},
isSuperAdmin: (state) => {
return state.roles.some((r) => r.code === 'super_admin') || state.permissions.includes('*')
isSuperAdmin: state => {
return state.roles.some(r => r.code === 'super_admin') || state.permissions.includes('*')
},
},
actions: {
@@ -53,7 +66,10 @@ export const useAdminSessionStore = defineStore('adminSession', {
this.refreshToken = getRefreshToken('admin')
this.adminId = Number(localStorage.getItem('admin_id') || 0)
this.username = localStorage.getItem('admin_username') || ''
this.supportStatus = (localStorage.getItem('admin_support_status') || 'offline') as 'online' | 'offline' | 'busy'
this.supportStatus = (localStorage.getItem('admin_support_status') || 'offline') as
| 'online'
| 'offline'
| 'busy'
},
applySession(admin: AdminUser, accessToken: string, refreshToken: string) {
this.token = accessToken