P-112 Адаптировать картинки
This commit is contained in:
1 parent
fa06b82232
commit
0a2cf14bc4
4 files changed
+110
-109
No files matched your search
@@ -1,127 +1,110 @@
|
||||
<template>
|
||||
<template v-if="!isVoteSubmitted">
|
||||
<v-card style="height: 85vh;">
|
||||
<div class="d-flex flex-column flex-fill px-2 " >
|
||||
<div class="d-flex flex-column flex-fill px-2 ">
|
||||
<v-col cols="auto">
|
||||
<v-row class="d-flex flex-column">
|
||||
<v-col cols="12" class="d-flex flex-row pa-0">
|
||||
<v-col class="d-flex flex-row pa-0" cols="12">
|
||||
<v-col>
|
||||
<v-card-title>{{ data.name }}</v-card-title>
|
||||
<v-card-subtitle>{{ data.description }}</v-card-subtitle>
|
||||
</v-col>
|
||||
<v-col cols="auto">
|
||||
<v-btn color="red-darken-1" density="compact" size="small" icon="mdi-close-thick" @click="$emit('closer')">
|
||||
|
||||
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small"
|
||||
@click="$emit('closer')">
|
||||
</v-btn>
|
||||
</v-col>
|
||||
</v-col>
|
||||
|
||||
|
||||
</v-row>
|
||||
</v-col>
|
||||
<div class="d-flex flex-column flex-fill ">
|
||||
<v-stepper class="d-flex flex-column flex-fill" v-model="activeStep">
|
||||
<v-stepper v-model="activeStep" class="d-flex flex-column flex-fill">
|
||||
<!-- Шаги голосования -->
|
||||
<v-stepper-header class="py-0">
|
||||
<template v-for="question in data.questions" :key="question.numb">
|
||||
<v-stepper-item
|
||||
:color="question.numb < activeStep+1?'success':'warning'"
|
||||
edit-icon="mdi-help"
|
||||
:complete="question.numb < activeStep+1" :step="question.numb">
|
||||
Вопрос {{ question.numb }}
|
||||
</v-stepper-item>
|
||||
</template>
|
||||
<v-stepper-item
|
||||
:color="question.numb < activeStep+1?'success':'warning'"
|
||||
:complete="question.numb < activeStep+1"
|
||||
:step="question.numb" edit-icon="mdi-help">
|
||||
Вопрос {{ question.numb }}
|
||||
</v-stepper-item>
|
||||
</template>
|
||||
</v-stepper-header>
|
||||
|
||||
<v-stepper-window class="d-flex flex-column flex-fill " >
|
||||
<v-stepper-window class="d-flex flex-column flex-fill">
|
||||
<v-stepper-window-item v-for="(question, index) in data.questions" :key="question.numb"
|
||||
class=""
|
||||
:step="question.numb">
|
||||
|
||||
<!-- <v-card class="d-flex flex-fill" > -->
|
||||
:step="question.numb"
|
||||
class="">
|
||||
<div class="">
|
||||
<div class="" >{{ question.question }}</div>
|
||||
|
||||
<h3 class="text-center">{{ question.question }}</h3>
|
||||
<v-row>
|
||||
<div class="v-col align-self-center ">
|
||||
<v-img class=""
|
||||
style="max-height:400px"
|
||||
@click.stop="opendialog({answer:question.question, file:question.file})"
|
||||
:src="question.file"/>
|
||||
<div class="v-col align-self-start">
|
||||
<v-img :src="question.file"
|
||||
class="cursor-pointer"
|
||||
style="max-height:45vh"
|
||||
@click.stop="opendialog({answer:question.question, file:question.file})"/>
|
||||
</div>
|
||||
<div class="v-col-6" style="max-height:50vh">
|
||||
<v-list v-model:selected="result[question.id]" density="compact" select-strategy="leaf" slim style="max-height: 100%; overflow-y: auto;">
|
||||
<v-list-item v-for="answer in question.answers" :key="answer.id" :value="answer.id"
|
||||
density="compact">
|
||||
{{ answer.answer }}
|
||||
<template v-slot:prepend="{ isSelected }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
<v-avatar :image="answer.file" @click.stop="opendialog(answer)"></v-avatar>
|
||||
</template>
|
||||
</v-list-item>
|
||||
</v-list>
|
||||
</div>
|
||||
</v-row>
|
||||
</div>
|
||||
<div class="v-col-6">
|
||||
|
||||
<v-list v-model:selected="result[question.id]" slim density="compact" select-strategy="leaf">
|
||||
|
||||
<v-list-item density="compact" v-for="answer in question.answers" :key="answer.id"
|
||||
:value="answer.id">
|
||||
{{ answer.answer }}
|
||||
<template v-slot:prepend="{ isSelected }">
|
||||
<v-list-item-action start>
|
||||
<v-checkbox-btn :model-value="isSelected"></v-checkbox-btn>
|
||||
</v-list-item-action>
|
||||
</template>
|
||||
<template v-slot:append>
|
||||
|
||||
<v-avatar @click.stop="opendialog(answer)" :image="answer.file"></v-avatar>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
|
||||
|
||||
</v-list-item>
|
||||
|
||||
</v-list>
|
||||
</div>
|
||||
</v-row>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Действия -->
|
||||
<v-card-actions class="">
|
||||
|
||||
</v-card-actions>
|
||||
<!-- </v-card> -->
|
||||
<!-- </v-card> -->
|
||||
</v-stepper-window-item>
|
||||
|
||||
</v-stepper-window>
|
||||
<v-stepper-actions >
|
||||
<template v-slot:prev>
|
||||
<v-stepper-actions>
|
||||
<template v-slot:prev>
|
||||
|
||||
<v-btn @click="prevStep" outlined>Назад</v-btn></template>
|
||||
<template v-slot:next>
|
||||
<v-btn outlined @click="prevStep">Назад</v-btn>
|
||||
</template>
|
||||
<template v-slot:next>
|
||||
|
||||
<v-btn v-if="activeStep < data.questions.length - 1" :disabled="!isCurrentQuestionAnswered" @click="nextStep"
|
||||
color="teal-darken-4">
|
||||
Далее
|
||||
</v-btn>
|
||||
<v-btn v-else :disabled="!isCurrentQuestionAnswered" color="teal-darken-4" @click="submitVote">
|
||||
Отправить
|
||||
</v-btn>
|
||||
</template></v-stepper-actions>
|
||||
<v-btn v-if="activeStep < data.questions.length - 1" :disabled="!isCurrentQuestionAnswered"
|
||||
color="teal-darken-4"
|
||||
@click="nextStep">
|
||||
Далее
|
||||
</v-btn>
|
||||
<v-btn v-else :disabled="!isCurrentQuestionAnswered" color="teal-darken-4" @click="submitVote">
|
||||
Отправить
|
||||
</v-btn>
|
||||
</template>
|
||||
</v-stepper-actions>
|
||||
</v-stepper>
|
||||
</div>
|
||||
</div>
|
||||
</v-card>
|
||||
<v-dialog v-model="dialog">
|
||||
<v-dialog v-model="dialog" max-width="100vh">
|
||||
<v-card max-height="800">
|
||||
<v-card-title class="v-row">
|
||||
<div clas="v-col-auto">
|
||||
|
||||
{{ activepick.answer }} </div>
|
||||
<v-spacer></v-spacer>
|
||||
<div clas="bg-yellow">
|
||||
<v-btn color="red-darken-1" density="compact" size="small" icon="mdi-close-thick" @click="dialog=false">
|
||||
|
||||
</v-btn>
|
||||
</div>
|
||||
<div class="v-col-auto">
|
||||
{{ activepick.answer }}
|
||||
</div>
|
||||
<v-spacer></v-spacer>
|
||||
<div>
|
||||
<v-btn color="red-darken-1" density="compact" icon="mdi-close-thick" size="small" @click="dialog=false"/>
|
||||
</div>
|
||||
|
||||
</v-card-title>
|
||||
<v-card-item>
|
||||
|
||||
<v-img :src="activepick.file" max-height="600" ></v-img>
|
||||
<v-img :src="activepick.file" max-height="600"></v-img>
|
||||
</v-card-item>
|
||||
</v-card>
|
||||
</v-dialog>
|
||||
@@ -129,22 +112,22 @@
|
||||
|
||||
<!-- Спасибо за голос -->
|
||||
<template v-else>
|
||||
<v-card width="400" class="mx-auto">
|
||||
<v-row align="center" justify="center" class="pa-3">
|
||||
<v-col class="text-center">
|
||||
<v-icon :color="messeger[messeger.key].color" :icon="messeger[messeger.key].icon" size="64" />
|
||||
<h2>{{ messeger[messeger.key].text }}</h2>
|
||||
<v-btn @click="$emit('closer')" class="ma-3 ">Закрыть</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
<v-card class="mx-auto" width="400">
|
||||
<v-row align="center" class="pa-3" justify="center">
|
||||
<v-col class="text-center">
|
||||
<v-icon :color="messeger[messeger.key].color" :icon="messeger[messeger.key].icon" size="64"/>
|
||||
<h2>{{ messeger[messeger.key].text }}</h2>
|
||||
<v-btn class="ma-3 " @click="$emit('closer')">Закрыть</v-btn>
|
||||
</v-col>
|
||||
</v-row>
|
||||
</v-card>
|
||||
</template>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { axiosApiInstance } from "@/utils/axios-api";
|
||||
import { computed, ref } from "vue";
|
||||
import { useAccountStore } from "@/store/AccountStore";
|
||||
import {axiosApiInstance} from "@/utils/axios-api";
|
||||
import {computed, ref} from "vue";
|
||||
import {useAccountStore} from "@/store/AccountStore";
|
||||
|
||||
export default {
|
||||
name: 'CurrentVote',
|
||||
@@ -156,11 +139,11 @@ export default {
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
setup(props, { emit }) {
|
||||
setup(props, {emit}) {
|
||||
const accountStore = useAccountStore();
|
||||
const messeger = ref({
|
||||
good: { icon: 'mdi-check-circle', text: 'Спасибо за Ваш голос!', color: "green" },
|
||||
bad: { icon: 'mdi-alert', text: 'Произошла ошибка!', color: "red" },
|
||||
good: {icon: 'mdi-check-circle', text: 'Спасибо за Ваш голос!', color: "green"},
|
||||
bad: {icon: 'mdi-alert', text: 'Произошла ошибка!', color: "red"},
|
||||
key: 'good'
|
||||
})
|
||||
const activeStep = ref(0);
|
||||
@@ -196,25 +179,24 @@ export default {
|
||||
console.log("Отправляем данные голосования:", result.value);
|
||||
let voteData = []
|
||||
for (let val of Object.values(result.value)) {
|
||||
val.forEach(e => voteData.push({ answer: e, comment: null, user: accountStore.user.id }))
|
||||
val.forEach(e => voteData.push({answer: e, comment: null, user: accountStore.user.id}))
|
||||
}
|
||||
|
||||
axiosApiInstance.post('api/vote/voteresultcreate/', voteData).then(res => {
|
||||
messeger.value.key = 'good'
|
||||
|
||||
}).catch(e => {
|
||||
console.log(e);
|
||||
messeger.value.key = 'bad'
|
||||
}
|
||||
|
||||
console.log(e);
|
||||
messeger.value.key = 'bad'
|
||||
}
|
||||
).finally(() => isVoteSubmitted.value = true)
|
||||
|
||||
};
|
||||
const activepick = ref(null)
|
||||
const dialog=ref(false)
|
||||
const opendialog=(val)=>{
|
||||
dialog.value=true
|
||||
activepick.value=val
|
||||
const dialog = ref(false)
|
||||
const opendialog = (val) => {
|
||||
dialog.value = true
|
||||
activepick.value = val
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,6 +1,16 @@
|
||||
<template>
|
||||
<v-card>
|
||||
<v-card-text class=" d-flex justify-space-between ga-3 text-h6"> {{ voteCard.name }}
|
||||
<v-card-text class="d-flex justify-space-between ga-3 text-h6">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
{{ voteCard.name }}
|
||||
</span>
|
||||
</template>
|
||||
<span>{{ voteCard.name }}</span>
|
||||
</v-tooltip>
|
||||
<v-btn v-if="user.id === voteCard.author || user.is_superuser" flat size="medium" @click="$emit('openEditVoteModal', voteCard)">
|
||||
<v-icon color="orange-lighten-1">mdi-pencil</v-icon>
|
||||
</v-btn>
|
||||
@@ -19,7 +29,18 @@
|
||||
</v-carousel>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-card-text class="">{{ voteCard.description }}</v-card-text>
|
||||
<v-card-text class="">
|
||||
<v-tooltip bottom>
|
||||
<template v-slot:activator="{ props }">
|
||||
<span
|
||||
v-bind="props"
|
||||
style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||
{{ voteCard.description }}
|
||||
</span>
|
||||
</template>
|
||||
<span>{{ voteCard.description }}</span>
|
||||
</v-tooltip>
|
||||
</v-card-text>
|
||||
<Timer :voteTime="{ dateend: voteCard.dateend, datestart: voteCard.datestart }"
|
||||
@changeBtn="(time) => timeChange = time"/>
|
||||
<v-card-actions class="justify-space-between mt-4 pb-2">
|
||||
@@ -96,7 +117,6 @@ export default {
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
console.log(props.voteCard.author, '^-^')
|
||||
const timeChange = ref(false)
|
||||
const youSure = ref(false)
|
||||
const isFinished = ref(false);
|
||||
|
||||
@@ -417,7 +417,7 @@ export default {
|
||||
form.value.endDate = dates
|
||||
}
|
||||
|
||||
// const selectedEmployees = ref([]);
|
||||
const selectedEmployees = ref([]);
|
||||
|
||||
const onEmployeesChange = (selected) => {
|
||||
form.value.questions[currentQuestionIndex.value].answers = selected.map((id) => ({ text: id, image: null }));
|
||||
|
||||
@@ -100,7 +100,6 @@ async function createVote(voteData) {
|
||||
const formData = new FormData();
|
||||
voteData.questions.forEach(question => {
|
||||
formData.append('questionsfiles', question.image)
|
||||
console.log(question.image);
|
||||
if(!!question.image){
|
||||
const {name,size,lastModified}=question.image
|
||||
question.image={name,size,lastModified}
|
||||
|
||||
Reference in new issue
Block a user