mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-05-08 19:57:30 +08:00
feat: level 模块
This commit is contained in:
@@ -21,11 +21,11 @@
|
|||||||
</div>
|
</div>
|
||||||
<div v-if="loggedIn && !isAuthor && !subscribed" class="article-subscribe-button" @click="subscribePost">
|
<div v-if="loggedIn && !isAuthor && !subscribed" class="article-subscribe-button" @click="subscribePost">
|
||||||
<i class="fas fa-user-plus"></i>
|
<i class="fas fa-user-plus"></i>
|
||||||
订阅文章
|
<div class="article-subscribe-button-text">订阅文章</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="loggedIn && !isAuthor && subscribed" class="article-unsubscribe-button" @click="unsubscribePost">
|
<div v-if="loggedIn && !isAuthor && subscribed" class="article-unsubscribe-button" @click="unsubscribePost">
|
||||||
<i class="fas fa-user-minus"></i>
|
<i class="fas fa-user-minus"></i>
|
||||||
取消订阅
|
<div class="article-unsubscribe-button-text">取消订阅</div>
|
||||||
</div>
|
</div>
|
||||||
<DropdownMenu v-if="articleMenuItems.length > 0" :items="articleMenuItems">
|
<DropdownMenu v-if="articleMenuItems.length > 0" :items="articleMenuItems">
|
||||||
<template #trigger>
|
<template #trigger>
|
||||||
@@ -699,6 +699,15 @@ export default {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-subscribe-button-text,
|
||||||
|
.article-unsubscribe-button-text {
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-subscribe-button:hover {
|
.article-subscribe-button:hover {
|
||||||
@@ -713,6 +722,11 @@ export default {
|
|||||||
border-radius: 8px;
|
border-radius: 8px;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-pending-button {
|
.article-pending-button {
|
||||||
|
|||||||
@@ -25,10 +25,12 @@
|
|||||||
<div class="profile-level-bar">
|
<div class="profile-level-bar">
|
||||||
<div class="profile-level-bar-inner" :style="{ width: `${levelInfo.percent}%` }" />
|
<div class="profile-level-bar-inner" :style="{ width: `${levelInfo.percent}%` }" />
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-level-exp">
|
<div class="profile-level-info">
|
||||||
{{ levelInfo.exp }} / {{ levelInfo.nextExp }}
|
<div class="profile-level-exp">
|
||||||
|
{{ levelInfo.exp }} / {{ levelInfo.nextExp }}
|
||||||
|
</div>
|
||||||
|
<div class="profile-level-target">🎉目标 Lv.{{ levelInfo.currentLevel + 1 }}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="profile-level-target">目标 Lv.{{ levelInfo.currentLevel + 1 }}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -578,6 +580,13 @@ export default {
|
|||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.profile-level-info {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
gap: 10px;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
.profile-level-exp,
|
.profile-level-exp,
|
||||||
.profile-level-target {
|
.profile-level-target {
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ public class LevelService {
|
|||||||
User user = userRepository.findByUsername(username).orElseThrow();
|
User user = userRepository.findByUsername(username).orElseThrow();
|
||||||
LocalDateTime start = LocalDate.now().atStartOfDay();
|
LocalDateTime start = LocalDate.now().atStartOfDay();
|
||||||
long count = postRepository.countByAuthorAfter(username, start);
|
long count = postRepository.countByAuthorAfter(username, start);
|
||||||
if (count >= 1) return 0;
|
if (count > 1) return 0;
|
||||||
return addExperience(user,30);
|
return addExperience(user,30);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +40,7 @@ public class LevelService {
|
|||||||
User user = userRepository.findByUsername(username).orElseThrow();
|
User user = userRepository.findByUsername(username).orElseThrow();
|
||||||
LocalDateTime start = LocalDate.now().atStartOfDay();
|
LocalDateTime start = LocalDate.now().atStartOfDay();
|
||||||
long count = commentRepository.countByAuthorAfter(username, start);
|
long count = commentRepository.countByAuthorAfter(username, start);
|
||||||
if (count >= 3) return 0;
|
if (count > 3) return 0;
|
||||||
return addExperience(user,10);
|
return addExperience(user,10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ public class LevelService {
|
|||||||
User user = userRepository.findByUsername(username).orElseThrow();
|
User user = userRepository.findByUsername(username).orElseThrow();
|
||||||
LocalDateTime start = LocalDate.now().atStartOfDay();
|
LocalDateTime start = LocalDate.now().atStartOfDay();
|
||||||
long count = reactionRepository.countByUserAfter(username, start);
|
long count = reactionRepository.countByUserAfter(username, start);
|
||||||
if (count >= 3) return 0;
|
if (count > 3) return 0;
|
||||||
return addExperience(user,5);
|
return addExperience(user,5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user