This commit is contained in:
2025-01-04 21:01:04 +03:30
parent aad48fca63
commit 57d328bbfe
33 changed files with 1752 additions and 261 deletions
+45 -14
View File
@@ -1,10 +1,45 @@
<script setup>
import FloatingConfigurator from '@/components/FloatingConfigurator.vue';
import { ref } from 'vue';
import { onBeforeMount, ref } from 'vue';
import axios from 'axios';
import { useRouter } from 'vue-router';
const router = useRouter()
const email = ref('');
const password = ref('');
const checked = ref(false);
const loginLoading = ref(false)
import Cookies from 'js-cookie';
const login = async () => {
try {
loginLoading.value = true
const response = await axios.post('/api/users/user/login-email', {
email: email.value,
password: password.value,
})
console.log(response)
Cookies.set('bm-token', response.data.data.token)
localStorage.setItem('bm-token', response.data.data.token)
await router.push('/')
} catch (error) {
console.log('err', error)
loginLoading.value = false
}
}
onBeforeMount(async () => {
const token = Cookies.get('bm-token')
try {
const response = await axios.get('/api/users/user/get-self', {
headers: {
Authorization: `Bearer ${token}`
}
})
console.log(response)
await router.push('/')
} catch (error) {
console.log(error)
}
})
</script>
<template>
@@ -31,25 +66,21 @@ const checked = ref(false);
/>
</g>
</svg>
<div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">Welcome to PrimeLand!</div>
<span class="text-muted-color font-medium">Sign in to continue</span>
<div class="text-surface-900 dark:text-surface-0 text-3xl font-medium mb-4">نرم افزار مدیریت اموال نیلگون</div>
<span class="text-muted-color font-medium">برای ادامه وارد شوید</span>
</div>
<div>
<label for="email1" class="block text-surface-900 dark:text-surface-0 text-xl font-medium mb-2">Email</label>
<InputText id="email1" type="text" placeholder="Email address" class="w-full md:w-[30rem] mb-8" v-model="email" />
<label for="email1" class="block text-surface-900 dark:text-surface-0 text-xl font-medium mb-2">ایمیل</label>
<InputText id="email1" type="text" placeholder="آدرس ایمیل" class="w-full md:w-[30rem] mb-8" v-model="email" />
<label for="password1" class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2">Password</label>
<Password id="password1" v-model="password" placeholder="Password" :toggleMask="true" class="mb-4" fluid :feedback="false"></Password>
<label for="password1" class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2">رمز عبور</label>
<Password id="password1" v-model="password" placeholder="رمز عبور" :toggleMask="true" class="mb-4" fluid :feedback="false"></Password>
<div class="flex items-center justify-between mt-2 mb-8 gap-8">
<div class="flex items-center">
<Checkbox v-model="checked" id="rememberme1" binary class="mr-2"></Checkbox>
<label for="rememberme1">Remember me</label>
</div>
<span class="font-medium no-underline ml-2 text-right cursor-pointer text-primary">Forgot password?</span>
<span class="font-medium no-underline ml-2 text-right cursor-pointer text-primary">فراموشی رمز عبور</span>
</div>
<Button label="Sign In" class="w-full" as="router-link" to="/"></Button>
<Button :loading="loginLoading" label="ورود" class="w-full" @click="login"></Button>
</div>
</div>
</div>