@burh/nuxt-core 1.0.23 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/burh-ds/Cards/PlanCard.vue +3 -3
- package/components/burh-ds/Headings/StepHeader.vue +19 -19
- package/components/burh-ds/Loadings/LoadingFullPage.vue +1 -0
- package/components/burh-ds/Modals/SendTest.vue +53 -60
- package/components/burh-ds/Pagination/NamedPagination.vue +21 -29
- package/components/burh-ds/Questions/Question.vue +22 -26
- package/components/burh-ds/Questions/QuestionRadio.vue +68 -70
- package/components/burh-ds/Questions/QuestionRadioItem.vue +22 -23
- package/package.json +1 -1
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<i class="fas fa-check"></i>
|
|
18
18
|
</span>
|
|
19
19
|
<div class="ml-4 small text-left">
|
|
20
|
-
<span> {{ item
|
|
20
|
+
<span> {{ item }} </span>
|
|
21
21
|
</div>
|
|
22
22
|
</div>
|
|
23
23
|
</li>
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<i class="fas fa-check"></i>
|
|
42
42
|
</span>
|
|
43
43
|
<div class="ml-4 small">
|
|
44
|
-
<span> {{ item
|
|
44
|
+
<span> {{ item }} </span>
|
|
45
45
|
</div>
|
|
46
46
|
</div>
|
|
47
47
|
</li>
|
|
@@ -93,7 +93,7 @@ export default {
|
|
|
93
93
|
isCurrentPlan: {
|
|
94
94
|
type: Boolean | Number,
|
|
95
95
|
default: false
|
|
96
|
-
}
|
|
96
|
+
},
|
|
97
97
|
},
|
|
98
98
|
filters: {
|
|
99
99
|
convertToReal(value) {
|
|
@@ -1,25 +1,31 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="card pt-3 px-4" :class="{'pb-5': !hideIcons}">
|
|
3
|
-
<
|
|
4
|
-
name="
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
<validation-provider tag="div" :vid="`step-name-${position}`"
|
|
4
|
+
name="Nome da Etapa" rules="required" v-slot="{ errors }">
|
|
5
|
+
<base-input
|
|
6
|
+
:label="`Etapa #${position + 1}`"
|
|
7
|
+
placeholder="Escreva o nome da etapa"
|
|
8
|
+
type="text"
|
|
9
|
+
v-on:input="emitStage()"
|
|
10
|
+
v-model="name"
|
|
11
|
+
:error="errors[0]"
|
|
12
|
+
:valid="errors.length ? true : false"
|
|
13
|
+
/>
|
|
14
|
+
</validation-provider>
|
|
14
15
|
|
|
15
|
-
<div class="pb-3"
|
|
16
|
+
<validation-provider tag="div" class="pb-3" :vid="`step-description-${position}`"
|
|
17
|
+
name="Descrição da Etapa" rules="required" v-slot="{ errors }">
|
|
16
18
|
<textarea
|
|
17
19
|
v-on:input="emitStage()"
|
|
18
20
|
v-model="description"
|
|
19
21
|
class="form-control form-control-alternative"
|
|
22
|
+
:class="{'is-invalid': errors.length}"
|
|
20
23
|
rows="3"
|
|
21
24
|
placeholder="Descrição desta etapa..."/>
|
|
22
|
-
|
|
25
|
+
<div v-if="errors.length" class="invalid-feedback" style="display: block;">
|
|
26
|
+
{{ errors[0] }}
|
|
27
|
+
</div>
|
|
28
|
+
</validation-provider>
|
|
23
29
|
|
|
24
30
|
<ul class="step-icons" v-if="!hideIcons">
|
|
25
31
|
<li v-for="(icon, index) in icons"
|
|
@@ -64,12 +70,6 @@ export default {
|
|
|
64
70
|
}
|
|
65
71
|
},
|
|
66
72
|
methods: {
|
|
67
|
-
getError(name){
|
|
68
|
-
return this.errors.first(name);
|
|
69
|
-
},
|
|
70
|
-
isValid(name) {
|
|
71
|
-
return this.validated && !this.errors.has(name);
|
|
72
|
-
},
|
|
73
73
|
emitStage() {
|
|
74
74
|
this.$emit('change-stage',
|
|
75
75
|
{
|
|
@@ -3,34 +3,19 @@
|
|
|
3
3
|
<template slot="header">
|
|
4
4
|
<h2 class="display-4 px-4">Insira os e-mail que deseja enviar o teste</h2>
|
|
5
5
|
</template>
|
|
6
|
-
<div class="row px-4">
|
|
7
|
-
<div class="col-
|
|
8
|
-
<label for="name">Nome(opcional)</label>
|
|
9
|
-
</div>
|
|
10
|
-
<div class="col-3">
|
|
11
|
-
<label for="email">E-mail</label>
|
|
12
|
-
</div>
|
|
13
|
-
<div class="col-3">
|
|
6
|
+
<div class="row px-4 justify-content-start">
|
|
7
|
+
<div class="col-4">
|
|
14
8
|
<label for="teste">Selecione a vaga</label>
|
|
15
9
|
</div>
|
|
16
|
-
<div class="col-
|
|
10
|
+
<div class="col-4">
|
|
17
11
|
<label for="teste">Selecione o teste</label>
|
|
18
12
|
</div>
|
|
19
13
|
</div>
|
|
20
|
-
<div class="row px-4"
|
|
21
|
-
|
|
22
|
-
:key="idx"
|
|
23
|
-
>
|
|
24
|
-
<div class="col-3">
|
|
25
|
-
<base-input v-model="slot.name"/>
|
|
26
|
-
</div>
|
|
27
|
-
<div class="col-3">
|
|
28
|
-
<base-input v-model="slot.email"/>
|
|
29
|
-
</div>
|
|
30
|
-
<div class="col-3">
|
|
14
|
+
<div class="row px-4 justify-content-start">
|
|
15
|
+
<div class="col-4">
|
|
31
16
|
<el-select
|
|
32
17
|
placeholder="Escolha a vaga"
|
|
33
|
-
v-model="
|
|
18
|
+
v-model="jobid">
|
|
34
19
|
<el-option v-for="job in allJobs"
|
|
35
20
|
class="select-danger"
|
|
36
21
|
:value="job.id"
|
|
@@ -38,11 +23,12 @@
|
|
|
38
23
|
:key="job.id">
|
|
39
24
|
</el-option>
|
|
40
25
|
</el-select>
|
|
26
|
+
<span></span>
|
|
41
27
|
</div>
|
|
42
|
-
<div class="col-
|
|
28
|
+
<div class="col-4">
|
|
43
29
|
<el-select
|
|
44
30
|
placeholder="Escolha o teste"
|
|
45
|
-
v-model="
|
|
31
|
+
v-model="testid">
|
|
46
32
|
<el-option v-for="test in allTests"
|
|
47
33
|
class="select-danger"
|
|
48
34
|
:value="test.id"
|
|
@@ -51,11 +37,40 @@
|
|
|
51
37
|
</el-option>
|
|
52
38
|
</el-select>
|
|
53
39
|
</div>
|
|
54
|
-
<div class="col-1">
|
|
55
|
-
<i v-if="idx !== (slots.length - 1)" class="fa fa-trash pointer" @click="removeSlot(slot.id)"></i>
|
|
56
|
-
<i v-else class="fa fa-plus pointer" @click="addSlot"></i>
|
|
57
|
-
</div>
|
|
58
40
|
</div>
|
|
41
|
+
<hr>
|
|
42
|
+
<div class="row px-4">
|
|
43
|
+
<div class="col-4">
|
|
44
|
+
<label for="name">Nome(opcional)</label>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="col-8">
|
|
47
|
+
<label for="email">E-mail</label>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
<validation-observer ref="sendTest">
|
|
51
|
+
<div class="row px-4"
|
|
52
|
+
v-for="(slot, idx) in slots"
|
|
53
|
+
:key="idx"
|
|
54
|
+
>
|
|
55
|
+
<validation-provider tag="div" class="col-4" :vid="`send-name-${idx}`"
|
|
56
|
+
name="Nome" rules="required" v-slot="{ errors }">
|
|
57
|
+
<base-input v-model="slot.name"
|
|
58
|
+
:error="errors[0]"
|
|
59
|
+
:valid="errors.length ? true : false"/>
|
|
60
|
+
</validation-provider>
|
|
61
|
+
|
|
62
|
+
<validation-provider tag="div" class="col-7" :vid="`send-email-${idx}`"
|
|
63
|
+
name="Email" rules="required|email" v-slot="{ errors }">
|
|
64
|
+
<base-input v-model="slot.email"
|
|
65
|
+
:error="errors[0]"
|
|
66
|
+
:valid="errors.length ? true : false"/>
|
|
67
|
+
</validation-provider>
|
|
68
|
+
<div class="col-1">
|
|
69
|
+
<i v-if="idx !== (slots.length - 1)" class="fa fa-trash pointer" @click="removeSlot(slot.id)"></i>
|
|
70
|
+
<i v-else class="fa fa-plus pointer" @click="addSlot"></i>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
</validation-observer>
|
|
59
74
|
<div class="row">
|
|
60
75
|
<base-button class="mx-auto" type="primary" @click="sendTest">Enviar teste</base-button>
|
|
61
76
|
</div>
|
|
@@ -97,54 +112,32 @@ export default {
|
|
|
97
112
|
|
|
98
113
|
this.slots = [...this.slots, newSlot];
|
|
99
114
|
},
|
|
100
|
-
sendTest() {
|
|
101
|
-
const
|
|
115
|
+
async sendTest() {
|
|
116
|
+
const pass = await this.$refs.sendTest.validate();
|
|
117
|
+
if(!pass) {
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
const filterSlots = slot => slot.email !== "";
|
|
121
|
+
const formatRequest = slot => ({...slot, jobid: this.jobid, testid: this.testid});
|
|
122
|
+
const testRequest = this.slots.filter(filterSlots).map(formatRequest);
|
|
102
123
|
this.$emit('send-test', testRequest);
|
|
103
124
|
}
|
|
104
125
|
},
|
|
105
126
|
watch: {
|
|
106
127
|
selectedTest(newValue) {
|
|
107
|
-
this.
|
|
128
|
+
this.testid = newValue;
|
|
108
129
|
}
|
|
109
130
|
},
|
|
110
131
|
data() {
|
|
111
132
|
return {
|
|
133
|
+
jobid: null,
|
|
134
|
+
testid: this.selectedTest,
|
|
112
135
|
slots: [
|
|
113
136
|
{
|
|
114
137
|
id: 'first',
|
|
115
138
|
name: '',
|
|
116
139
|
email: '',
|
|
117
|
-
testid: this.selectedTest,
|
|
118
|
-
jobid: null,
|
|
119
140
|
},
|
|
120
|
-
{
|
|
121
|
-
id: 'second',
|
|
122
|
-
name: '',
|
|
123
|
-
email: '',
|
|
124
|
-
testid: this.selectedTest,
|
|
125
|
-
jobid: null,
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
id: 'third',
|
|
129
|
-
name: '',
|
|
130
|
-
email: '',
|
|
131
|
-
testid: this.selectedTest,
|
|
132
|
-
jobid: null,
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
id: 'fourth',
|
|
136
|
-
name: '',
|
|
137
|
-
email: '',
|
|
138
|
-
testid: this.selectedTest,
|
|
139
|
-
jobid: null,
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
id: 'fifth',
|
|
143
|
-
name: '',
|
|
144
|
-
email: '',
|
|
145
|
-
testid: this.selectedTest,
|
|
146
|
-
jobid: null,
|
|
147
|
-
}
|
|
148
141
|
]
|
|
149
142
|
}
|
|
150
143
|
},
|
|
@@ -87,36 +87,12 @@ export default {
|
|
|
87
87
|
}
|
|
88
88
|
return this.defaultPagesToDisplay;
|
|
89
89
|
},
|
|
90
|
-
minPage() {
|
|
91
|
-
if (this.value >= 5) {
|
|
92
|
-
const pagesToAdd = Math.floor(5 / 2);
|
|
93
|
-
const newMaxPage = pagesToAdd + this.value;
|
|
94
|
-
if (newMaxPage > this.pagesName.length) {
|
|
95
|
-
return this.pagesName.length - 5 + 1;
|
|
96
|
-
}
|
|
97
|
-
return this.value - pagesToAdd;
|
|
98
|
-
} else {
|
|
99
|
-
return 1;
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
maxPage() {
|
|
103
|
-
const pagesToDisplay = this.pagesName.length === 5 ? 5 : (this.pagesName.length);
|
|
104
|
-
if (this.value >= pagesToDisplay) {
|
|
105
|
-
const pagesToAdd = Math.floor(pagesToDisplay / 2);
|
|
106
|
-
const newMaxPage = pagesToAdd + this.value;
|
|
107
|
-
if (newMaxPage < this.pagesName.length) {
|
|
108
|
-
return newMaxPage;
|
|
109
|
-
} else {
|
|
110
|
-
return this.pagesName.length;
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
return pagesToDisplay;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
90
|
},
|
|
117
91
|
data() {
|
|
118
92
|
return {
|
|
119
|
-
|
|
93
|
+
defaultPagesToDisplay: 1,
|
|
94
|
+
minPage: 1,
|
|
95
|
+
maxPage: this.pagesName.length >= 5 ? 5 : this.pagesName.length,
|
|
120
96
|
};
|
|
121
97
|
},
|
|
122
98
|
methods: {
|
|
@@ -128,7 +104,6 @@ export default {
|
|
|
128
104
|
return arr;
|
|
129
105
|
},
|
|
130
106
|
changePage(item) {
|
|
131
|
-
console.log(item)
|
|
132
107
|
this.$emit('input', item);
|
|
133
108
|
},
|
|
134
109
|
nextPage() {
|
|
@@ -148,7 +123,24 @@ export default {
|
|
|
148
123
|
},
|
|
149
124
|
total() {
|
|
150
125
|
this.$emit('input', 1);
|
|
151
|
-
|
|
126
|
+
},
|
|
127
|
+
value(newValue, oldValue) {
|
|
128
|
+
const pagesToDisplay = this.pagesName.length >= 5 ? 5 : this.pagesName.length;
|
|
129
|
+
if(newValue < 5) {
|
|
130
|
+
this.minPage = 1;
|
|
131
|
+
this.maxPage = pagesToDisplay;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
if(newValue < this.minPage) {
|
|
135
|
+
this.minPage = newValue;
|
|
136
|
+
this.maxPage = this.minPage + 4;
|
|
137
|
+
}
|
|
138
|
+
if(newValue > this.maxPage) {
|
|
139
|
+
this.maxPage = newValue;
|
|
140
|
+
this.minPage = this.maxPage - 4;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
152
144
|
}
|
|
153
145
|
};
|
|
154
146
|
</script>
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="card position-relative">
|
|
3
3
|
<div class="row px-4 justify-content-start">
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
<validation-provider tag="div" class="col-8" :vid="`question-${stepIndex}-${position}`"
|
|
5
|
+
name="Pergunta" rules="required" v-slot="{ errors }">
|
|
6
|
+
<base-input
|
|
7
|
+
:label="`Pergunta #${position + 1}`"
|
|
8
|
+
placeholder="Escreva uma pergunta"
|
|
9
|
+
type="text"
|
|
10
|
+
:error="errors[0]"
|
|
11
|
+
:valid="errors.length ? true : false"
|
|
12
|
+
:value="question.question"
|
|
13
|
+
v-on:input="setQuestion('question', $event)"
|
|
14
|
+
/>
|
|
15
|
+
</validation-provider>
|
|
15
16
|
|
|
16
17
|
<div class="col-4">
|
|
17
18
|
<label class="form-control-label d-block pt-1">
|
|
@@ -39,7 +40,7 @@
|
|
|
39
40
|
:data="question.multiples"
|
|
40
41
|
v-on:data-changed="mergeDataQuestion"/>
|
|
41
42
|
<question-attach
|
|
42
|
-
v-if="question.question_type == '
|
|
43
|
+
v-if="question.question_type == 'annex'"
|
|
43
44
|
:data="question"
|
|
44
45
|
v-on:data-changed="mergeDataQuestion"/>
|
|
45
46
|
</div>
|
|
@@ -70,7 +71,14 @@ export default {
|
|
|
70
71
|
QuestionAttach
|
|
71
72
|
},
|
|
72
73
|
props: {
|
|
73
|
-
|
|
74
|
+
stepIndex: {
|
|
75
|
+
type: Number,
|
|
76
|
+
default: 0
|
|
77
|
+
},
|
|
78
|
+
position: {
|
|
79
|
+
type: Number,
|
|
80
|
+
default: 0
|
|
81
|
+
},
|
|
74
82
|
data: null,
|
|
75
83
|
icons: {
|
|
76
84
|
type: Array,
|
|
@@ -84,7 +92,7 @@ export default {
|
|
|
84
92
|
default: () => [
|
|
85
93
|
{ value: 'paragraph', label: 'Paragrafo' },
|
|
86
94
|
{ value: 'multiple', label: 'Alternativa' },
|
|
87
|
-
{ value: '
|
|
95
|
+
{ value: 'annex', label: 'Anexo' }
|
|
88
96
|
]
|
|
89
97
|
},
|
|
90
98
|
},
|
|
@@ -94,12 +102,6 @@ export default {
|
|
|
94
102
|
question: this.data,
|
|
95
103
|
}
|
|
96
104
|
},
|
|
97
|
-
mounted() {
|
|
98
|
-
this.$validator.attach({ name: "Question", rules: "required" });
|
|
99
|
-
this.$nextTick(() => {
|
|
100
|
-
this.$validator.attach({ name: "Question", rules: "required" });
|
|
101
|
-
})
|
|
102
|
-
},
|
|
103
105
|
watch: {
|
|
104
106
|
data(newValue) {
|
|
105
107
|
this.question = newValue;
|
|
@@ -120,12 +122,6 @@ export default {
|
|
|
120
122
|
isChangeTypeQuestion(value) {
|
|
121
123
|
return this.listComponentes.includes(value);
|
|
122
124
|
},
|
|
123
|
-
getError(name){
|
|
124
|
-
return this.errors.first(name);
|
|
125
|
-
},
|
|
126
|
-
isValid(name) {
|
|
127
|
-
return this.validated && !this.errors.has(name);
|
|
128
|
-
},
|
|
129
125
|
}
|
|
130
126
|
}
|
|
131
127
|
</script>
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
|
-
<el-radio-group v-model="selected"
|
|
3
|
+
<el-radio-group v-model="selected">
|
|
4
4
|
<question-radio-item
|
|
5
|
+
v-for="(answer, index) in answers" :key="index"
|
|
5
6
|
:response="answer.name"
|
|
6
7
|
v-on:change-answer="setAnswers($event, answer)"
|
|
7
8
|
></question-radio-item>
|
|
@@ -17,82 +18,79 @@ import QuestionRadioItem from '@burh/nuxt-core/components/burh-ds/Questions/Ques
|
|
|
17
18
|
import Swal from 'sweetalert2';
|
|
18
19
|
|
|
19
20
|
export default {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
26
|
-
props: {
|
|
27
|
-
data: {
|
|
28
|
-
type: Array,
|
|
29
|
-
default: () => [{}, {}]
|
|
21
|
+
name: 'question-radio',
|
|
22
|
+
components: {
|
|
23
|
+
[Radio.name]: Radio,
|
|
24
|
+
[RadioGroup.name]: RadioGroup,
|
|
25
|
+
QuestionRadioItem
|
|
30
26
|
},
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
minRadios: 2,
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
created() {
|
|
40
|
-
this.loadAnswer();
|
|
41
|
-
},
|
|
42
|
-
methods: {
|
|
43
|
-
addOption() {
|
|
44
|
-
this.answers.push({});
|
|
27
|
+
props: {
|
|
28
|
+
data: {
|
|
29
|
+
type: Array,
|
|
30
|
+
default: () => [{}, {}]
|
|
31
|
+
},
|
|
45
32
|
},
|
|
46
|
-
|
|
47
|
-
if(this.answers.length <= this.minRadios) {
|
|
48
|
-
return Swal.fire({
|
|
49
|
-
title: 'Oops...',
|
|
50
|
-
text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
|
|
51
|
-
type: 'warning',
|
|
52
|
-
buttonsStyling: false,
|
|
53
|
-
confirmButtonText: 'Okay!',
|
|
54
|
-
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
55
|
-
})
|
|
56
|
-
}
|
|
57
|
-
this.answers.splice(this.answers.length - 1, 1);
|
|
58
|
-
},
|
|
59
|
-
loadAnswer() {
|
|
60
|
-
const answerSelected = this.answers.find(ans => ans.correct);
|
|
61
|
-
this.selected = answerSelected ? answerSelected.name : null;
|
|
62
|
-
},
|
|
63
|
-
setAnswers(value, answer) {
|
|
64
|
-
answer.name = value;
|
|
65
|
-
if (answer.correct) {
|
|
66
|
-
this.selected = value
|
|
67
|
-
}
|
|
68
|
-
this.emitRadioList();
|
|
69
|
-
},
|
|
70
|
-
makeRadiolist() {
|
|
71
|
-
const listRadio = this.answers.map(radio => {
|
|
33
|
+
data() {
|
|
72
34
|
return {
|
|
73
|
-
|
|
74
|
-
|
|
35
|
+
selected: null,
|
|
36
|
+
answers: this.data,
|
|
37
|
+
minRadios: 2,
|
|
75
38
|
}
|
|
76
|
-
})
|
|
77
|
-
return listRadio
|
|
78
|
-
},
|
|
79
|
-
emitRadioList() {
|
|
80
|
-
const payload = {
|
|
81
|
-
response: this.selected,
|
|
82
|
-
multiples: this.makeRadiolist()
|
|
83
|
-
}
|
|
84
|
-
this.$emit('data-changed', payload)
|
|
85
39
|
},
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
40
|
+
methods: {
|
|
41
|
+
addOption() {
|
|
42
|
+
this.answers.push({});
|
|
43
|
+
},
|
|
44
|
+
removeLastOption() {
|
|
45
|
+
if(this.answers.length <= this.minRadios) {
|
|
46
|
+
return Swal.fire({
|
|
47
|
+
title: 'Oops...',
|
|
48
|
+
text: 'Questões do tipo alternativa deverão conter no mínimo 2 respostas!',
|
|
49
|
+
type: 'warning',
|
|
50
|
+
buttonsStyling: false,
|
|
51
|
+
confirmButtonText: 'Okay!',
|
|
52
|
+
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
this.answers.splice(this.answers.length - 1, 1);
|
|
56
|
+
},
|
|
57
|
+
setAnswers({id, value}, answer) {
|
|
58
|
+
answer.name = value;
|
|
59
|
+
answer.id = id;
|
|
60
|
+
|
|
61
|
+
if(this.selected == null && answer.correct != false) { // be carefully here
|
|
62
|
+
this.selected = answer.id
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
this.emitRadioList();
|
|
66
|
+
},
|
|
67
|
+
makeRadiolist() {
|
|
68
|
+
const listRadio = this.answers.map(radio => {
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
id: radio.id,
|
|
72
|
+
name: radio.name,
|
|
73
|
+
correct: radio.id === this.selected ? true : false
|
|
74
|
+
}
|
|
75
|
+
})
|
|
76
|
+
return listRadio
|
|
77
|
+
},
|
|
78
|
+
emitRadioList() {
|
|
79
|
+
const payload = {
|
|
80
|
+
response: this.selected,
|
|
81
|
+
multiples: this.makeRadiolist()
|
|
82
|
+
}
|
|
83
|
+
this.$emit('data-changed', payload)
|
|
84
|
+
},
|
|
91
85
|
},
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
watch: {
|
|
87
|
+
data(newValue) {
|
|
88
|
+
this.answers = newValue.map(e => { return { ...e }}); //prevent cloning references
|
|
89
|
+
},
|
|
90
|
+
selected() {
|
|
91
|
+
this.emitRadioList();
|
|
92
|
+
},
|
|
94
93
|
},
|
|
95
|
-
},
|
|
96
94
|
}
|
|
97
95
|
</script>
|
|
98
96
|
|
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
<validation-provider tag="div" class="" :vid="`radio-${id}`"
|
|
3
|
+
name="Resposta" rules="required" v-slot="{ errors }">
|
|
4
|
+
<el-radio
|
|
5
|
+
:label="id"
|
|
6
|
+
class="form-radio"
|
|
7
|
+
:class="{'form-radio--error': errors[0]}">
|
|
8
|
+
<base-input
|
|
9
|
+
name="Response"
|
|
10
|
+
class=""
|
|
11
|
+
type="text"
|
|
12
|
+
placeholder="Coloque uma resposta aqui"
|
|
13
|
+
v-model="value"
|
|
14
|
+
:error="errors[0]"
|
|
15
|
+
:valid="errors.length ? true : false"
|
|
16
|
+
v-on:input="$emit('change-answer', {id, value})">
|
|
17
|
+
</base-input>
|
|
18
|
+
</el-radio>
|
|
19
|
+
</validation-provider>
|
|
17
20
|
</template>
|
|
18
21
|
|
|
19
22
|
<script>
|
|
@@ -30,19 +33,15 @@ export default {
|
|
|
30
33
|
default: ''
|
|
31
34
|
}
|
|
32
35
|
},
|
|
36
|
+
created() {
|
|
37
|
+
this.$emit('change-answer', {id: this.id, value: this.value});
|
|
38
|
+
},
|
|
33
39
|
data() {
|
|
34
40
|
return {
|
|
41
|
+
id: this.$uuid.v4(),
|
|
35
42
|
value: this.response,
|
|
36
43
|
}
|
|
37
44
|
},
|
|
38
|
-
methods: {
|
|
39
|
-
getError(name){
|
|
40
|
-
return this.errors.first(name);
|
|
41
|
-
},
|
|
42
|
-
isValid(name) {
|
|
43
|
-
return this.validated && !this.errors.has(name);
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
45
|
watch: {
|
|
47
46
|
response(newValue) {
|
|
48
47
|
this.value = this.response
|