update domain

This commit is contained in:
2023-10-22 10:14:27 +08:00
parent 989b562322
commit d5d719f168
9 changed files with 80 additions and 52 deletions

View File

@@ -95,9 +95,7 @@ function onPasswordInput() {
rPasswordFormItemRef.value?.validate({ trigger: 'password-input' }) rPasswordFormItemRef.value?.validate({ trigger: 'password-input' })
} }
} }
function onregisterButtonClick(e: MouseEvent) { function onregisterButtonClick() {
e.preventDefault()
formRef.value?.validate().then(async () => { formRef.value?.validate().then(async () => {
isLoading.value = true isLoading.value = true
await QueryPostAPI<string>( await QueryPostAPI<string>(
@@ -200,7 +198,7 @@ function onLoginButtonClick() {
<NInput v-model:value="registerModel.password" type="password" @input="onPasswordInput" @keydown.enter.prevent /> <NInput v-model:value="registerModel.password" type="password" @input="onPasswordInput" @keydown.enter.prevent />
</NFormItem> </NFormItem>
<NFormItem ref="rPasswordFormItemRef" first path="reenteredPassword" label="重复密码"> <NFormItem ref="rPasswordFormItemRef" first path="reenteredPassword" label="重复密码">
<NInput v-model:value="registerModel.reenteredPassword" :disabled="!registerModel.password" type="password" @keydown.enter.prevent /> <NInput v-model:value="registerModel.reenteredPassword" :disabled="!registerModel.password" type="password" @keydown.enter="onregisterButtonClick"/>
</NFormItem> </NFormItem>
</NForm> </NForm>
<NSpace vertical justify="center" align="center"> <NSpace vertical justify="center" align="center">

View File

@@ -52,7 +52,7 @@ const emit = defineEmits<{
</NPopconfirm> </NPopconfirm>
</NSpace> </NSpace>
</template> </template>
<NGrid x-gap="8" cols="1 1000:7"> <NGrid x-gap="8" cols="1 1200:7">
<NGridItem v-for="(day, index) in item.days" v-bind:key="index"> <NGridItem v-for="(day, index) in item.days" v-bind:key="index">
<NCard <NCard
size="small" size="small"

View File

@@ -28,6 +28,7 @@ function get() {
export const notifactions = () => n export const notifactions = () => n
export const GetNotifactions = () => { export const GetNotifactions = () => {
if (account) { if (account) {
setInterval(get, 5000) //setInterval(get, 5000)
//暂时不用
} }
} }

View File

@@ -85,6 +85,10 @@ const iconColor = 'white'
BY BY
<NButton tag="a" href="https://space.bilibili.com/10021741" target="_blank" text style="color: rgb(161, 236, 199)"> Megghy </NButton> <NButton tag="a" href="https://space.bilibili.com/10021741" target="_blank" text style="color: rgb(161, 236, 199)"> Megghy </NButton>
</span> </span>
<NDivider vertical/>
<span>
<NButton @click="$router.push('/about')" text> 关于 </NButton>
</span>
</NSpace> </NSpace>
</div> </div>
</template> </template>

View File

@@ -201,7 +201,10 @@ onMounted(() => {
<div style="box-sizing: border-box; padding: 20px"> <div style="box-sizing: border-box; padding: 20px">
<RouterView v-slot="{ Component }" v-if="accountInfo?.isEmailVerified"> <RouterView v-slot="{ Component }" v-if="accountInfo?.isEmailVerified">
<KeepAlive> <KeepAlive>
<Suspense>
<component :is="Component" /> <component :is="Component" />
<template #fallback> Loading... </template>
</Suspense>
</KeepAlive> </KeepAlive>
</RouterView> </RouterView>
<template v-else> <template v-else>

View File

@@ -2,13 +2,13 @@
import { useAccount } from '@/api/account' import { useAccount } from '@/api/account'
import { QueryGetAPI } from '@/api/query' import { QueryGetAPI } from '@/api/query'
import { HISTORY_API_URL } from '@/data/constants' import { HISTORY_API_URL } from '@/data/constants'
import { NAlert, NCard, NSpace, useMessage } from 'naive-ui' import { NAlert, NCard, NSpace, NSpin, useMessage } from 'naive-ui'
import { onMounted, ref } from 'vue' import { onMounted, ref } from 'vue'
import { use } from 'echarts/core' import { use } from 'echarts/core'
import { CanvasRenderer } from 'echarts/renderers' import { CanvasRenderer } from 'echarts/renderers'
import { LineChart } from 'echarts/charts' import { LineChart } from 'echarts/charts'
import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, DataZoomComponent } from 'echarts/components' import { TitleComponent, TooltipComponent, LegendComponent, GridComponent, DataZoomComponent } from 'echarts/components'
import VChart, { THEME_KEY } from 'vue-echarts' import VChart from 'vue-echarts'
import { format } from 'date-fns' import { format } from 'date-fns'
use([CanvasRenderer, LineChart, TitleComponent, TooltipComponent, LegendComponent, GridComponent, DataZoomComponent, LineChart]) use([CanvasRenderer, LineChart, TitleComponent, TooltipComponent, LegendComponent, GridComponent, DataZoomComponent, LineChart])
@@ -24,6 +24,8 @@ const guardsOption = ref()
const upstatViewOption = ref() const upstatViewOption = ref()
const upstatLikeOption = ref() const upstatLikeOption = ref()
const isLoading = ref(true)
async function getFansHistory() { async function getFansHistory() {
await QueryGetAPI< await QueryGetAPI<
{ {
@@ -405,13 +407,15 @@ onMounted(async () => {
await getGuardsHistory() await getGuardsHistory()
await getUpstatHistory() await getUpstatHistory()
getOptions() getOptions()
isLoading.value = false
} }
}) })
</script> </script>
<template> <template>
<NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert> <NAlert v-if="accountInfo?.isBiliVerified != true" type="info"> 尚未进行Bilibili认证 </NAlert>
<NCard size="small"> <NSpin v-else-if="isLoading" show/>
<NCard v-else size="small">
<NSpace vertical> <NSpace vertical>
<VChart :option="fansOption" style="height: 200px" /> <VChart :option="fansOption" style="height: 200px" />
<VChart :option="guardsOption" style="height: 200px" /> <VChart :option="guardsOption" style="height: 200px" />

View File

@@ -1,9 +1,9 @@
<script setup lang="ts"> <script setup lang="ts">
import { QAInfo } from '@/api/api-models' import { QAInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query' import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import { ACCOUNT_API_URL, BASE_API, QUESTION_API_URL } from '@/data/constants' import { ACCOUNT_API_URL, QUESTION_API_URL } from '@/data/constants'
import { Heart, HeartOutline } from '@vicons/ionicons5' import { Heart, HeartOutline } from '@vicons/ionicons5'
import { NButton, NCard, NDivider, NIcon, NImage, NInput, NList, NListItem, NModal, NSpace, NSwitch, NTabPane, NTabs, NTag, NText, NTime, NTooltip, useMessage } from 'naive-ui' import { NButton, NCard, NDivider, NIcon, NImage, NInput, NList, NListItem, NModal, NSpace, NSpin, NSwitch, NTabPane, NTabs, NTag, NText, NTime, NTooltip, useMessage } from 'naive-ui'
import { computed, onMounted, ref } from 'vue' import { computed, onMounted, ref } from 'vue'
import { List } from 'linqts' import { List } from 'linqts'
import router from '@/router' import router from '@/router'
@@ -18,12 +18,14 @@ const message = useMessage()
const selectedTabItem = ref('0') const selectedTabItem = ref('0')
const isRepling = ref(false) const isRepling = ref(false)
const onlyFavorite = ref(false) const onlyFavorite = ref(false)
const isLoading = ref(true)
const replyModalVisiable = ref(false) const replyModalVisiable = ref(false)
const currentQuestion = ref<QAInfo>() const currentQuestion = ref<QAInfo>()
const replyMessage = ref() const replyMessage = ref()
async function GetRecieveQAInfo() { async function GetRecieveQAInfo() {
isLoading.value = true
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-recieve') await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-recieve')
.then((data) => { .then((data) => {
if (data.code == 200) { if (data.code == 200) {
@@ -44,6 +46,9 @@ async function GetRecieveQAInfo() {
message.error('发生错误') message.error('发生错误')
console.error(err) console.error(err)
}) })
.finally(() => {
isLoading.value = false
})
} }
async function GetSendQAInfo() { async function GetSendQAInfo() {
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-send') await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-send')
@@ -179,7 +184,8 @@ onMounted(() => {
<template> <template>
<NButton type="primary" @click="refresh"> 刷新 </NButton> <NButton type="primary" @click="refresh"> 刷新 </NButton>
<NDivider style="margin: 10px 0 10px 0" /> <NDivider style="margin: 10px 0 10px 0" />
<NTabs animated @update:value="onTabChange" v-model:value="selectedTabItem"> <NSpin v-if="isLoading" show/>
<NTabs v-else animated @update:value="onTabChange" v-model:value="selectedTabItem">
<NTabPane tab="我收到的" name="0"> <NTabPane tab="我收到的" name="0">
只显示收藏 <NSwitch v-model:value="onlyFavorite" /> 只显示收藏 <NSwitch v-model:value="onlyFavorite" />
<NList :bordered="false"> <NList :bordered="false">
@@ -287,7 +293,7 @@ onMounted(() => {
</template> </template>
<style> <style>
.n-list{ .n-list {
background-color: transparent; background-color: transparent;
} }
</style> </style>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useAccount } from '@/api/account' import { useAccount } from '@/api/account'
import { ScheduleDayInfo, ScheduleWeekInfo } from '@/api/api-models' import { ScheduleWeekInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query' import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import ScheduleList from '@/components/ScheduleList.vue' import ScheduleList from '@/components/ScheduleList.vue'
import { SCHEDULE_API_URL } from '@/data/constants' import { SCHEDULE_API_URL } from '@/data/constants'
@@ -11,17 +11,13 @@ import {
NButton, NButton,
NColorPicker, NColorPicker,
NDivider, NDivider,
NForm,
NFormItem,
NInput, NInput,
NInputGroup, NInputGroup,
NInputGroupLabel, NInputGroupLabel,
NModal, NModal,
NSelect, NSelect,
NSpace, NSpace,
NTabPane, NSpin,
NTabs,
NText,
NTimePicker, NTimePicker,
useMessage, useMessage,
} from 'naive-ui' } from 'naive-ui'
@@ -124,6 +120,8 @@ const accountInfo = useAccount()
const schedules = ref<ScheduleWeekInfo[]>() const schedules = ref<ScheduleWeekInfo[]>()
const message = useMessage() const message = useMessage()
const isLoading = ref(true)
const showUpdateModal = ref(false) const showUpdateModal = ref(false)
const showAddModal = ref(false) const showAddModal = ref(false)
const showCopyModal = ref(false) const showCopyModal = ref(false)
@@ -135,6 +133,7 @@ const selectedScheduleYear = ref(new Date().getFullYear())
const selectedScheduleWeek = ref(Number(format(Date.now(), 'w')) + 1) const selectedScheduleWeek = ref(Number(format(Date.now(), 'w')) + 1)
async function get() { async function get() {
isLoading.value = true
await QueryGetAPI<ScheduleWeekInfo[]>(SCHEDULE_API_URL + 'get', { await QueryGetAPI<ScheduleWeekInfo[]>(SCHEDULE_API_URL + 'get', {
id: accountInfo.value?.id ?? -1, id: accountInfo.value?.id ?? -1,
}) })
@@ -149,10 +148,11 @@ async function get() {
console.error(err) console.error(err)
message.error('加载失败') message.error('加载失败')
}) })
.finally(() => (isLoading.value = false))
} }
const isLoading = ref(false) const isFetching = ref(false)
async function addSchedule() { async function addSchedule() {
isLoading.value = true isFetching.value = true
await QueryPostAPI(SCHEDULE_API_URL + 'update', { await QueryPostAPI(SCHEDULE_API_URL + 'update', {
year: selectedScheduleYear.value, year: selectedScheduleYear.value,
week: selectedScheduleWeek.value, week: selectedScheduleWeek.value,
@@ -167,7 +167,7 @@ async function addSchedule() {
} }
}) })
.finally(() => { .finally(() => {
isLoading.value = false isFetching.value = false
}) })
} }
async function onCopySchedule() { async function onCopySchedule() {
@@ -181,12 +181,14 @@ async function onCopySchedule() {
} }
} }
async function onUpdateSchedule() { async function onUpdateSchedule() {
isFetching.value = true
await QueryPostAPI(SCHEDULE_API_URL + 'update', { await QueryPostAPI(SCHEDULE_API_URL + 'update', {
year: updateScheduleModel.value.year, year: updateScheduleModel.value.year,
week: updateScheduleModel.value.week, week: updateScheduleModel.value.week,
day: selectedDay.value, day: selectedDay.value,
days: updateScheduleModel.value?.days, days: updateScheduleModel.value?.days,
}).then((data) => { })
.then((data) => {
if (data.code == 200) { if (data.code == 200) {
message.success('成功') message.success('成功')
const s = schedules.value?.find((s) => s.year == selectedScheduleYear.value && s.week == selectedScheduleWeek.value) const s = schedules.value?.find((s) => s.year == selectedScheduleYear.value && s.week == selectedScheduleWeek.value)
@@ -200,6 +202,9 @@ async function onUpdateSchedule() {
message.error('修改失败: ' + data.message) message.error('修改失败: ' + data.message)
} }
}) })
.finally(() => {
isFetching.value = false
})
} }
async function onDeleteSchedule(schedule: ScheduleWeekInfo) { async function onDeleteSchedule(schedule: ScheduleWeekInfo) {
await QueryGetAPI(SCHEDULE_API_URL + 'del', { await QueryGetAPI(SCHEDULE_API_URL + 'del', {
@@ -247,7 +252,7 @@ onMounted(() => {
<NSelect :options="weekOptions" v-model:value="selectedScheduleWeek" /> <NSelect :options="weekOptions" v-model:value="selectedScheduleWeek" />
</NSpace> </NSpace>
<NDivider /> <NDivider />
<NButton @click="addSchedule" :loading="isLoading"> 添加 </NButton> <NButton @click="addSchedule" :loading="isFetching"> 添加 </NButton>
</NModal> </NModal>
<NModal v-model:show="showCopyModal" style="width: 600px; max-width: 90vw" preset="card" title="复制周程"> <NModal v-model:show="showCopyModal" style="width: 600px; max-width: 90vw" preset="card" title="复制周程">
<NAlert type="info"> 复制为 </NAlert> <NAlert type="info"> 复制为 </NAlert>
@@ -258,7 +263,7 @@ onMounted(() => {
<NSelect :options="weekOptions" v-model:value="selectedScheduleWeek" /> <NSelect :options="weekOptions" v-model:value="selectedScheduleWeek" />
</NSpace> </NSpace>
<NDivider /> <NDivider />
<NButton @click="onCopySchedule" :loading="isLoading"> 复制 </NButton> <NButton @click="onCopySchedule" :loading="isFetching"> 复制 </NButton>
</NModal> </NModal>
<NModal v-model:show="showUpdateModal" style="width: 600px; max-width: 90vw" preset="card" title="编辑周程"> <NModal v-model:show="showUpdateModal" style="width: 600px; max-width: 90vw" preset="card" title="编辑周程">
<NSelect :options="dayOptions" v-model:value="selectedDay" /> <NSelect :options="dayOptions" v-model:value="selectedDay" />
@@ -293,9 +298,10 @@ onMounted(() => {
:show-alpha="false" :show-alpha="false"
:modes="['hex']" :modes="['hex']"
/> />
<NButton @click="onUpdateSchedule()"> 保存 </NButton> <NButton @click="onUpdateSchedule()" :loading="isFetching"> 保存 </NButton>
</NSpace> </NSpace>
</template> </template>
</NModal> </NModal>
<ScheduleList :schedules="schedules ?? []" @on-update="onOpenUpdateModal" @on-delete="onDeleteSchedule" @on-copy="onOpenCopyModal" is-self /> <NSpin v-if="isLoading" show />
<ScheduleList v-else :schedules="schedules ?? []" @on-update="onOpenUpdateModal" @on-delete="onDeleteSchedule" @on-copy="onOpenCopyModal" is-self />
</template> </template>

View File

@@ -3,8 +3,7 @@ import { useAccount } from '@/api/account'
import { SongFrom, SongLanguage, SongsInfo } from '@/api/api-models' import { SongFrom, SongLanguage, SongsInfo } from '@/api/api-models'
import { QueryGetAPI, QueryPostAPI } from '@/api/query' import { QueryGetAPI, QueryPostAPI } from '@/api/query'
import SongList from '@/components/SongList.vue' import SongList from '@/components/SongList.vue'
import { FETCH_API, FIVESING_SEARCH_API, SONG_API_URL } from '@/data/constants' import { FETCH_API, SONG_API_URL } from '@/data/constants'
import { ca } from 'date-fns/locale'
import { import {
FormInst, FormInst,
FormRules, FormRules,
@@ -13,10 +12,6 @@ import {
NForm, NForm,
NFormItem, NFormItem,
NInput, NInput,
NInputGroup,
NInputGroupLabel,
NList,
NListItem,
NModal, NModal,
NPagination, NPagination,
NSelect, NSelect,
@@ -306,15 +301,24 @@ async function getFivesingSongUrl(song: SongsInfo): Promise<string> {
} }
return '' return ''
} }
const isLoading = ref(true)
async function getSongs() { async function getSongs() {
isLoading.value = true
await QueryGetAPI<any>(SONG_API_URL + 'get', { await QueryGetAPI<any>(SONG_API_URL + 'get', {
id: accountInfo.value?.id, id: accountInfo.value?.id,
}).then((data) => { })
.then((data) => {
if (data.code == 200) { if (data.code == 200) {
songs.value = data.data songs.value = data.data
} }
}) })
.catch((err) => {
console.error(err)
message.error('获取歌曲失败: ' + err)
})
.finally(() => {
isLoading.value = false
})
} }
onMounted(async () => { onMounted(async () => {
@@ -326,6 +330,7 @@ onMounted(async () => {
<NSpace> <NSpace>
<NButton @click="showModal = true" type="primary"> 添加歌曲 </NButton> <NButton @click="showModal = true" type="primary"> 添加歌曲 </NButton>
<NButton <NButton
:loading="isLoading"
@click=" @click="
() => { () => {
getSongs() getSongs()
@@ -423,6 +428,7 @@ onMounted(async () => {
</NTabs> </NTabs>
</NSpin> </NSpin>
</NModal> </NModal>
<SongList :songs="songs" is-self /> <NSpin v-if="isLoading" show />
<SongList v-else :songs="songs" is-self />
<NDivider /> <NDivider />
</template> </template>