fix: waitlist

This commit is contained in:
tim
2025-07-15 10:53:35 +08:00
parent edffe48c98
commit f65df582f6
4 changed files with 96 additions and 13 deletions

View File

@@ -26,7 +26,7 @@ export default {
}, },
computed: { computed: {
hideMenu() { hideMenu() {
return ['/login', '/signup', '/404'].includes(this.$route.path) return ['/login', '/signup', '/404', '/signup-reason'].includes(this.$route.path)
} }
} }
} }

View File

@@ -185,8 +185,10 @@
<NotificationContainer :item="item" :markRead="markRead"> <NotificationContainer :item="item" :markRead="markRead">
{{ item.fromUser.username }} 希望注册为会员理由是{{ item.content }} {{ item.fromUser.username }} 希望注册为会员理由是{{ item.content }}
<template #actions v-if="authState.role === 'ADMIN'"> <template #actions v-if="authState.role === 'ADMIN'">
<button class="mark-read-button-item" @click="approve(item.fromUser.id, item.id)">同意</button> <div class="optional-buttons">
<button class="mark-read-button-item" @click="reject(item.fromUser.id, item.id)">拒绝</button> <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>
</template> </template>
</NotificationContainer> </NotificationContainer>
</template> </template>
@@ -403,7 +405,7 @@ export default {
} }
} }
}) })
} else if (n.type === 'POST_REVIEW_REQUEST') { } else if (n.type === 'POST_REVIEW_REQUEST') {
notifications.value.push({ notifications.value.push({
...n, ...n,
src: n.fromUser ? n.fromUser.avatar : null, src: n.fromUser ? n.fromUser.avatar : null,
@@ -419,7 +421,7 @@ export default {
notifications.value.push({ notifications.value.push({
...n, ...n,
icon: iconMap[n.type], icon: iconMap[n.type],
iconClick: () => {} iconClick: () => { }
}) })
} else { } else {
notifications.value.push({ notifications.value.push({
@@ -605,6 +607,32 @@ export default {
text-decoration: none !important; text-decoration: none !important;
} }
.optional-buttons {
display: flex;
flex-direction: row;
gap: 10px;
}
.mark-approve-button-item {
color: green;
cursor: pointer;
}
.mark-reject-button-item {
color: red;
cursor: pointer;
}
.mark-approve-button-item:hover {
text-decoration: underline;
}
.mark-reject-button-item:hover {
text-decoration: underline;
}
.notif-content-text:hover { .notif-content-text:hover {
color: var(--primary-color) !important; color: var(--primary-color) !important;
text-decoration: underline !important; text-decoration: underline !important;

View File

@@ -1,9 +1,14 @@
<template> <template>
<div class="reason-page"> <div class="reason-page">
<div class="reason-content"> <div class="reason-content">
<div class="reason-title">注册理由</div>
<div class="reason-description">
为了我们社区的良性发展请填写注册理由我们将根据你的理由审核你的注册, 谢谢!
</div>
<BaseInput textarea rows="4" v-model="reason" placeholder="请填写注册理由" /> <BaseInput textarea rows="4" v-model="reason" placeholder="请填写注册理由" />
<div v-if="error" class="error-message">{{ error }}</div> <div v-if="error" class="error-message">{{ error }}</div>
<div class="signup-page-button-primary" @click="submit" >提交</div> <div v-if="!isWaitingForRegister" class="signup-page-button-primary" @click="submit">提交</div>
<div v-else class="signup-page-button-primary disabled">提交中...</div>
</div> </div>
</div> </div>
</template> </template>
@@ -20,7 +25,8 @@ export default {
return { return {
reason: '', reason: '',
error: '', error: '',
isGoogle: false isGoogle: false,
isWaitingForRegister: false
} }
}, },
mounted() { mounted() {
@@ -42,6 +48,7 @@ export default {
return return
} }
try { try {
this.isWaitingForRegister = true
const res = await fetch(`${API_BASE_URL}/api/auth/register`, { const res = await fetch(`${API_BASE_URL}/api/auth/register`, {
method: 'POST', method: 'POST',
headers: { 'Content-Type': 'application/json' }, headers: { 'Content-Type': 'application/json' },
@@ -61,6 +68,8 @@ export default {
} }
} catch (e) { } catch (e) {
toast.error('发送失败') toast.error('发送失败')
} finally {
this.isWaitingForRegister = false
} }
} }
} }
@@ -68,9 +77,54 @@ export default {
</script> </script>
<style scoped> <style scoped>
.reason-page { display: flex; justify-content: center; align-items: center; height: calc(100vh - var(--header-height)); } .reason-page {
.reason-content { display: flex; flex-direction: column; gap: 20px; width: 400px; } display: flex;
.error-message { color: red; font-size: 14px; } justify-content: center;
.signup-page-button-primary { background-color: var(--primary-color); color: white; padding: 10px 20px; border-radius: 10px; text-align: center; cursor: pointer; } align-items: center;
.signup-page-button-primary:hover { background-color: var(--primary-color-hover); } background-color: var(--background-color);
height: calc(100vh - var(--header-height));
}
.reason-title {
font-size: 24px;
font-weight: bold;
}
.reason-description {
font-size: 14px;
}
.reason-content {
display: flex;
flex-direction: column;
gap: 20px;
width: 400px;
}
.error-message {
color: red;
font-size: 14px;
}
.signup-page-button-primary {
background-color: var(--primary-color);
color: white;
padding: 10px 20px;
border-radius: 10px;
text-align: center;
cursor: pointer;
}
.signup-page-button-primary:hover {
background-color: var(--primary-color-hover);
}
.signup-page-button-primary.disabled {
background-color: var(--primary-color-disabled);
}
.signup-page-button-primary.disabled:hover {
cursor: not-allowed;
}
</style> </style>

View File

@@ -96,6 +96,7 @@ public class SecurityConfig {
.requestMatchers(HttpMethod.GET, "/api/comments/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/comments/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/categories/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/categories/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/tags/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/tags/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/config/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/search/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/search/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/users/**").permitAll() .requestMatchers(HttpMethod.GET, "/api/users/**").permitAll()
.requestMatchers(HttpMethod.GET, "/api/reaction-types").permitAll() .requestMatchers(HttpMethod.GET, "/api/reaction-types").permitAll()
@@ -128,7 +129,7 @@ public class SecurityConfig {
(uri.startsWith("/api/posts") || uri.startsWith("/api/comments") || (uri.startsWith("/api/posts") || uri.startsWith("/api/comments") ||
uri.startsWith("/api/categories") || uri.startsWith("/api/tags") || uri.startsWith("/api/categories") || uri.startsWith("/api/tags") ||
uri.startsWith("/api/search") || uri.startsWith("/api/users") || uri.startsWith("/api/search") || uri.startsWith("/api/users") ||
uri.startsWith("/api/reaction-types")); uri.startsWith("/api/reaction-types") || uri.startsWith("/api/config"));
if (authHeader != null && authHeader.startsWith("Bearer ")) { if (authHeader != null && authHeader.startsWith("Bearer ")) {
String token = authHeader.substring(7); String token = authHeader.substring(7);