add switch

This commit is contained in:
2024-02-21 12:04:41 +08:00
parent 76d1838768
commit aa7fbd47a0
65 changed files with 2220 additions and 806 deletions

View File

@@ -4,7 +4,26 @@ import { QAInfo, UserInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import { QUESTION_API_URL, TURNSTILE_KEY } from '@/data/constants'
import GraphemeSplitter from 'grapheme-splitter'
import { NAlert, NAvatar, NButton, NCard, NCheckbox, NDivider, NEmpty, NImage, NInput, NList, NListItem, NSpace, NText, NTime, NTooltip, NUpload, UploadFileInfo, useMessage } from 'naive-ui'
import {
NAlert,
NAvatar,
NButton,
NCard,
NCheckbox,
NDivider,
NEmpty,
NImage,
NInput,
NList,
NListItem,
NSpace,
NText,
NTime,
NTooltip,
NUpload,
UploadFileInfo,
useMessage,
} from 'naive-ui'
import { computed, onMounted, onUnmounted, ref } from 'vue'
import VueTurnstile from 'vue-turnstile'
@@ -121,7 +140,15 @@ onUnmounted(() => {
<NCard embedded>
<NSpace vertical>
<NSpace align="center" justify="center">
<NInput :disabled="isSelf" show-count maxlength="1000" type="textarea" :count-graphemes="countGraphemes" v-model:value="questionMessage" style="width: 300px" />
<NInput
:disabled="isSelf"
show-count
maxlength="1000"
type="textarea"
:count-graphemes="countGraphemes"
v-model:value="questionMessage"
style="width: 300px"
/>
<NUpload
:max="1"
accept=".png,.jpg,.jpeg,.gif,.svg,.webp,.ico"
@@ -143,10 +170,25 @@ onUnmounted(() => {
</NSpace>
<NDivider style="margin: 10px 0 10px 0" />
<NSpace justify="center">
<NButton :disabled="isSelf" type="primary" :loading="isSending || !token" @click="SendQuestion"> 发送 </NButton>
<NButton v-if="accountInfo" :disabled="isSelf" type="info" @click="$router.push({ name: 'manage-questionBox', query: { send: '1' } })"> 发送 </NButton>
<NButton :disabled="isSelf" type="primary" :loading="isSending || !token" @click="SendQuestion">
发送
</NButton>
<NButton
v-if="accountInfo"
:disabled="isSelf"
type="info"
@click="$router.push({ name: 'manage-questionBox', query: { send: '1' } })"
>
我发送的
</NButton>
</NSpace>
<VueTurnstile ref="turnstile" :site-key="TURNSTILE_KEY" v-model="token" theme="auto" style="text-align: center" />
<VueTurnstile
ref="turnstile"
:site-key="TURNSTILE_KEY"
v-model="token"
theme="auto"
style="text-align: center"
/>
<NAlert v-if="isSelf" type="warning"> 不能给自己提问 </NAlert>
</NSpace>
</NCard>

View File

@@ -1,6 +1,13 @@
<template>
<NSpin v-if="isLoading" show />
<component v-else :is="ScheduleTemplateMap[componentType ?? ''].compoent" :bili-info="biliInfo" :user-info="userInfo" :currentData="currentData" v-bind="$attrs" />
<component
v-else
:is="ScheduleTemplateMap[componentType ?? ''].compoent"
:bili-info="biliInfo"
:user-info="userInfo"
:currentData="currentData"
v-bind="$attrs"
/>
</template>
<script lang="ts" setup>

View File

@@ -44,9 +44,12 @@ const settings = ref<Setting_SongRequest>({} as Setting_SongRequest)
async function getSongRequestInfo() {
try {
const data = await QueryGetAPI<{ songs: SongRequestInfo[]; setting: Setting_SongRequest }>(SONG_REQUEST_API_URL + 'get-active-and-settings', {
id: props.userInfo?.id,
})
const data = await QueryGetAPI<{ songs: SongRequestInfo[]; setting: Setting_SongRequest }>(
SONG_REQUEST_API_URL + 'get-active-and-settings',
{
id: props.userInfo?.id,
},
)
if (data.code == 200) {
return data.data
}

View File

@@ -76,7 +76,9 @@ export const Config: TemplateConfig<ConfigType> = {
<NDivider />
<NSpace align="center" justify="center">
<NButton type="primary" @click="navigate('https://space.bilibili.com/' + userInfo?.biliId)"> 个人主页 </NButton>
<NButton type="primary" secondary @click="navigate('https://live.bilibili.com/' + userInfo?.biliRoomId)"> 直播间 </NButton>
<NButton type="primary" secondary @click="navigate('https://live.bilibili.com/' + userInfo?.biliRoomId)">
直播间
</NButton>
</NSpace>
</template>
<template v-else>

View File

@@ -39,4 +39,4 @@ export const Config: TemplateConfig<ConfigType> = {
}
</script>
<template></template>
<template>1</template>

View File

@@ -58,7 +58,12 @@ onMounted(() => {
<NDivider />
<div ref="table" class="schedule-template pinky container">
<div class="schedule-template pinky day-container">
<div class="schedule-template pinky day-item" :id="index.toString()" v-for="(item, index) in currentWeek?.days" :key="index">
<div
class="schedule-template pinky day-item"
:id="index.toString()"
v-for="(item, index) in currentWeek?.days"
:key="index"
>
<div class="schedule-template pinky header">
<span class="schedule-template pinky week">
{{ days[index] }}
@@ -93,7 +98,8 @@ onMounted(() => {
height: 700px;
border-radius: 20px;
background-color: #faebeb;
background-image: linear-gradient(90deg, #ffffff 10%, rgba(0, 0, 0, 0) 10%), linear-gradient(#ffffff 10%, rgba(0, 0, 0, 0) 10%);
background-image: linear-gradient(90deg, #ffffff 10%, rgba(0, 0, 0, 0) 10%),
linear-gradient(#ffffff 10%, rgba(0, 0, 0, 0) 10%);
background-size: 20px 20px;
border: 3px solid #e0cbcb;
}