This commit is contained in:
2026-07-19 14:45:03 +07:00
parent 75efb4cbf0
commit 3f8b8ba432
12 changed files with 105 additions and 90 deletions
+53 -53
View File
@@ -1,3 +1,56 @@
<script setup lang="ts">
import { computed, ref } from 'vue'
import { NCard, NTabs, NTabPane, NCheckbox, NButton, NSpace, NInput, NAutoComplete, useMessage } from 'naive-ui'
import { useAuthStore } from '@/stores/auth';
import { useRouter } from 'vue-router';
const authStore = useAuthStore();
const router = useRouter()
const message = useMessage()
const username = ref('')
const email = ref('')
const password = ref('')
const approval = ref(false)
const options = computed(() => {
return ['@mail.ru', '@yandex.ru', '@gmail.com'].map((suffix) => {
const prefix = email.value.split('@')[0]
return {
label: prefix + suffix,
value: prefix + suffix
}
})
})
async function signin() {
const res = await authStore.login(email.value, password.value)
if (!res && authStore.error != null) {
message.error(authStore.error)
return
}
router.push('/office')
}
async function signup() {
if (!approval.value) {
return
}
const res = await authStore.signup(username.value, email.value)
if (!res && authStore.error != null) {
message.error(authStore.error)
return
}
message.info("Пароль отправлен на почту")
}
</script>
<template>
<n-card style="margin-bottom: 16px" class="sign-card">
<n-tabs type="line" animated>
@@ -60,59 +113,6 @@
</n-card>
</template>
<script setup lang="ts">
import { computed, ref } from 'vue'
import { NCard, NTabs, NTabPane, NCheckbox, NButton, NSpace, NInput, NAutoComplete, useMessage } from 'naive-ui'
import { useAuthStore } from '@/stores/auth';
import { useRouter } from 'vue-router';
const authStore = useAuthStore();
const router = useRouter()
const message = useMessage()
const username = ref('')
const email = ref('')
const password = ref('')
const approval = ref(false)
const options = computed(() => {
return ['@mail.ru', '@yandex.ru', '@gmail.com'].map((suffix) => {
const prefix = email.value.split('@')[0]
return {
label: prefix + suffix,
value: prefix + suffix
}
})
})
async function signin() {
const res = await authStore.login(email.value, password.value)
if (!res && authStore.error != null) {
message.error(authStore.error)
return
}
router.push('/office')
}
async function signup() {
if (!approval.value) {
return
}
const res = await authStore.signup(username.value, email.value)
if (!res && authStore.error != null) {
message.error(authStore.error)
return
}
message.info("Пароль отправлен на почту")
}
</script>
<style scoped>
.sign-card {
background-color: rgb(29, 29, 29);