update url

This commit is contained in:
2023-12-14 12:56:28 +08:00
parent 4ab1f6da4f
commit 82a0e72122
39 changed files with 299 additions and 350 deletions

View File

@@ -18,7 +18,7 @@ const roomId = ref()
const timer = ref()
function onStartVerify() {
QueryGetAPI(BILI_API_URL + 'verify', {
QueryGetAPI(BILI_API_URL() + 'verify', {
uId: uId.value,
}).then((data) => {
if (data.code == 200) {
@@ -34,7 +34,7 @@ async function checkStatus() {
uId: number
roomId: number
endTime: number
}>(BILI_API_URL + 'status')
}>(BILI_API_URL() + 'status')
if (data.code == 200) {
//正在进行认证
roomId.value ??= data.data.roomId

View File

@@ -38,7 +38,7 @@ function logout() {
}
function resetBili() {
isLoading.value = true
QueryGetAPI(ACCOUNT_API_URL + 'reset-bili')
QueryGetAPI(ACCOUNT_API_URL() + 'reset-bili')
.then((data) => {
if (data.code == 200) {
message.success('已解绑 Bilibili 账号')
@@ -50,13 +50,12 @@ function resetBili() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
}
function resetEmail() {
isLoading.value = true
QueryGetAPI(ACCOUNT_API_URL + 'reset-email', { email: newEmailAddress.value, code: newEmailVerifyCode.value })
QueryGetAPI(ACCOUNT_API_URL() + 'reset-email', { email: newEmailAddress.value, code: newEmailVerifyCode.value })
.then((data) => {
if (data.code == 200) {
message.success('已将邮箱改绑为 ' + newEmailAddress.value)
@@ -68,12 +67,11 @@ function resetEmail() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
}
function sendEmailVerifyCode() {
QueryGetAPI(ACCOUNT_API_URL + 'reset-email/code', { email: newEmailAddress.value })
QueryGetAPI(ACCOUNT_API_URL() + 'reset-email/code', { email: newEmailAddress.value })
.then((data) => {
if (data.code == 200) {
message.success('发送成功, 请检查目标邮箱. 如果没有收到, 请检查垃圾邮件')
@@ -86,7 +84,6 @@ function sendEmailVerifyCode() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
}
@@ -95,7 +92,7 @@ async function resetPassword() {
message.error('两次密码不一致')
return
}
await QueryGetAPI(ACCOUNT_API_URL + 'verify/reset-password', { password: newPassword.value })
await QueryGetAPI(ACCOUNT_API_URL() + 'verify/reset-password', { password: newPassword.value })
.then(async (data) => {
if (data.code == 200) {
message.success('密码已修改')
@@ -107,7 +104,6 @@ async function resetPassword() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
}
@@ -122,7 +118,7 @@ async function BindBili() {
uid: number
uface: string
room_id: number
}>(ACCOUNT_API_URL + 'bind-bili', { code: biliCode.value }, [['Turnstile', token.value]])
}>(ACCOUNT_API_URL() + 'bind-bili', { code: biliCode.value }, [['Turnstile', token.value]])
.then(async (data) => {
if (data.code == 200) {
message.success('已绑定, 如无特殊情况请勿刷新身份码, 如果刷新了且还需要使用本站直播相关功能请更新身份码')
@@ -134,7 +130,6 @@ async function BindBili() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
.finally(() => {
@@ -153,7 +148,7 @@ async function ChangeBili() {
uid: number
uface: string
room_id: number
}>(ACCOUNT_API_URL + 'change-bili', { code: biliCode.value }, [['Turnstile', token.value]])
}>(ACCOUNT_API_URL() + 'change-bili', { code: biliCode.value }, [['Turnstile', token.value]])
.then(async (data) => {
if (data.code == 200) {
message.success('已更新身份码')
@@ -165,7 +160,6 @@ async function ChangeBili() {
}
})
.catch((err) => {
console.error(err)
message.error('发生错误')
})
.finally(() => {

View File

@@ -86,7 +86,7 @@ async function onDateChange() {
}
async function get() {
try {
const data = await QueryGetAPI<EventModel[]>(BASE_API + 'event/get', {
const data = await QueryGetAPI<EventModel[]>(BASE_API() + 'event/get', {
start: selectedDate.value[0],
end: selectedDate.value[1],
})

View File

@@ -32,7 +32,7 @@ async function getFansHistory() {
time: number
count: number
}[]
>(HISTORY_API_URL + 'fans')
>(HISTORY_API_URL() + 'fans')
.then((data) => {
if (data.code == 200) {
fansHistory.value = data.data
@@ -41,7 +41,6 @@ async function getFansHistory() {
}
})
.catch((err) => {
console.error(err)
message.error('加载失败')
})
}
@@ -51,7 +50,7 @@ async function getGuardsHistory() {
time: number
count: number
}[]
>(HISTORY_API_URL + 'guards')
>(HISTORY_API_URL() + 'guards')
.then((data) => {
if (data.code == 200) {
guardHistory.value = data.data
@@ -60,7 +59,6 @@ async function getGuardsHistory() {
}
})
.catch((err) => {
console.error(err)
message.error('加载失败')
})
}
@@ -73,7 +71,7 @@ async function getUpstatHistory() {
likes: number
}
}[]
>(HISTORY_API_URL + 'upstat')
>(HISTORY_API_URL() + 'upstat')
.then((data) => {
if (data.code == 200) {
upstatHistory.value = data.data
@@ -82,7 +80,6 @@ async function getUpstatHistory() {
}
})
.catch((err) => {
console.error(err)
message.error('加载失败')
})
}
@@ -97,7 +94,6 @@ function getOptions() {
time: Date
count: number
}[] = []
let guards = [] as { time: number; count: number; timeString: string }[]
if (fansHistory.value) {
const startTime = new Date(fansHistory.value[0].time)
@@ -143,14 +139,21 @@ function getOptions() {
let lastDayGuards = 0
let lastDay = 0
let guardsIncreacement = [] as { time: number; count: number; timeString: string }[]
let guards = [] as { time: number; count: number; timeString: string }[]
guardHistory.value?.forEach((g) => {
if (!isSameDaySimple(g.time, lastDayGuards)) {
guards.push({
if (!isSameDay(g.time, lastDay)) {
guardsIncreacement.push({
time: lastDayGuards,
count: lastDay == 0 ? 0 : g.count - lastDayGuards,
//将timeString转换为yyyy-MM-dd HH
timeString: format(g.time, 'yyyy-MM-dd'),
})
guards.push({
time: g.time,
count: g.count,
timeString: format(g.time, 'yyyy-MM-dd'),
})
lastDay = g.time
lastDayGuards = g.count
}
@@ -238,7 +241,7 @@ function getOptions() {
axisTick: {
alignWithLabel: true,
},
boundaryGap: false, // 设置为false使得柱状图紧贴左右两侧
//boundaryGap: chartData.dailyIncrements.length < 15, // 设置为false使得柱状图紧贴左右两侧
axisLine: {
onZero: false,
lineStyle: {
@@ -292,6 +295,9 @@ function getOptions() {
{
type: 'value',
},
{
type: 'value',
},
],
xAxis: [
{
@@ -306,7 +312,7 @@ function getOptions() {
},
},
// prettier-ignore
data: guards.map((f) => f.timeString ),
data: guardsIncreacement.map((f) => f.timeString),
},
],
series: [
@@ -319,6 +325,15 @@ function getOptions() {
},
data: guards.map((f) => f.count),
},
{
name: '日增',
type: 'bar',
yAxisIndex: 1,
emphasis: {
focus: 'series',
},
data: guardsIncreacement.map((f) => f.count),
},
],
dataZoom: [
{

View File

@@ -22,9 +22,9 @@ const liveInfo = ref<ResponseLiveDetail | undefined>(await get())
async function get() {
try {
const data = await QueryGetAPI<ResponseLiveDetail>(LIVE_API_URL + 'get', {
const data = await QueryGetAPI<ResponseLiveDetail>(LIVE_API_URL() + 'get', {
id: route.params.id,
useEmoji: true
useEmoji: true,
})
if (data.code == 200) {
return data.data
@@ -33,7 +33,6 @@ async function get() {
return undefined
}
} catch (err) {
console.error(err)
message.error('无法获取数据')
}
return undefined

View File

@@ -21,7 +21,7 @@ const defaultDanmakusCount = ref(0)
async function getAll() {
try {
const data = await QueryGetAPI<ResponseLiveInfoModel[]>(LIVE_API_URL + 'get-all')
const data = await QueryGetAPI<ResponseLiveInfoModel[]>(LIVE_API_URL() + 'get-all')
if (data.code == 200) {
return data.data
} else {
@@ -29,7 +29,6 @@ async function getAll() {
return []
}
} catch (err) {
console.error(err)
message.error('无法获取数据')
}
return []

View File

@@ -164,7 +164,6 @@ async function getCommentsUsers() {
}
})
.catch((err) => {
console.error(err)
message.error('获取失败')
})
.finally(() => {
@@ -191,7 +190,6 @@ async function getForwardUsers() {
}
})
.catch((err) => {
console.error(err)
message.error('获取失败')
})
.finally(() => {
@@ -249,7 +247,6 @@ function startLottery() {
}
}
} catch (err) {
console.error(err)
message.error('发生错误')
}
}

View File

@@ -66,7 +66,7 @@ const shareUrl = computed(() => 'https://vtsuru.live/user/' + accountInfo.value?
async function GetRecieveQAInfo() {
isLoading.value = true
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-recieve')
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL() + 'get-recieve')
.then((data) => {
if (data.code == 200) {
if (data.data.length > 0) {
@@ -84,7 +84,6 @@ async function GetRecieveQAInfo() {
})
.catch((err) => {
message.error('发生错误')
console.error(err)
})
.finally(() => {
isLoading.value = false
@@ -92,7 +91,7 @@ async function GetRecieveQAInfo() {
}
async function GetSendQAInfo() {
isLoading.value = true
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL + 'get-send')
await QueryGetAPI<QAInfo[]>(QUESTION_API_URL() + 'get-send')
.then((data) => {
if (data.code == 200) {
sendQuestions.value = data.data
@@ -103,7 +102,6 @@ async function GetSendQAInfo() {
})
.catch((err) => {
message.error('发生错误')
console.error(err)
})
.finally(() => {
isLoading.value = false
@@ -111,7 +109,7 @@ async function GetSendQAInfo() {
}
async function reply() {
isRepling.value = true
await QueryPostAPI<QAInfo>(QUESTION_API_URL + 'reply', {
await QueryPostAPI<QAInfo>(QUESTION_API_URL() + 'reply', {
Id: currentQuestion.value?.id,
Message: replyMessage.value,
})
@@ -129,7 +127,6 @@ async function reply() {
}
})
.catch((err) => {
console.error(err)
message.error('发送失败')
})
.finally(() => {
@@ -137,7 +134,7 @@ async function reply() {
})
}
async function read(question: QAInfo, read: boolean) {
await QueryGetAPI(QUESTION_API_URL + 'read', {
await QueryGetAPI(QUESTION_API_URL() + 'read', {
id: question.id,
read: read ? 'true' : 'false',
})
@@ -149,12 +146,11 @@ async function read(question: QAInfo, read: boolean) {
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
}
async function favorite(question: QAInfo, fav: boolean) {
await QueryGetAPI(QUESTION_API_URL + 'favorite', {
await QueryGetAPI(QUESTION_API_URL() + 'favorite', {
id: question.id,
favorite: fav,
})
@@ -166,13 +162,12 @@ async function favorite(question: QAInfo, fav: boolean) {
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
}
async function setPublic(pub: boolean) {
isChangingPublic.value = true
await QueryGetAPI(QUESTION_API_URL + 'public', {
await QueryGetAPI(QUESTION_API_URL() + 'public', {
id: currentQuestion.value?.id,
public: pub,
})
@@ -185,7 +180,6 @@ async function setPublic(pub: boolean) {
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
.finally(() => {
@@ -193,30 +187,25 @@ async function setPublic(pub: boolean) {
})
}
async function blacklist(question: QAInfo) {
await QueryGetAPI(ACCOUNT_API_URL + 'black-list/add', {
await QueryGetAPI(ACCOUNT_API_URL() + 'black-list/add', {
id: question.sender.id,
})
.then(async (data) => {
if (data.code == 200) {
await QueryGetAPI(QUESTION_API_URL + 'del', {
await QueryGetAPI(QUESTION_API_URL() + 'del', {
id: question.id,
}).then((data) => {
if (data.code == 200) {
message.success('已拉黑 ' + question.sender.name)
} else {
message.error('修改失败: ' + data.message)
}
})
.then((data) => {
if (data.code == 200) {
message.success('已拉黑 ' + question.sender.name)
} else {
message.error('修改失败: ' + data.message)
}
})
.catch((err) => {
console.error(err)
})
} else {
message.error('拉黑失败: ' + data.message)
}
})
.catch((err) => {
console.error(err)
message.error('拉黑失败')
})
}

View File

@@ -119,7 +119,7 @@ const selectedScheduleWeek = ref(Number(format(Date.now(), 'w')) + 1)
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,
})
.then((data) => {
@@ -130,7 +130,6 @@ async function get() {
}
})
.catch((err) => {
console.error(err)
message.error('加载失败')
})
.finally(() => (isLoading.value = false))
@@ -138,7 +137,7 @@ async function get() {
const isFetching = ref(false)
async function addSchedule() {
isFetching.value = true
await QueryPostAPI(SCHEDULE_API_URL + 'update', {
await QueryPostAPI(SCHEDULE_API_URL() + 'update', {
year: selectedScheduleYear.value,
week: selectedScheduleWeek.value,
})
@@ -167,7 +166,7 @@ async function onCopySchedule() {
}
async function onUpdateSchedule() {
isFetching.value = true
await QueryPostAPI(SCHEDULE_API_URL + 'update', {
await QueryPostAPI(SCHEDULE_API_URL() + 'update', {
year: updateScheduleModel.value.year,
week: updateScheduleModel.value.week,
day: selectedDay.value,
@@ -192,7 +191,7 @@ async function onUpdateSchedule() {
})
}
async function onDeleteSchedule(schedule: ScheduleWeekInfo) {
await QueryGetAPI(SCHEDULE_API_URL + 'del', {
await QueryGetAPI(SCHEDULE_API_URL() + 'del', {
year: schedule.year,
week: schedule.week,
}).then((data) => {

View File

@@ -199,9 +199,6 @@ async function RequestBiliUserData() {
throw new Error('Bili User API Error: ' + data.message)
}
})
.catch((err) => {
console.error(err)
})
}
async function SaveComboGroupSetting(value: (string | number)[], meta: { actionType: 'check' | 'uncheck'; value: string | number }) {
if (accountInfo.value) {
@@ -219,7 +216,6 @@ async function SaveComboGroupSetting(value: (string | number)[], meta: { actionT
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
.finally(() => {
@@ -240,7 +236,6 @@ async function SaveComboSetting() {
}
})
.catch((err) => {
console.error(err)
message.error('修改失败')
})
.finally(() => {

View File

@@ -164,7 +164,6 @@ async function addCustomSong() {
})
.catch((err) => {
message.error('添加失败')
console.error(err)
})
})
.finally(() => {
@@ -190,7 +189,6 @@ async function addNeteaseSongs() {
})
.catch((err) => {
message.error('添加失败')
console.error(err)
})
.finally(() => {
isModalLoading.value = false
@@ -205,7 +203,6 @@ async function addFingsingSongs(song: SongsInfo) {
} catch (err) {
isModalLoading.value = false
message.error('添加失败')
console.error(err)
return
}
}
@@ -221,7 +218,6 @@ async function addFingsingSongs(song: SongsInfo) {
})
.catch((err) => {
message.error('添加失败')
console.error(err)
})
.finally(() => {
isModalLoading.value = false
@@ -243,7 +239,7 @@ async function addSongs(songsShoudAdd: SongsInfo[], from: SongFrom) {
async function getNeteaseSongList() {
isModalLoading.value = true
await QueryGetAPI<SongsInfo[]>(SONG_API_URL + 'get-netease-list', {
await QueryGetAPI<SongsInfo[]>(SONG_API_URL() + 'get-netease-list', {
id: neteaseSongListId.value,
})
.then((data) => {
@@ -260,7 +256,6 @@ async function getNeteaseSongList() {
}
})
.catch((err) => {
console.error(err)
message.error('获取歌单失败: ' + err)
})
.finally(() => {
@@ -293,7 +288,6 @@ async function getFivesingSearchList(isRestart = false) {
message.success(`成功获取搜索信息, 共 ${json.pageInfo.totalCount} 条, 当前第 ${fivesingCurrentPage.value}`)
})
.catch((err) => {
console.error(err)
message.error('获取歌单失败: ' + err)
})
.finally(() => {
@@ -316,7 +310,6 @@ async function playFivesingSong(song: SongsInfo) {
song.url = data
})
.catch((err) => {
console.error(err)
message.error('获取歌曲链接失败: ' + err)
})
.finally(() => {
@@ -336,7 +329,7 @@ async function getFivesingSongUrl(song: SongsInfo): Promise<string> {
const isLoading = ref(true)
async function getSongs() {
isLoading.value = true
await QueryGetAPI<any>(SONG_API_URL + 'get', {
await QueryGetAPI<any>(SONG_API_URL() + 'get', {
id: accountInfo.value?.id,
})
.then((data) => {
@@ -345,7 +338,6 @@ async function getSongs() {
}
})
.catch((err) => {
console.error(err)
message.error('获取歌曲失败: ' + err)
})
.finally(() => {

View File

@@ -108,7 +108,7 @@ const acceptVideos = computed(() => {
async function getData() {
try {
const data = await QueryGetAPI<VideoCollectDetail>(VIDEO_COLLECT_API_URL + 'get', { id: route.params.id })
const data = await QueryGetAPI<VideoCollectDetail>(VIDEO_COLLECT_API_URL() + 'get', { id: route.params.id })
if (data.code == 200) {
updateModel.value = {
id: data.data.table.id,
@@ -120,7 +120,6 @@ async function getData() {
return data.data
}
} catch (err) {
console.error(err)
message.error('获取失败')
}
return {} as VideoCollectDetail
@@ -201,7 +200,7 @@ const rejectButtonGroup = (v: VideoInfo) =>
])
function setStatus(status: VideoStatus, video: VideoInfo) {
isLoading.value = true
QueryGetAPI(VIDEO_COLLECT_API_URL + 'set-status', {
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'set-status', {
id: videoDetail.value.table.id,
bvid: video.bvid,
status: status,
@@ -215,7 +214,6 @@ function setStatus(status: VideoStatus, video: VideoInfo) {
}
})
.catch((err) => {
console.error(err)
message.error('设置失败')
})
.finally(() => {
@@ -237,7 +235,7 @@ function dateDisabled(ts: number) {
function updateTable() {
isLoading.value = true
updateModel.value.id = videoDetail.value.table.id
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL + 'update', updateModel.value)
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL() + 'update', updateModel.value)
.then((data) => {
if (data.code == 200) {
message.success('更新成功')
@@ -247,7 +245,6 @@ function updateTable() {
}
})
.catch((err) => {
console.error(err)
message.error('更新失败')
})
.finally(() => {
@@ -256,7 +253,7 @@ function updateTable() {
}
function deleteTable() {
isLoading.value = true
QueryGetAPI(VIDEO_COLLECT_API_URL + 'del', {
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'del', {
id: videoDetail.value.table.id,
})
.then((data) => {
@@ -270,7 +267,6 @@ function deleteTable() {
}
})
.catch((err) => {
console.error(err)
message.error('删除失败')
})
.finally(() => {
@@ -279,7 +275,7 @@ function deleteTable() {
}
function closeTable() {
isLoading.value = true
QueryGetAPI(VIDEO_COLLECT_API_URL + 'finish', {
QueryGetAPI(VIDEO_COLLECT_API_URL() + 'finish', {
id: videoDetail.value.table.id,
finish: !videoDetail.value.table.isFinish,
})
@@ -292,7 +288,6 @@ function closeTable() {
}
})
.catch((err) => {
console.error(err)
message.error('操作失败')
})
.finally(() => {

View File

@@ -94,7 +94,7 @@ const isLoading2 = ref(false)
async function get() {
try {
isLoading.value = true
const data = await QueryGetAPI<VideoCollectTable[]>(VIDEO_COLLECT_API_URL + 'get-all')
const data = await QueryGetAPI<VideoCollectTable[]>(VIDEO_COLLECT_API_URL() + 'get-all')
if (data.code == 200) {
//videoTables.value = data.data
return data.data
@@ -103,7 +103,6 @@ async function get() {
return []
}
} catch (err) {
console.error(err)
message.error('获取失败')
return []
} finally {
@@ -113,7 +112,7 @@ async function get() {
function createTable() {
formRef.value?.validate().then(async () => {
isLoading2.value = true
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL + 'create', createVideoModel.value)
QueryPostAPI<VideoCollectTable>(VIDEO_COLLECT_API_URL() + 'create', createVideoModel.value)
.then((data) => {
if (data.code == 200) {
videoTables.value.push(data.data)
@@ -125,7 +124,6 @@ function createTable() {
}
})
.catch((err) => {
console.error(err)
message.error('创建失败')
})
.finally(() => {