P-13 Раздел окончен
This commit is contained in:
1 parent
b845f547a8
commit
5bc39212c8
6 files changed
+204
-62
No files matched your search
@@ -0,0 +1,120 @@
|
||||
<template>
|
||||
<div>
|
||||
<v-card-text class="text-center">
|
||||
<span class="text-h4">Откликнуться на вакансию</span>
|
||||
</v-card-text>
|
||||
<v-card-text class="d-flex flex-column pt-0">
|
||||
<form @submit.prevent="submit">
|
||||
<v-row no-gutters class="justify-center">
|
||||
<v-col lg="8">
|
||||
<v-text-field
|
||||
v-model="name.value.value"
|
||||
:counter="10"
|
||||
:error-messages="name.errorMessage.value"
|
||||
label="Фамилия, имя, отчество"
|
||||
/>
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="email.value.value"
|
||||
:error-messages="email.errorMessage.value"
|
||||
label="E-mail или почта Lotus"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="phone.value.value"
|
||||
:counter="7"
|
||||
:error-messages="phone.errorMessage.value"
|
||||
label="Телефон"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-textarea
|
||||
v-model="message.value.value"
|
||||
no-resize
|
||||
rows="4"
|
||||
label="Сопроводительное письмо"
|
||||
/>
|
||||
<v-file-input label="Резюме" hide-details v-model="responseFiles" />
|
||||
|
||||
<v-btn block type="submit" class="mt-4 text-none" color="btn_text">
|
||||
Отправить
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</form>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { useField, useForm } from "vee-validate";
|
||||
import * as yup from "yup";
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
idVacations: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
|
||||
const responseFiles = ref('')
|
||||
|
||||
const { handleSubmit, handleReset } = useForm({
|
||||
validationSchema: yup.object({
|
||||
email: yup
|
||||
.string()
|
||||
.email("Введите корректный email")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
name: yup
|
||||
.string()
|
||||
.matches(/^[а-яА-ЯЁё]+$/, "Имя должно содержать только русские буквы")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
phone: yup
|
||||
.string()
|
||||
.matches(
|
||||
/^[[\d-]*\d[\d-]*$/,
|
||||
"Номер телефона должен содержать только цифры"
|
||||
)
|
||||
.required("Поле обязательно для заполнения"),
|
||||
message: yup.string(),
|
||||
}),
|
||||
});
|
||||
|
||||
const name = useField("name");
|
||||
const phone = useField("phone");
|
||||
const email = useField("email");
|
||||
const message = useField("message");
|
||||
|
||||
const submit = handleSubmit((values) => {
|
||||
const postFile = new FormData()
|
||||
|
||||
postFile.append("file", responseFiles.value);
|
||||
postFile.append("resp", JSON.stringify(values));
|
||||
postFile.append("id", JSON.stringify(props.idVacations));
|
||||
|
||||
clearAxios
|
||||
.post(`api/about_inspection/postresponsevacancy/`, postFile)
|
||||
.then((data) => {
|
||||
|
||||
});
|
||||
handleReset()
|
||||
alert(JSON.stringify(values, null, 2));
|
||||
});
|
||||
|
||||
return {
|
||||
name,
|
||||
phone,
|
||||
email,
|
||||
message,
|
||||
submit,
|
||||
responseFiles
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -4,105 +4,114 @@
|
||||
<span class="text-h4">Откликнуться на вакансию</span>
|
||||
</v-card-text>
|
||||
<v-card-text class="d-flex flex-column pt-0">
|
||||
<form @submit.prevent="submit">
|
||||
<v-form @submit.prevent="submit">
|
||||
<v-row no-gutters class="justify-center">
|
||||
<v-col lg="8">
|
||||
|
||||
<v-text-field
|
||||
v-model="name.value.value"
|
||||
v-model="form.fio"
|
||||
:counter="10"
|
||||
:error-messages="name.errorMessage.value"
|
||||
:rules="rules.fio"
|
||||
label="Фамилия, имя, отчество"
|
||||
/>
|
||||
<v-row no-gutters class="gap">
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="email.value.value"
|
||||
:error-messages="email.errorMessage.value"
|
||||
v-model="form.email"
|
||||
:rules="rules.email"
|
||||
label="E-mail или почта Lotus"
|
||||
/>
|
||||
</v-col>
|
||||
<v-col>
|
||||
<v-text-field
|
||||
v-model="phone.value.value"
|
||||
v-model="form.tel"
|
||||
:counter="7"
|
||||
:error-messages="phone.errorMessage.value"
|
||||
:rules="rules.tel"
|
||||
label="Телефон"
|
||||
/>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-textarea
|
||||
v-model="message.value.value"
|
||||
v-model="form.text"
|
||||
no-resize
|
||||
rows="4"
|
||||
label="Сопроводительное письмо"
|
||||
/>
|
||||
<v-file-input label="Резюме" hide-details />
|
||||
<v-file-input label="Резюме" hide-details v-model="file" />
|
||||
|
||||
<v-btn block type="submit" class="mt-4 text-none" color="btn_text">
|
||||
Отправить
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</form>
|
||||
</v-form>
|
||||
</v-card-text>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import { useField, useForm } from "vee-validate";
|
||||
import * as yup from "yup";
|
||||
import { useAlertStore } from '@/store/useAlertStore'
|
||||
import { clearAxios } from "@/utils/axios-api";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
idVacations: {
|
||||
type: Number,
|
||||
default: -1
|
||||
}
|
||||
idVacations: {
|
||||
type: Number,
|
||||
default: -1,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
|
||||
const { handleSubmit, handleReset } = useForm({
|
||||
validationSchema: yup.object({
|
||||
email: yup
|
||||
.string()
|
||||
.email("Введите корректный email")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
name: yup
|
||||
.string()
|
||||
.matches(/^[а-яА-ЯЁё]+$/, "Имя должно содержать только русские буквы")
|
||||
.required("Поле обязательно для заполнения"),
|
||||
phone: yup
|
||||
.string()
|
||||
.matches(
|
||||
/^[[\d-]*\d[\d-]*$/,
|
||||
"Номер телефона должен содержать только цифры"
|
||||
)
|
||||
.required("Поле обязательно для заполнения"),
|
||||
message: yup.string(),
|
||||
}),
|
||||
});
|
||||
const form = ref({ fio: "", email: "", tel: "", text: "" });
|
||||
const feedalert = useAlertStore().alert
|
||||
|
||||
const name = useField("name");
|
||||
const phone = useField("phone");
|
||||
const email = useField("email");
|
||||
const message = useField("message");
|
||||
const req = (val) => {
|
||||
return !!val || "Поле обязательно"
|
||||
}
|
||||
|
||||
|
||||
const rules = {
|
||||
fio: [
|
||||
(val) => req(val),
|
||||
(val) =>
|
||||
val.match(/^[а-яА-ЯЁё ]+$/) !== null || "хочу имя русскими буквами",
|
||||
],
|
||||
email: [(val) => req(val)],
|
||||
tel: [
|
||||
(val) => req(val),
|
||||
(val) => val.match(/^[[\d-]*\d[\d-]*$/) !== null || "хочу цифрами",
|
||||
],
|
||||
text: "",
|
||||
};
|
||||
|
||||
const file = ref(null);
|
||||
|
||||
const submit = () => {
|
||||
const postFile = new FormData();
|
||||
postFile.append(
|
||||
"data",
|
||||
JSON.stringify({ ...form.value, vacancy_id: props.idVacations })
|
||||
);
|
||||
if (file.value !==null) {
|
||||
postFile.append("file", file.value[0]);
|
||||
}
|
||||
|
||||
|
||||
const submit = handleSubmit((values) => {
|
||||
clearAxios
|
||||
.post(`api/about_inspection/postresponsevacancy/`, { resp: values, id: props.idVacations })
|
||||
.post(`api/about_inspection/postresponsevacancy/`, postFile)
|
||||
.then((data) => {
|
||||
|
||||
feedalert.alert = true;
|
||||
feedalert.text = data.data;
|
||||
feedalert.color = "teal-lighten-4";
|
||||
feedalert.ico = "mdi-email-outline";
|
||||
console.log(data.data, 'ggggggggggggggggggggg')
|
||||
});
|
||||
handleReset()
|
||||
alert(JSON.stringify(values, null, 2));
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
name,
|
||||
phone,
|
||||
email,
|
||||
message,
|
||||
form,
|
||||
file,
|
||||
rules,
|
||||
submit,
|
||||
};
|
||||
},
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
:icon=feedalert.ico
|
||||
theme="dark"
|
||||
min-height="40"
|
||||
min-width = "500"
|
||||
|
||||
position="fixed"
|
||||
location = "bottom"
|
||||
class="mb-2"
|
||||
|
||||
Reference in new issue
Block a user