This commit is contained in:
2023-10-16 11:27:37 +08:00
parent 826f99350c
commit b5b55dc3b2
29 changed files with 951 additions and 319 deletions

View File

@@ -90,7 +90,7 @@ onMounted(async () => {
请在点击
<NText type="primary" strong> 开始认证 </NText>
后五分钟之内使用
<NText> 需要认证的账户 </NText>
<NText strong type="primary"> 需要认证的账户 </NText>
在自己的直播间内发送
<NButton type="info" text @click="copyCode">
{{ accountInfo?.biliVerifyCode }}

View File

@@ -1,32 +1,48 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import { NAlert, NButton, NCard, NDivider, NSpace, NTag, NText, NThing, NTime } from 'naive-ui'
import SettingsManageView from './SettingsManageView.vue';
const accountInfo = useAccount()
</script>
<template>
<NCard embedded style="max-width: 500px">
<NSpace align="center" justify="center" vertical>
<NText style="font-size: 3rem">
{{ accountInfo?.name }}
</NText>
<NText style="color: gray">
<NTime :time="accountInfo?.createAt" />
注册
</NText>
</NSpace>
<NSpace justify="center" align="center" vertical>
<NCard embedded style="max-width: 90%;width: 800px;">
<NSpace align="center" justify="center" vertical>
<NText style="font-size: 3rem">
{{ accountInfo?.name }}
</NText>
<NText style="color: gray">
<NTime :time="accountInfo?.createAt" />
注册
</NText>
</NSpace>
<NDivider />
<NAlert>
Bilibili 账户:
<NTag v-if="accountInfo?.isBiliVerified" type="success"> 已认证 </NTag>
<template v-else>
<NTag type="error" size="small"> 未认证 </NTag>
<NDivider vertical />
<NButton size="small" @click="$router.push({ name: 'manage-biliVerify' })" type="info"> 前往认证 </NButton>
</template>
</NAlert>
</NCard>
<NDivider />
<NAlert>
邮箱:
<NTag v-if="accountInfo?.isEmailVerified" type="success"> 已认证 | {{ accountInfo?.bindEmail }} </NTag>
<template v-else>
<NTag type="error" size="small"> 未认证 </NTag>
</template>
</NAlert>
<NAlert>
Bilibili 账户:
<NTag v-if="accountInfo?.isBiliVerified" type="success"> 已认证 </NTag>
<template v-else>
<NTag type="error" size="small"> 未认证 </NTag>
<NDivider vertical />
<NButton size="small" @click="$router.push({ name: 'manage-biliVerify' })" type="info"> 前往认证 </NButton>
</template>
</NAlert>
</NCard>
<div style="max-width: 90%;width: 800px;">
<NDivider/>
<SettingsManageView />
</div>
</NSpace>
</template>

View File

@@ -0,0 +1,2 @@
<script setup lang="ts">
</script>

View File

@@ -104,9 +104,9 @@ async function read(question: QAInfo, read: boolean) {
})
}
async function favorite(question: QAInfo, fav: boolean) {
await QueryGetAPI(QUESTION_API_URL + 'read', {
await QueryGetAPI(QUESTION_API_URL + 'favorite', {
id: question.id,
read: fav ? 'true' : 'false',
favorite: fav ? 'true' : 'false',
})
.then((data) => {
if (data.code == 200) {
@@ -164,6 +164,11 @@ function onOpenModal(question: QAInfo) {
replyMessage.value = question.answer?.message
replyModalVisiable.value = true
}
function refresh() {
isSendGetted = false
isRevieveGetted = false
onTabChange(selectedTabItem.value)
}
onMounted(() => {
GetRecieveQAInfo()
@@ -171,12 +176,12 @@ onMounted(() => {
</script>
<template>
<NButton type="primary"> 刷新 </NButton>
<NButton type="primary" @click="refresh"> 刷新 </NButton>
<NDivider style="margin: 10px 0 10px 0" />
<NTabs animated @update:value="onTabChange" v-model:value="selectedTabItem">
<NTabPane tab="我收到的" name="0">
只显示收藏 <NSwitch v-model:value="onlyFavorite" />
<NList>
<NList :bordered="false">
<NListItem v-for="item in recieveQuestionsFiltered" :key="item.id">
<NCard :embedded="!item.isReaded" hoverable size="small">
<template #header>
@@ -209,7 +214,7 @@ onMounted(() => {
收藏
</NButton>
<NButton size="small"> 举报 </NButton>
<NButton size="small"> 拉黑 </NButton>
<NButton size="small" @click="blacklist(item)"> 拉黑 </NButton>
</NSpace>
</template>
<template #header-extra>
@@ -279,3 +284,9 @@ onMounted(() => {
<NButton :loading="isRepling" @click="reply" type="primary"> 发送 </NButton>
</NModal>
</template>
<style>
.n-list{
background-color: transparent;
}
</style>

View File

@@ -1,6 +1,6 @@
<script setup lang="ts">
import { useAccount } from '@/api/account'
import { NButton, NCard, NCheckbox, NCheckboxGroup, NDivider, NForm, NSwitch, useMessage } from 'naive-ui'
import { NButton, NCard, NCheckbox, NCheckboxGroup, NDivider, NForm, NSpace, NSwitch, useMessage } from 'naive-ui'
import { ref } from 'vue'
import { useRequest } from 'vue-request'
import { FunctionTypes } from '@/api/api-models'
@@ -20,24 +20,60 @@ function UpdateEnableFunction(func: FunctionTypes, enable: boolean) {
}
}
}
async function SaveSetting() {
const data = await QueryPostAPI(ACCOUNT_API_URL + 'update-setting', {
setting: JSON.stringify(account.value?.settings),
})
if (data.code == 200) {
message.success('保存成功')
async function SaveComboGroupSetting(value: (string | number)[], meta: { actionType: 'check' | 'uncheck'; value: string | number }) {
if (account.value) {
//UpdateEnableFunction(meta.value as FunctionTypes, meta.actionType == 'check')
await QueryPostAPI(ACCOUNT_API_URL + 'update-setting', account.value?.settings)
.then((data) => {
if (data.code == 200) {
//message.success('保存成功')
} else {
message.error('修改失败')
if (account.value) {
account.value.settings.enableFunctions = account.value.settings.enableFunctions.filter((f) => f != (meta.value as FunctionTypes))
}
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
}
}
async function SaveComboSetting(value :boolean) {
if (account.value) {
//UpdateEnableFunction(meta.value as FunctionTypes, meta.actionType == 'check')
await QueryPostAPI(ACCOUNT_API_URL + 'update-setting', account.value?.settings)
.then((data) => {
if (data.code == 200) {
//message.success('保存成功')
} else {
message.error('修改失败')
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
}
}
</script>
<template>
<NCard v-if="account">
<NDivider> 启用功能 </NDivider>
<NCheckboxGroup v-model:value="account.settings.enableFunctions">
<NCard v-if="account" title="设置">
<NDivider style="margin: 0"> 启用功能 </NDivider>
<NCheckboxGroup v-model:value="account.settings.enableFunctions" @update:value="SaveComboGroupSetting">
<NCheckbox :value="FunctionTypes.SongList"> 歌单 </NCheckbox>
<NCheckbox :value="FunctionTypes.QuestionBox"> 提问箱(棉花糖 </NCheckbox>
</NCheckboxGroup>
<NDivider />
<NButton @click="SaveSetting"> 保存 </NButton>
<NDivider > 通知 </NDivider>
<NSpace>
<NCheckbox v-model:checked="account.settings.sendEmail.recieveQA" @update:checked="SaveComboSetting"> 收到新提问时发送邮件 </NCheckbox>
<NCheckbox v-model:checked="account.settings.sendEmail.recieveQAReply" @update:checked="SaveComboSetting"> 提问收到回复时发送邮件 </NCheckbox>
</NSpace>
<NDivider> 提问箱 </NDivider>
<NSpace>
<NCheckbox v-model:checked="account.settings.questionBox.allowUnregistedUser" @update:checked="SaveComboSetting"> 允许未注册用户提问 </NCheckbox>
</NSpace>
</NCard>
</template>

View File

@@ -171,10 +171,22 @@ async function addNeteaseSongs() {
}
async function addFingsingSongs(song: SongsInfo) {
isModalLoading.value = true
if (!song.url) {
try {
const url = await getFivesingSongUrl(song)
song.url = url
} catch (err) {
isModalLoading.value = false
message.error('添加失败')
console.error(err)
return
}
}
await addSongs([song], SongFrom.FiveSing)
.then((data) => {
if (data.code == 200) {
message.success(`已添加歌曲`)
addSongModel.value = {} as SongsInfo
songs.value.push(...data.data)
} else {
message.error('添加失败: ' + data.message)
@@ -311,8 +323,21 @@ onMounted(async () => {
</script>
<template>
<NButton @click="showModal = true"> 添加歌曲 </NButton>
<NModal v-model:show="showModal" style="max-width: 1000px;" preset="card">
<NSpace>
<NButton @click="showModal = true" type="primary"> 添加歌曲 </NButton>
<NButton
@click="
() => {
getSongs()
message.success('完成')
}
"
>
刷新
</NButton>
</NSpace>
<NDivider style="margin: 16px 0 16px 0" />
<NModal v-model:show="showModal" style="max-width: 1000px" preset="card">
<template #header> 添加歌曲 </template>
<NSpin :show="isModalLoading">
<NTabs default-value="custom" animated>
@@ -377,10 +402,10 @@ onMounted(async () => {
</NTag>
</NSpace>
</td>
<td style="display: flex; justify-content: flex-end;">
<td style="display: flex; justify-content: flex-end">
<!-- 在这里播放song.url链接中的音频 -->
<NButton size="small" v-if="!song.url" @click="playFivesingSong(song)" :loading="isGettingFivesingSongPlayUrl == song.id"> 试听 </NButton>
<audio v-else controls autoplay style="max-height: 30px">
<NButton size="small" v-if="!song.url" @click="playFivesingSong(song)" :loading="isGettingFivesingSongPlayUrl == song.id"> 试听 </NButton>
<audio v-else controls style="max-height: 30px">
<source :src="song.url" />
</audio>
</td>
@@ -398,5 +423,6 @@ onMounted(async () => {
</NTabs>
</NSpin>
</NModal>
<SongList :songs="songs" />
<SongList :songs="songs" is-self />
<NDivider />
</template>