mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-08 11:47:28 +08:00
feat: waitlist mode
This commit is contained in:
@@ -29,8 +29,9 @@ export async function googleAuthWithToken(idToken, reason, redirect) {
|
||||
await loadCurrentUser()
|
||||
toast.success('登录成功')
|
||||
if (redirect) redirect()
|
||||
} else {
|
||||
toast.error(data.error || '登录失败')
|
||||
} else if (data.reason_code === 'NOT_APPROVED') {
|
||||
toast.info('您的注册理由正在审批中')
|
||||
if (redirect) redirect()
|
||||
}
|
||||
} catch (e) {
|
||||
toast.error('登录失败')
|
||||
|
||||
@@ -185,10 +185,11 @@
|
||||
<NotificationContainer :item="item" :markRead="markRead">
|
||||
{{ item.fromUser.username }} 希望注册为会员,理由是:{{ item.content }}
|
||||
<template #actions v-if="authState.role === 'ADMIN'">
|
||||
<div class="optional-buttons">
|
||||
<div v-if="!item.read" class="optional-buttons">
|
||||
<div class="mark-approve-button-item" @click="approve(item.fromUser.id, item.id)">同意</div>
|
||||
<div class="mark-reject-button-item" @click="reject(item.fromUser.id, item.id)">拒绝</div>
|
||||
</div>
|
||||
<div v-else class="mark-read-button-item" @click="markRead(item.id)">已读</div>
|
||||
</template>
|
||||
</NotificationContainer>
|
||||
</template>
|
||||
@@ -269,10 +270,14 @@ export default {
|
||||
}
|
||||
|
||||
const markAllRead = async () => {
|
||||
const ok = await markNotificationsRead(notifications.value.map(n => n.id))
|
||||
// 除了 REGISTER_REQUEST 类型消息
|
||||
const idsToMark = notifications.value.filter(n => n.type !== 'REGISTER_REQUEST').map(n => n.id)
|
||||
const ok = await markNotificationsRead(idsToMark)
|
||||
if (ok) {
|
||||
notifications.value.forEach(n => n.read = true)
|
||||
toast.success('已读所有消息')
|
||||
notifications.value.forEach(n => {
|
||||
if (n.type !== 'REGISTER_REQUEST') n.read = true
|
||||
})
|
||||
toast.success('已读所有消息(注册请求除外)')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,12 +48,14 @@ export default {
|
||||
return
|
||||
}
|
||||
if (this.isGoogle) {
|
||||
this.isWaitingForRegister = true
|
||||
const token = this.googleToken || sessionStorage.getItem('google_id_token')
|
||||
if (!token) {
|
||||
toast.error('Google 登录失败')
|
||||
return
|
||||
}
|
||||
await googleAuthWithToken(token, this.reason, () => { this.$router.push('/') })
|
||||
this.isWaitingForRegister = false
|
||||
sessionStorage.removeItem('google_id_token')
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user