Skip to content

Commit e0322b8

Browse files
Merge branch 'user-feedback' into 'develop'
User feedback & Image cache See merge request noluckjustskill/hackathon_training!67
2 parents 6aa76ba + f0afeea commit e0322b8

File tree

22 files changed

+736
-28
lines changed

22 files changed

+736
-28
lines changed

components/AllTestsForm.vue

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,6 @@
7575
</script>
7676

7777
<style lang="scss" scoped>
78-
.google-btn {
79-
padding-right: 8px;
80-
padding-bottom: 0px;
81-
82-
@media (max-width: 960px) {
83-
padding-right: 0;
84-
padding-bottom: 8px
85-
}
86-
}
8778
.dialog-card {
8879
max-width: 100%;
8980
}
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
<template>
2+
<v-card v-if="!routeHasFeedBack" class="elevation-0 dialog-card">
3+
<template v-if="!feedBackSent">
4+
<v-card-title class="headline">
5+
Оставьте свой отзыв
6+
<slot />
7+
</v-card-title>
8+
<v-card-text class="text-center body-1">
9+
Оцените пройденный тест, чтобы мы становились ещё лучше!
10+
<br>
11+
Возможно, у Вас есть вопросы или пожелания - напишите их тоже
12+
<v-rating
13+
v-model="rating"
14+
background-color="red lighten-3"
15+
color="primary"
16+
:large="!isMobile"
17+
class="mt-2"
18+
/>
19+
<v-textarea
20+
v-model="message"
21+
name="message"
22+
label="Отзыв"
23+
:height="120"
24+
no-resize
25+
class="ma-0"
26+
/>
27+
<div class="text-right">
28+
<v-btn
29+
:disabled="!rating"
30+
:block="isMobile"
31+
color="primary"
32+
rounded
33+
depressed
34+
@click="send"
35+
>
36+
Отправить
37+
</v-btn>
38+
</div>
39+
</v-card-text>
40+
</template>
41+
<template v-else>
42+
<v-card-text class="text-center headline fade-in mt-8 pa-0">
43+
Ваш отзыв отправлен, спасибо!
44+
</v-card-text>
45+
</template>
46+
</v-card>
47+
</template>
48+
49+
<script>
50+
export default {
51+
data: () => ({
52+
feedBackSent: false,
53+
routeHasFeedBack: false,
54+
message: '',
55+
rating: 0,
56+
}),
57+
computed: {
58+
isMobile() {
59+
return this.$vuetify.breakpoint.xsOnly;
60+
},
61+
},
62+
created() {
63+
this.$axios.$get(`routeFeedback?path=${encodeURIComponent(this.$route.path)}`).then(({ exists }) => {
64+
this.routeHasFeedBack = exists;
65+
});
66+
},
67+
methods: {
68+
send() {
69+
if (!this.rating) return;
70+
71+
this.$axios.$post('sendFeedback', {
72+
path: this.$route.path,
73+
rate: this.rating,
74+
message: this.message,
75+
}).then(() => {
76+
this.feedBackSent = true;
77+
78+
setTimeout(() => {
79+
this.routeHasFeedBack = true;
80+
}, 3000);
81+
}).catch(err => {
82+
console.error(err);
83+
});
84+
},
85+
},
86+
};
87+
</script>
88+
89+
<style lang="scss" scoped>
90+
.dialog-card {
91+
max-width: 100%;
92+
}
93+
.headline {
94+
position: relative;
95+
justify-content: center;
96+
word-break: break-word;
97+
98+
.btn {
99+
position: absolute;
100+
right: 10px;
101+
top: 10px;
102+
}
103+
}
104+
105+
.fade-in {
106+
animation: fadeIn .5s ease-in;
107+
}
108+
109+
@keyframes fadeIn {
110+
0% {opacity: 0;}
111+
100% {opacity: 1;}
112+
}
113+
</style>

nuxt.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ module.exports = {
4444
plugins: [
4545
'~/plugins/axios.js',
4646
'~/plugins/dynamicColor',
47+
{ src: '~/plugins/base64Image', mode: 'client' },
4748
'~/plugins/sentry',
4849
'~/plugins/constants',
4950
],

0 commit comments

Comments
 (0)