chore: update project files
This commit is contained in:
@@ -25,6 +25,14 @@ export const useUserStore = defineStore('user', () => {
|
||||
const isAdmin = computed(() => user.value?.role === 'ROLE_ADMIN')
|
||||
const username = computed(() => user.value?.username || '')
|
||||
|
||||
// 可用积分(总积分 - 冻结积分)
|
||||
const availablePoints = computed(() => {
|
||||
if (!user.value) return 0
|
||||
const total = user.value.points || 0
|
||||
const frozen = user.value.frozenPoints || 0
|
||||
return Math.max(0, total - frozen)
|
||||
})
|
||||
|
||||
// 登录
|
||||
const loginUser = async (credentials) => {
|
||||
try {
|
||||
@@ -147,6 +155,7 @@ export const useUserStore = defineStore('user', () => {
|
||||
isAuthenticated,
|
||||
isAdmin,
|
||||
username,
|
||||
availablePoints,
|
||||
// 方法
|
||||
loginUser,
|
||||
registerUser,
|
||||
|
||||
Reference in New Issue
Block a user