diff --git a/src/api/api-models.ts b/src/api/api-models.ts index 8808488..491030e 100644 --- a/src/api/api-models.ts +++ b/src/api/api-models.ts @@ -151,3 +151,12 @@ export enum ThemeType { Light = 'light', Dark = 'dark', } +export interface VideoCollectTable{ + id: string + name: string + title: string + description: string + createAt: number + endAt: number + +} diff --git a/src/components/RegisterAndLogin.vue b/src/components/RegisterAndLogin.vue index 94dc447..218c6c1 100644 --- a/src/components/RegisterAndLogin.vue +++ b/src/components/RegisterAndLogin.vue @@ -5,7 +5,27 @@ import { QueryGetAPI, QueryPostAPI } from '@/api/query' import { ACCOUNT_API_URL, TURNSTILE_KEY } from '@/data/constants' import { GetNotifactions } from '@/data/notifactions' import { useLocalStorage } from '@vueuse/core' -import { FormInst, FormItemInst, FormItemRule, FormRules, NAlert, NButton, NCard, NDivider, NForm, NFormItem, NInput, NSpace, NSpin, NTab, NTabPane, NTabs, useMessage } from 'naive-ui' +import { + FormInst, + FormItemInst, + FormItemRule, + FormRules, + NAlert, + NButton, + NCard, + NCountdown, + NDivider, + NForm, + NFormItem, + NInput, + NSpace, + NSpin, + NTab, + NTabPane, + NTabs, + NTime, + useMessage, +} from 'naive-ui' import { ref } from 'vue' import VueTurnstile from 'vue-turnstile' @@ -31,6 +51,11 @@ const token = ref('') const turnstile = ref() const cookie = useLocalStorage('JWT_Token', '') +const selectedTab = ref('login') +const inputForgetPasswordValue = ref('') +const isForgetPassword = ref(false) +const canSendForgetPassword = ref(true) + const formRef = ref(null) const rPasswordFormItemRef = ref(null) const registerRules: FormRules = { @@ -95,7 +120,7 @@ function onPasswordInput() { rPasswordFormItemRef.value?.validate({ trigger: 'password-input' }) } } -function onregisterButtonClick() { +function onRegisterButtonClick() { formRef.value?.validate().then(async () => { isLoading.value = true await QueryPostAPI( @@ -133,13 +158,10 @@ function onLoginButtonClick() { await QueryPostAPI<{ account: AccountInfo token: string - }>( - ACCOUNT_API_URL + 'login', - { - nameOrEmail: loginModel.value.account, - password: loginModel.value.password, - }, - ) + }>(ACCOUNT_API_URL + 'login', { + nameOrEmail: loginModel.value.account, + password: loginModel.value.password, + }) .then(async (data) => { if (data.code == 200) { localStorage.setItem('JWT_Token', data.data.token) @@ -153,6 +175,7 @@ function onLoginButtonClick() { }) .catch((err) => { console.error(err) + message.error('登陆失败') }) .finally(() => { isLoading.value = false @@ -160,6 +183,30 @@ function onLoginButtonClick() { }) }) } +async function onForgetPassword() { + canSendForgetPassword.value = false + await QueryGetAPI(ACCOUNT_API_URL + 'reset-password', { email: inputForgetPasswordValue.value }, [['Turnstile', token.value]]) + .then(async (data) => { + if (data.code == 200) { + message.success('已发送密码重置链接到你的邮箱, 请检查') + } else { + message.error(data.message) + } + }) + .catch((err) => { + console.error(err) + message.error('发生错误') + }) + .finally(() => { + turnstile.value?.reset() + }) +} +function onForgetPasswordClick() { + isForgetPassword.value = true + setTimeout(() => { + selectedTab.value = 'forget' + }, 50) +} + diff --git a/src/data/constants.ts b/src/data/constants.ts index eb386d3..e4893eb 100644 --- a/src/data/constants.ts +++ b/src/data/constants.ts @@ -21,6 +21,7 @@ export const QUESTION_API_URL = `${BASE_API}qa/` export const LOTTERY_API_URL = `${BASE_API}lottery/` export const HISTORY_API_URL = `${BASE_API}history/` export const SCHEDULE_API_URL = `${BASE_API}schedule/` +export const VIDEO_COLLECT_API_URL = `${BASE_API}video-collect/` export const ScheduleTemplateMap = { '': { name: '默认', compoent: defineAsyncComponent(() => import('@/views/view/scheduleTemplate/DefaultScheduleTemplate.vue')) }, diff --git a/src/main.ts b/src/main.ts index 89f49c4..581c520 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,10 @@ import { createApp } from 'vue' import App from './App.vue' import router from './router' -import store from './store' import { GetSelfAccount } from './api/account' import { GetNotifactions } from './data/notifactions' -createApp(App).use(store).use(router).mount('#app') +createApp(App).use(router).mount('#app') GetSelfAccount() GetNotifactions() diff --git a/src/router/index.ts b/src/router/index.ts index e5dc8c0..d6bbcde 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -17,6 +17,11 @@ const routes: Array = [ name: 'about', component: () => import('@/views/AboutView.vue'), }, + { + path: '/reset-password', + name: 'resetPassword', + component: () => import('@/views/ChangePasswordView.vue'), + }, { path: '/user/:id', name: 'user', @@ -27,6 +32,7 @@ const routes: Array = [ component: () => import('@/views/view/UserIndexView.vue'), meta: { title: '主页', + keepAlive: true, }, }, { @@ -35,6 +41,7 @@ const routes: Array = [ component: () => import('@/views/view/SongListView.vue'), meta: { title: '歌单', + keepAlive: true, }, }, { @@ -43,6 +50,7 @@ const routes: Array = [ component: () => import('@/views/view/QuestionBoxView.vue'), meta: { title: '提问箱', + keepAlive: true, }, }, { @@ -51,6 +59,7 @@ const routes: Array = [ component: () => import('@/views/view/ScheduleView.vue'), meta: { title: '日程', + keepAlive: true, }, }, ], @@ -74,6 +83,7 @@ const routes: Array = [ component: () => import('@/views/manage/SongListManageView.vue'), meta: { title: '歌单', + keepAlive: true, }, }, { @@ -82,6 +92,7 @@ const routes: Array = [ component: () => import('@/views/manage/QuestionBoxManageView.vue'), meta: { title: '提问箱', + keepAlive: true, }, }, { @@ -90,6 +101,7 @@ const routes: Array = [ component: () => import('@/views/manage/LotteryView.vue'), meta: { title: '动态抽奖', + keepAlive: true, }, }, { @@ -106,6 +118,7 @@ const routes: Array = [ component: () => import('@/views/manage/HistoryView.vue'), meta: { title: '数据跟踪', + keepAlive: true, }, }, { @@ -114,6 +127,7 @@ const routes: Array = [ component: () => import('@/views/manage/ScheduleManageView.vue'), meta: { title: '日程', + keepAlive: true, }, }, { @@ -122,6 +136,7 @@ const routes: Array = [ component: () => import('@/views/manage/EventView.vue'), meta: { title: '事件记录', + keepAlive: true, }, }, { @@ -130,6 +145,7 @@ const routes: Array = [ component: () => import('@/views/manage/VideoCollectManageView.vue'), meta: { title: '视频征集', + keepAlive: true, }, }, ], diff --git a/src/store/index.ts b/src/store/index.ts deleted file mode 100644 index 61a1d8c..0000000 --- a/src/store/index.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createStore } from 'vuex'; - -export default createStore({ - state: { - }, - getters: { - }, - mutations: { - }, - actions: { - }, - modules: { - }, -}); diff --git a/src/views/ChangePasswordView.vue b/src/views/ChangePasswordView.vue new file mode 100644 index 0000000..9391549 --- /dev/null +++ b/src/views/ChangePasswordView.vue @@ -0,0 +1,56 @@ + + + diff --git a/src/views/manage/BiliVerifyView.vue b/src/views/manage/BiliVerifyView.vue index d576cf7..5793891 100644 --- a/src/views/manage/BiliVerifyView.vue +++ b/src/views/manage/BiliVerifyView.vue @@ -3,6 +3,7 @@ import { GetSelfAccount, useAccount } from '@/api/account' import { QueryGetAPI } from '@/api/query' import { BILI_API_URL } from '@/data/constants' import { NAlert, NButton, NCard, NCode, NInput, NInputNumber, NSpace, NSpin, NText, NCountdown, NInputGroup, useMessage } from 'naive-ui' +import { isTaggedTemplateExpression } from 'typescript' import { onMounted, ref } from 'vue' const message = useMessage() @@ -10,6 +11,7 @@ const message = useMessage() const accountInfo = useAccount() const isStart = ref(false) const timeLeft = ref(0) +const timeOut = ref(false) const uId = ref() const roomId = ref() @@ -45,6 +47,11 @@ async function checkStatus() { GetSelfAccount() }, 1) return true + } else if (data.code == 400 && isStart.value) { + timeOut.value = true + clearInterval(timer.value) + message.error('认证超时') + return false } return false } @@ -74,8 +81,24 @@ onMounted(async () => {