0
1
Fork 0

On AddressDetails: Merge branch 'feature/AddressDetails' of https://gitea.verdnatura.es/wbuezas/hedera-web-mindshore into feature/AddressDetails

This commit is contained in:
Javier Segarra 2024-07-23 23:07:40 +02:00
parent f59b37c722
commit 24a9c130d1
5 changed files with 53 additions and 47 deletions

View File

@ -4,7 +4,7 @@ import messages from 'src/i18n';
const i18n = createI18n({ const i18n = createI18n({
locale: navigator.language || navigator.userLanguage, locale: navigator.language || navigator.userLanguage,
fallbackLocale: 'en', fallbackLocale: 'en-US',
globalInjection: true, globalInjection: true,
missingWarn: false, missingWarn: false,
fallbackWarn: false, fallbackWarn: false,
@ -17,7 +17,6 @@ const i18n = createI18n({
export default boot(({ app }) => { export default boot(({ app }) => {
// Set i18n instance on app // Set i18n instance on app
app.use(i18n); app.use(i18n);
window.i18n = i18n.global;
}); });
export { i18n }; export { i18n };

View File

@ -72,6 +72,15 @@ export default {
items: 'Artículos', items: 'Artículos',
config: 'Configuración', config: 'Configuración',
user: 'Usuario', user: 'Usuario',
password: 'Contraseña',
remindMe: 'Recuérdame',
logInAsGuest: 'Entrar como invitado',
logIn: 'Iniciar sesión',
loginMail: 'info@verdnatura.es',
loginPhone: '+34 963 242 100',
haveForgottenPassword: '¿Has olvidado tu contraseña?',
notACustomerYet: '¿Todavía no eres cliente?',
signUp: 'Registrarme',
addresses: 'Direcciones', addresses: 'Direcciones',
addressEdit: 'Editar dirección', addressEdit: 'Editar dirección',
dataSaved: 'Datos guardados', dataSaved: 'Datos guardados',

View File

@ -16,10 +16,8 @@ const addresses = ref([]);
const defaultAddress = ref(null); const defaultAddress = ref(null);
const clientId = ref(null); const clientId = ref(null);
const goToAddressDetails = (id = 0) => { const goToAddressDetails = (id = 0) =>
console.log('asd');
router.push({ name: 'AddressDetails', params: { id } }); router.push({ name: 'AddressDetails', params: { id } });
};
const getDefaultAddress = async () => { const getDefaultAddress = async () => {
try { try {

View File

@ -1,3 +1,38 @@
<script setup>
import { useI18n } from 'vue-i18n';
import { userStore } from 'stores/user';
import { onMounted, ref } from 'vue';
import useNotify from 'src/composables/useNotify.js';
import { useRouter, useRoute } from 'vue-router';
const { notify } = useNotify();
const t = useI18n();
const user = userStore();
const route = useRoute();
const router = useRouter();
const email = ref(null);
const password = ref(null);
const remember = ref(false);
const showPwd = ref(false);
onMounted(() => {
if (route.query.emailConfirmed !== undefined) {
notify({
message: t('emailConfirmedSuccessfully'),
type: 'positive'
});
}
if (route.params.email) {
email.value = route.params.email;
password.value.focus();
}
});
async function onLogin() {
await user.login(email.value, password.value, remember.value);
router.push('/');
}
</script>
<template> <template>
<div class="main"> <div class="main">
<div class="header"> <div class="header">
@ -10,9 +45,8 @@
<QInput v-model="email" :label="$t('user')" autofocus /> <QInput v-model="email" :label="$t('user')" autofocus />
<QInput <QInput
v-model="password" v-model="password"
ref="password"
:label="$t('password')" :label="$t('password')"
:type="showPwd ? 'password' : 'text'" :type="!showPwd ? 'password' : 'text'"
> >
<template v-slot:append> <template v-slot:append>
<QIcon <QIcon
@ -69,7 +103,11 @@
</a> </a>
</p> </p>
<p class="contact"> <p class="contact">
{{ $t('loginPhone') }} · {{ $t('loginMail') }} <a :href="`tel:${$t('loginPhone')}`">
{{ $t('loginPhone') }}
</a>
·
<a :href="`mailto:${$t('loginMail')}`">{{ $t('loginMail') }}</a>
</p> </p>
</div> </div>
</div> </div>
@ -121,44 +159,6 @@ a {
} }
</style> </style>
<script>
import { userStore } from 'stores/user';
export default {
name: 'VnLogin',
data() {
return {
user: userStore(),
email: '',
password: '',
remember: false,
showPwd: true
};
},
mounted() {
if (this.$route.query.emailConfirmed !== undefined) {
this.$q.notify({
message: this.$t('emailConfirmedSuccessfully'),
type: 'positive'
});
}
if (this.$route.params.email) {
this.email = this.$route.params.email;
this.$refs.password.focus();
}
},
methods: {
async onLogin() {
await this.user.login(this.email, this.password, this.remember);
this.$router.push('/');
}
}
};
</script>
<i18n lang="yaml"> <i18n lang="yaml">
en-US: en-US:
user: User user: User

View File

@ -6,7 +6,7 @@ const routes = [
{ {
name: 'login', name: 'login',
path: '/login/:email?', path: '/login/:email?',
component: () => import('pages/Login/Login.vue') component: () => import('pages/Login/LoginView.vue')
}, },
{ {
name: 'rememberPassword', name: 'rememberPassword',