This commit is contained in:
iriska-gri committed 2023-09-05 16:07:55 +03:00
commit 8c95bbf909
126 files changed
+16922

No files matched your search

+144
View File
@@ -0,0 +1,144 @@
<template>
<v-dialog
v-model="menuAuthDialog"
persistent
width="400"
>
<template v-slot:activator="{ props }">
<v-btn
v-bind="props"
append-icon="mdi-login"
>
<template v-slot:prepend>
<v-icon color="white"></v-icon>
</template>
Войти
<template v-slot:append>
<v-icon color="white"/>
</template>
</v-btn>
</template>
<v-card>
<v-card-title>
<span class="text-h5">Вход в портал</span>
</v-card-title>
<v-card-text>
<v-container>
<v-row>
<v-col cols="12" class="py-0">
<v-text-field
v-model="anon.username"
label="Логин"
variant="underlined"
:error-messages="errorer('username')"
/>
</v-col>
<v-col cols="12" class="py-0">
<v-text-field
v-model="anon.password"
label="Пароль"
variant="underlined"
type="password"
:error-messages="errorer('password')"
/>
</v-col>
</v-row>
</v-container>
</v-card-text>
<v-card-actions>
<v-spacer/>
<v-btn
color="blue-darken-1"
variant="text"
@click="menuAuthDialog = false"
>
Отмена
</v-btn>
<v-btn
color="blue-darken-1"
variant="text"
@click="logging"
>
Войти
</v-btn>
</v-card-actions>
<v-progress-linear v-show="AppStore.loading" indeterminate></v-progress-linear>
</v-card>
</v-dialog>
</template>
<script>
import {useAccountStore} from '@/store/AccountStore'
import {useAppStore} from '@/store/app'
import { useVuelidate } from '@vuelidate/core'
import { required, helpers } from '@vuelidate/validators'
import { ref, reactive, computed, onMounted } from 'vue'
const req= helpers.withMessage('Обязательное поле', required)
export default {
setup(){
const accountStore = useAccountStore()
const AppStore= useAppStore()
const menuAuthDialog = ref(false)
const anon=reactive({
username:"9966-00-125",
password:""
})
const rules = computed(()=> {
return {
username: { req, latin: helpers.withMessage(()=> 'Логин имееет вид "0000-00-000"', (value) => /(\d{4,4}[-]\d{2,2}[-]\d{3,3})+$/.test(value.toString()))}, // Matches state.firstName
password: { req } // Matches state.lastName
}
}
)
const v$ = useVuelidate(rules, anon)
const errorer = (field) => {
let errors = v$.value[field].$error?v$.value[field].$errors[0].$message:''
return errors
}
const logging=async()=>{
if (!v$.value.$error) {
await accountStore.logging(anon)
}
else {
console.log(true);
}
}
onMounted(() => {
v$.value.$validate()
})
return {
accountStore,
AppStore,
menuAuthDialog,
anon,
v$,
logging,
errorer,
}
}
}
</script>
<style>
</style>
+3
View File
@@ -0,0 +1,3 @@
import myHelper from '@/components/UI/my-helper';
export default [myHelper]
+62
View File
@@ -0,0 +1,62 @@
<template>
<div class="pa-0 align-self-center">
<v-menu
v-model="menu"
:close-on-content-click="false"
:nudge-width="500"
offset-x
>
<template v-slot:activator="{ on, attrs }">
<v-icon
v-bind="attrs"
v-on="on"
size="large"
color="indigo"
icon="mdi-owl"
@click="menu=!menu"
></v-icon>
</template>
<v-card
class="h-50 overflow-auto overflow-x-hidden">
<v-row class="ma-3">
<v-col >
<pre>
{{pretext}}
</pre>
</v-col>
</v-row>
</v-card>
</v-menu>
</div>
</template>
<script>
export default {
name: "myHelper",
props: {
pretext: {
type:Object,
default:()=>{}
}
},
data: () => ({
fav: true,
menu: false,
message: false,
hints: true,
}),
}
</script>
<style>
.whmy {
height: 80vh;
}
</style>