mirror of
https://github.com/Megghy/vtsuru.live.git
synced 2025-12-06 18:36:55 +08:00
优化视频收集页面,调整验证码组件位置;添加发送问题的冷却时间限制
This commit is contained in:
@@ -147,8 +147,7 @@ onUnmounted(() => {
|
||||
>
|
||||
推荐视频
|
||||
</NButton>
|
||||
</NSpace>
|
||||
</NCard>
|
||||
|
||||
<VueTurnstile
|
||||
ref="turnstile"
|
||||
v-model="token"
|
||||
@@ -156,6 +155,8 @@ onUnmounted(() => {
|
||||
theme="auto"
|
||||
style="text-align: center"
|
||||
/>
|
||||
</NSpace>
|
||||
</NCard>
|
||||
</div>
|
||||
</NLayoutContent>
|
||||
</template>
|
||||
|
||||
@@ -34,6 +34,9 @@ const { biliInfo, userInfo } = defineProps<{
|
||||
userInfo: UserInfo | undefined
|
||||
}>()
|
||||
|
||||
const nextSendQuestionTime = ref(Date.now())
|
||||
const minSendQuestionTime = 30 * 1000 // 30 seconds
|
||||
|
||||
const splitter = new GraphemeSplitter()
|
||||
|
||||
const message = useMessage()
|
||||
@@ -63,6 +66,10 @@ async function SendQuestion() {
|
||||
message.error('内容最少需要3个字')
|
||||
return
|
||||
}
|
||||
if (nextSendQuestionTime.value > Date.now()) {
|
||||
message.error('冷却中, 剩余 ' + Math.ceil((nextSendQuestionTime.value - Date.now()) / 1000) + '秒')
|
||||
return
|
||||
}
|
||||
isSending.value = true
|
||||
await QueryPostAPI<QAInfo>(
|
||||
QUESTION_API_URL + 'send',
|
||||
@@ -80,6 +87,7 @@ async function SendQuestion() {
|
||||
message.success('成功发送棉花糖')
|
||||
questionMessage.value = ''
|
||||
fileList.value = []
|
||||
nextSendQuestionTime.value = Date.now() + minSendQuestionTime
|
||||
} else {
|
||||
message.error(data.message)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user