Init project

This commit is contained in:
alirezakarari
2021-01-09 20:53:13 +03:30
commit 8d06c89a89
1005 changed files with 105625 additions and 0 deletions
+168
View File
@@ -0,0 +1,168 @@
<!-- =========================================================================================
File Name: Login.vue
Description: Login Page
----------------------------------------------------------------------------------------
Item Name: Vuexy - Vuejs, HTML & Laravel Admin Dashboard Template
Author: Pixinvent
Author URL: http://www.themeforest.net/user/pixinvent
========================================================================================== -->
<template>
<div class="h-screen flex w-full bg-img vx-row no-gutter items-center justify-center" id="page-login">
<div class="vx-col sm:w-1/2 md:w-1/2 lg:w-2/4 xl:w-1/4 sm:m-0 m-4">
<vx-card>
<div slot="no-body" class="full-page-bg-color">
<div class="vx-row no-gutter justify-center items-center">
<div class="vx-col sm:w-full md:w-full lg:w-full d-theme-dark-bg">
<div class="px-4 pt-1 login-tabs-container flex items-stretch flex-col justify-center ">
<img src="@/assets/images/logo.svg" width="120px" height="120px" class="mx-auto">
<div class="vx-card__title mb-4">
<h4 class="mb-4">
ورود
</h4>
<p>
به آسکو خوش آمدید.
</p>
</div>
<div>
<vs-input
v-validate="'required|min:3'"
data-vv-validate-on="blur"
name="mobile"
icon-no-border
icon="icon icon-user"
icon-pack="feather"
label-placeholder="شماره تلفن همراه یا ایمیل"
v-model="email"
@keydown.enter="loginJWT"
class="w-full"/>
<span class="text-danger text-sm">شماره موبایل الزامی است.</span>
<vs-input
data-vv-validate-on="blur"
v-validate="'required'"
type="password"
name="password"
icon-no-border
icon="icon icon-lock"
icon-pack="feather"
label-placeholder="رمزعبور"
v-model="password"
@keydown.enter="loginJWT"
class="w-full mt-8" />
<span class="text-danger text-sm">رمزعبور الزامی است.</span>
<div class="flex flex-wrap justify-between my-5">
<router-link to="/auth/forgot-password">
رمز عبور خود را فراموش کردم
</router-link>
</div>
<div class="flex flex-wrap justify-between mb-3 ">
<vs-button class="mx-auto" :disabled="!validateForm" @click="loginJWT" >
ورود
</vs-button>
</div>
<div>
<router-link to="/auth/register">
آیا شما ثبت نام نکرده اید ؟
</router-link>
</div>
</div>
</div>
</div>
</div>
</div>
</vx-card>
</div>
</div>
</template>
<script>
export default {
data() {
return {
email: '',
password: '',
checkbox_remember_me: false
}
},
computed: {
validateForm() {
return !this.errors.any() && this.email != '' && this.password != '';
},
},
methods: {
checkLogin() {
// If user is already logged in notify
if (this.$store.state.auth.isUserLoggedIn()) {
// Close animation if passed as payload
// this.$vs.loading.close()
this.$vs.notify({
title: '',
text: 'You are already logged in!',
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'warning'
});
return false
}
return true
},
loginJWT() {
if (!this.checkLogin()) return
if (!this.validateForm) return
// Loading
this.$vs.loading()
const payload = {
userDetails: {
email: this.email,
password: this.password
}
};
this.$store.dispatch('auth/loginJWT', payload)
.then(() => { this.$vs.loading.close() })
.catch(({code , response}) => {
let msg = 'نام کاربری یا رمز عبور اشتباه است';//this.$t('Error Login ');
if(response && response.status == 422){
msg = response.data.message;
}
this.$vs.loading.close()
this.$message.error(msg);
/*this.$vs.notify({
title: 'خطا در ورود',
text: msg,
iconPack: 'feather',
icon: 'icon-alert-circle',
color: 'danger',
})*/
})
},
registerUser() {
if (!this.checkLogin()) return
this.$router.push('/auth/register').catch(() => {})
}
}
}
</script>
<style lang="scss">
.login-tabs-container {
min-height: 505px;
.con-tab {
padding-bottom: 14px;
}
.con-slot-tabs {
margin-top: 1rem;
}
}
</style>