@burh/nuxt-core 1.0.19 → 1.0.21
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/assets/sass/burh-ds/atoms/_forms.scss +19 -0
- package/assets/sass/burh-ds/content/_main-content.scss +8 -0
- package/assets/sass/burh-ds/variables/_colors.scss +3 -1
- package/assets/sass/custom/_variables.scss +1 -0
- package/components/burh-ds/Avatar/AvatarLink.vue +23 -0
- package/components/burh-ds/Avatar/BusinessAvatar.vue +38 -0
- package/components/burh-ds/Button/ExportButton.vue +26 -0
- package/components/burh-ds/Button/SwitchStateButton.vue +165 -0
- package/components/burh-ds/Cards/PlanCard.vue +149 -109
- package/components/burh-ds/Cards/PurchaseCard.vue +0 -3
- package/components/burh-ds/Cards/PurchaseCardSimple.vue +0 -3
- package/components/burh-ds/Cards/RecentTestCard.vue +51 -0
- package/components/burh-ds/Cards/WelcomeCard.vue +53 -20
- package/components/burh-ds/Dropdown/AppLinkArea.vue +38 -25
- package/components/burh-ds/Dropdown/DropdownItem.vue +21 -0
- package/components/burh-ds/Dropdown/DropdownSection.vue +38 -0
- package/components/burh-ds/Dropdown/FaqVideoArea.vue +9 -4
- package/components/burh-ds/Dropdown/SignOutItem.vue +11 -0
- package/components/burh-ds/Dropdown/UserMenuDropdown.vue +58 -0
- package/components/burh-ds/Groups/ProductItem.vue +62 -0
- package/components/burh-ds/Groups/SimpleProductItem.vue +34 -30
- package/components/burh-ds/Headings/AppHeader.vue +63 -0
- package/components/burh-ds/Headings/StepHeader.vue +67 -0
- package/components/burh-ds/Inputs/BaseSwitch.vue +43 -0
- package/components/burh-ds/Inputs/BaseSwitchSecondary.vue +84 -0
- package/components/burh-ds/Lists/ListNavLinks.vue +36 -21
- package/components/burh-ds/Loadings/LoadingFullPage.vue +54 -0
- package/components/burh-ds/Modals/AppConfigModal.vue +171 -0
- package/components/burh-ds/Questions/Question.vue +110 -0
- package/components/burh-ds/Questions/QuestionAttach.vue +14 -0
- package/components/burh-ds/Questions/QuestionRadio.vue +97 -0
- package/components/burh-ds/Questions/QuestionRadioItem.vue +75 -0
- package/components/burh-ds/Questions/QuestionText.vue +36 -0
- package/components/burh-ds/Questions/index.js +14 -0
- package/components/layouts/burh-ds/footer/StoreFooter.vue +25 -25
- package/components/layouts/burh-ds/navbar/AppNavbar.vue +60 -0
- package/components/layouts/burh-ds/navbar/BusinessGlobalNavbar.vue +102 -125
- package/components/layouts/burh-ds/navbar/SimpleNavbar.vue +1 -2
- package/dictionary.js +5 -1
- package/package.json +2 -1
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label class="custom-toggle" :class="switchClass">
|
|
3
|
+
<input type="checkbox" @change="$emit('changeRecurrence')" :checked="checked">
|
|
4
|
+
<span class="custom-toggle-slider rounded-circle" :data-label-off="offText" :data-label-on="onText"></span>
|
|
5
|
+
</label>
|
|
6
|
+
</template>
|
|
7
|
+
<script>
|
|
8
|
+
export default {
|
|
9
|
+
name: 'base-switch',
|
|
10
|
+
props: {
|
|
11
|
+
onText: {
|
|
12
|
+
type: String,
|
|
13
|
+
default: 'Sim'
|
|
14
|
+
},
|
|
15
|
+
offText: {
|
|
16
|
+
type: String,
|
|
17
|
+
default: 'Não'
|
|
18
|
+
},
|
|
19
|
+
checked: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: false
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
computed: {
|
|
25
|
+
switchClass() {
|
|
26
|
+
let baseClass = 'custom-toggle-';
|
|
27
|
+
if (this.type) {
|
|
28
|
+
return baseClass + this.type;
|
|
29
|
+
}
|
|
30
|
+
return '';
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
</script>
|
|
35
|
+
<style>
|
|
36
|
+
.custom-toggle input:not(:checked) + span.custom-toggle-slider::after {
|
|
37
|
+
width: 40px !important;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.custom-toggle {
|
|
41
|
+
margin: 10px auto !important;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="custom-toggle--secondary">
|
|
3
|
+
|
|
4
|
+
<p class="custom-toggle--secondary__text" :class="checked ? classToggle.text[1] : classToggle.text[0]">
|
|
5
|
+
{{onText}}
|
|
6
|
+
</p>
|
|
7
|
+
|
|
8
|
+
<label class="custom-toggle" :class="switchClass">
|
|
9
|
+
<input type="checkbox" @change="$emit('change-switch')" :checked="checked">
|
|
10
|
+
<span class="custom-toggle-slider rounded-circle"
|
|
11
|
+
:data-label-off="''" :data-label-on="''"/>
|
|
12
|
+
</label>
|
|
13
|
+
|
|
14
|
+
<p class="custom-toggle--secondary__text" :class="checked ? classToggle.text[0] : classToggle.text[1]">
|
|
15
|
+
{{offText}}
|
|
16
|
+
<badge v-if="badgeText" rounded :type="checked ? classToggle.badge[0] : classToggle.badge[1] ">
|
|
17
|
+
{{badgeText}}
|
|
18
|
+
</badge>
|
|
19
|
+
</p>
|
|
20
|
+
</div>
|
|
21
|
+
</template>
|
|
22
|
+
<script>
|
|
23
|
+
export default {
|
|
24
|
+
name: 'base-switch-secondary',
|
|
25
|
+
props: {
|
|
26
|
+
onText: {
|
|
27
|
+
type: String,
|
|
28
|
+
default: 'Sim'
|
|
29
|
+
},
|
|
30
|
+
offText: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: 'Não'
|
|
33
|
+
},
|
|
34
|
+
checked: {
|
|
35
|
+
type: Boolean,
|
|
36
|
+
default: false
|
|
37
|
+
},
|
|
38
|
+
badgeText: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: ''
|
|
41
|
+
},
|
|
42
|
+
classToggle: {
|
|
43
|
+
type: Object,
|
|
44
|
+
default: () => {
|
|
45
|
+
return {
|
|
46
|
+
text: ['text-primary', ''],
|
|
47
|
+
badge: ['primary', 'light']
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
computed: {
|
|
53
|
+
switchClass() {
|
|
54
|
+
let baseClass = 'custom-toggle-';
|
|
55
|
+
if (this.type) {
|
|
56
|
+
return baseClass + this.type;
|
|
57
|
+
}
|
|
58
|
+
return '';
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
</script>
|
|
63
|
+
<style lang="scss">
|
|
64
|
+
.custom-toggle--secondary {
|
|
65
|
+
display: flex;
|
|
66
|
+
|
|
67
|
+
&__text {
|
|
68
|
+
margin-top: 0.5rem;
|
|
69
|
+
margin-bottom: 0.5rem;
|
|
70
|
+
margin-left: 1rem;
|
|
71
|
+
margin-right: 1rem;
|
|
72
|
+
text-align: center;
|
|
73
|
+
font-weight: 600;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.custom-toggle input:not(:checked) + span.custom-toggle-slider::after {
|
|
78
|
+
width: 40px !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.custom-toggle {
|
|
82
|
+
margin: 10px auto !important;
|
|
83
|
+
}
|
|
84
|
+
</style>
|
|
@@ -1,26 +1,41 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
</
|
|
2
|
+
<base-dropdown menu-on-left
|
|
3
|
+
v-if="children != ''"
|
|
4
|
+
class=""
|
|
5
|
+
tag="li"
|
|
6
|
+
title-tag="a"
|
|
7
|
+
>
|
|
8
|
+
<span
|
|
9
|
+
href="#"
|
|
10
|
+
class="nav-link bolder"
|
|
11
|
+
@click.prevent
|
|
12
|
+
slot="title-container"
|
|
13
|
+
>
|
|
14
|
+
{{name}}
|
|
15
|
+
</span>
|
|
16
|
+
<a
|
|
17
|
+
:href=links.link
|
|
18
|
+
class="dropdown-item"
|
|
19
|
+
v-for="(links, index) in children"
|
|
20
|
+
:key="index">{{links.name}}
|
|
21
|
+
</a>
|
|
22
|
+
</base-dropdown>
|
|
23
|
+
<li v-else class="nav-item">
|
|
24
|
+
<nuxt-link :to=link class="nav-link bolder">{{name}}</nuxt-link>
|
|
25
|
+
</li>
|
|
16
26
|
</template>
|
|
17
27
|
<script>
|
|
18
28
|
export default {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
props:{
|
|
30
|
+
id: String,
|
|
31
|
+
name: String,
|
|
32
|
+
link: String,
|
|
33
|
+
children: Array
|
|
34
|
+
}
|
|
25
35
|
}
|
|
26
|
-
</script>
|
|
36
|
+
</script>
|
|
37
|
+
<style lang="scss" scoped>
|
|
38
|
+
.bolder {
|
|
39
|
+
font-weight: 600;
|
|
40
|
+
}
|
|
41
|
+
</style>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="vld-parent">
|
|
3
|
+
<loading :active.sync="isLoading"
|
|
4
|
+
:can-cancel="true"
|
|
5
|
+
:on-cancel="onCancel"
|
|
6
|
+
:is-full-page="fullPage"
|
|
7
|
+
:color="'#1DA1F1'"
|
|
8
|
+
:loader="'dots'"></loading>
|
|
9
|
+
|
|
10
|
+
<!-- <label><input type="checkbox" v-model="fullPage">Full page?</label>
|
|
11
|
+
<button @click.prevent="doAjax">fetch Data</button> -->
|
|
12
|
+
</div>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
// Import component
|
|
17
|
+
import Loading from 'vue-loading-overlay';
|
|
18
|
+
// Import stylesheet
|
|
19
|
+
import 'vue-loading-overlay/dist/vue-loading.css';
|
|
20
|
+
|
|
21
|
+
export default {
|
|
22
|
+
// data() {
|
|
23
|
+
// return {
|
|
24
|
+
// isLoading: false,
|
|
25
|
+
// fullPage: true
|
|
26
|
+
// };
|
|
27
|
+
// },
|
|
28
|
+
props: {
|
|
29
|
+
isLoading: {
|
|
30
|
+
type: Boolean,
|
|
31
|
+
default: false
|
|
32
|
+
},
|
|
33
|
+
fullPage: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
components: {
|
|
39
|
+
Loading
|
|
40
|
+
},
|
|
41
|
+
methods: {
|
|
42
|
+
doAjax() {
|
|
43
|
+
this.isLoading = true;
|
|
44
|
+
// simulate AJAX
|
|
45
|
+
setTimeout(() => {
|
|
46
|
+
this.isLoading = false;
|
|
47
|
+
}, 5000);
|
|
48
|
+
},
|
|
49
|
+
onCancel() {
|
|
50
|
+
console.log('User cancelled the loader.');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
</script>
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<modal :show.sync="openModal" v-on:close="$emit('close-modal')" size='lg' class="modal">
|
|
3
|
+
<template slot="header">
|
|
4
|
+
<h2 class="display-4 px-4">{{title}}</h2>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<div class="row px-4">
|
|
8
|
+
<div class="col-12">
|
|
9
|
+
<label for="description">{{name}}</label>
|
|
10
|
+
<base-input
|
|
11
|
+
placeholder="Insira o nome do teste"
|
|
12
|
+
v-model="atributes.title"
|
|
13
|
+
>
|
|
14
|
+
</base-input>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div class="col-12">
|
|
18
|
+
<label for="description">{{textAreaTitle}}</label>
|
|
19
|
+
<el-input
|
|
20
|
+
type="textarea"
|
|
21
|
+
:rows="5"
|
|
22
|
+
placeholder="Insira a descrição do teste"
|
|
23
|
+
v-model="atributes.textarea">
|
|
24
|
+
</el-input>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="col-12">
|
|
28
|
+
<p class="mb-0 mt-3">{{buttonAreaTitle}}</p>
|
|
29
|
+
|
|
30
|
+
<div class="d-flex justify-content-between flex-wrap">
|
|
31
|
+
<base-button role="button" outline size="sm" type="test-online" class="mx-0"
|
|
32
|
+
v-for="(buttons, index) in buttons" :key="index"
|
|
33
|
+
:id="'button-' + buttons.id" :value="buttons.value"
|
|
34
|
+
:class="buttons.id == currentSelectedButton ? 'focus' : ''"
|
|
35
|
+
@click="timeSelection(buttons.id)"
|
|
36
|
+
>
|
|
37
|
+
<i v-if="buttons.id == currentSelectedButton" class="fas fa-check purple mr-1"></i>
|
|
38
|
+
<small>{{buttons.time}}</small>
|
|
39
|
+
</base-button>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
<base-input
|
|
43
|
+
v-model="value"
|
|
44
|
+
id='time-picker'
|
|
45
|
+
placeholder='00:00:00'
|
|
46
|
+
:disabled="disableTimePicker"
|
|
47
|
+
type="'tel'"
|
|
48
|
+
v-mask="'##:##:##'"
|
|
49
|
+
class="w-50"
|
|
50
|
+
></base-input>
|
|
51
|
+
</div>
|
|
52
|
+
|
|
53
|
+
<base-button size="md" type="test-online" role="button"
|
|
54
|
+
@click="sendConfig()"
|
|
55
|
+
class="ml-auto mr-3">{{sendButton}}</base-button>
|
|
56
|
+
</div>
|
|
57
|
+
</modal>
|
|
58
|
+
</template>
|
|
59
|
+
<script>
|
|
60
|
+
import swal from 'sweetalert2';
|
|
61
|
+
import {mask} from 'vue-the-mask'
|
|
62
|
+
export default {
|
|
63
|
+
directives: {mask},
|
|
64
|
+
data(){
|
|
65
|
+
return{
|
|
66
|
+
atributes:{
|
|
67
|
+
title: '',
|
|
68
|
+
textarea: '',
|
|
69
|
+
selectedTime: '',
|
|
70
|
+
},
|
|
71
|
+
currentSelectedButton: String,
|
|
72
|
+
disableTimePicker: true,
|
|
73
|
+
value: '',
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
model:{
|
|
77
|
+
prop: 'show'
|
|
78
|
+
},
|
|
79
|
+
props:{
|
|
80
|
+
show: false,
|
|
81
|
+
name:{
|
|
82
|
+
type: String,
|
|
83
|
+
default: 'Nome'
|
|
84
|
+
},
|
|
85
|
+
buttons:{
|
|
86
|
+
type: Array,
|
|
87
|
+
default: () => [{id: '1', time: '5 minutos', value:'00:05:00'}, {id: '2', time: '10 minutos', value:'00:10:00'}, {id: '3', time: '15 minutos', value:'00:15:00'},
|
|
88
|
+
{id: '4', time: '30 minutos', value:'00:30:00'},{id: '5', time: '45 minutos', value:'00:45:00'}, {id: '6', time: '60 minutos', value:'01:00:00'},
|
|
89
|
+
{id: '7', time: '2 horas', value: '02:00:00'}, {id: 'custom', time: 'Personalizado', value: ''}],
|
|
90
|
+
description: 'Botoes de tempo'
|
|
91
|
+
},
|
|
92
|
+
title:{
|
|
93
|
+
type: String,
|
|
94
|
+
default: 'Geral',
|
|
95
|
+
description: 'Titulo do Modal'
|
|
96
|
+
},
|
|
97
|
+
textAreaTitle:{
|
|
98
|
+
type: String,
|
|
99
|
+
default: 'Descrição',
|
|
100
|
+
description: 'Titulo da text area'
|
|
101
|
+
},
|
|
102
|
+
buttonAreaTitle:{
|
|
103
|
+
type: String,
|
|
104
|
+
default: 'Tempo Limite',
|
|
105
|
+
description: 'Titulo da area de botões'
|
|
106
|
+
},
|
|
107
|
+
sendButton:{
|
|
108
|
+
type: String,
|
|
109
|
+
default: 'Salvar',
|
|
110
|
+
description: 'Botão de envio'
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
watch:{
|
|
114
|
+
value(oldVal, newVal){
|
|
115
|
+
this.selectCustomTime();
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
computed:{
|
|
119
|
+
openModal:{
|
|
120
|
+
get(){return this.show},
|
|
121
|
+
set(show){this.$emit('input', show)}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
methods:{
|
|
125
|
+
timeSelection(buttonId){
|
|
126
|
+
let btn = document.getElementById('button-' + buttonId);
|
|
127
|
+
let timePicker = document.getElementById('time-picker');
|
|
128
|
+
if(buttonId != 'custom'){
|
|
129
|
+
this.atributes.selectedTime=btn.value;
|
|
130
|
+
this.currentSelectedButton=buttonId
|
|
131
|
+
this.disableTimePicker = true;
|
|
132
|
+
}
|
|
133
|
+
else{
|
|
134
|
+
this.disableTimePicker = false;
|
|
135
|
+
this.currentSelectedButton = 'custom'
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
selectCustomTime(){
|
|
139
|
+
let button = document.getElementById('button-custom');
|
|
140
|
+
|
|
141
|
+
button.value = this.value;
|
|
142
|
+
this.atributes.selectedTime = this.value;
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
sendConfig(){
|
|
146
|
+
if(this.atributes.title == '' || this.atributes.textarea == '' ||
|
|
147
|
+
this.atributes.selectedTime == '' || this.atributes.selectedTime.length != 8){
|
|
148
|
+
swal.fire({
|
|
149
|
+
title: `Aviso`,
|
|
150
|
+
html: `Por favor, preencha todos os campos corretamente para continuar.`,
|
|
151
|
+
buttonsStyling: false,
|
|
152
|
+
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else{
|
|
156
|
+
this.$emit('send-atributes', this.atributes)
|
|
157
|
+
swal.fire({
|
|
158
|
+
title: `Parabéns`,
|
|
159
|
+
html: `Configurações salvas com sucesso.`,
|
|
160
|
+
buttonsStyling: false,
|
|
161
|
+
confirmButtonClass: 'btn btn-primary btn-fill',
|
|
162
|
+
});
|
|
163
|
+
this.openModal=false;
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
</script>
|
|
169
|
+
<style lang="scss">
|
|
170
|
+
@import "node_modules/@burh/nuxt-core/assets/sass/burh-ds/variables/_colors.scss";
|
|
171
|
+
</style>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card card--shadow">
|
|
3
|
+
<div class="row px-4 justify-content-start">
|
|
4
|
+
<base-input
|
|
5
|
+
name="Question"
|
|
6
|
+
:label="`Pergunta #${position + 1}`"
|
|
7
|
+
placeholder="Escreva uma pergunta"
|
|
8
|
+
type="text"
|
|
9
|
+
class="col-8"
|
|
10
|
+
:error="getError('Question')"
|
|
11
|
+
:valid="isValid('Question')"
|
|
12
|
+
v-model="question.question"
|
|
13
|
+
v-validate="'required'"/>
|
|
14
|
+
|
|
15
|
+
<div class="col-4">
|
|
16
|
+
<label class="form-control-label d-block pt-1">
|
|
17
|
+
Escolha o tipo da pergunta
|
|
18
|
+
</label>
|
|
19
|
+
<el-select class="select-danger w-100"
|
|
20
|
+
placeholder="Single Select"
|
|
21
|
+
v-model="question.question_type">
|
|
22
|
+
<el-option v-for="option in listComponentes"
|
|
23
|
+
class="select-danger"
|
|
24
|
+
:value="option.value"
|
|
25
|
+
:label="option.label"
|
|
26
|
+
:key="option.label">
|
|
27
|
+
</el-option>
|
|
28
|
+
</el-select>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="col-8 form-group">
|
|
32
|
+
<component
|
|
33
|
+
:is="question.question_type"
|
|
34
|
+
v-on:data-changed="createDataQuestion"
|
|
35
|
+
/>
|
|
36
|
+
<slot/>
|
|
37
|
+
</div>
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<script>
|
|
43
|
+
import {Select, Option} from 'element-ui'
|
|
44
|
+
import QuestionText from '@burh/nuxt-core/components/burh-ds/Questions/QuestionText.vue';
|
|
45
|
+
import QuestionRadio from '@burh/nuxt-core/components/burh-ds/Questions/QuestionRadio.vue';
|
|
46
|
+
import QuestionAttach from '@burh/nuxt-core/components/burh-ds/Questions/QuestionAttach.vue';
|
|
47
|
+
|
|
48
|
+
export default {
|
|
49
|
+
components: {
|
|
50
|
+
[Select.name]: Select,
|
|
51
|
+
[Option.name]: Option,
|
|
52
|
+
Paragraph: QuestionText,
|
|
53
|
+
QuestionRadio,
|
|
54
|
+
QuestionAttach
|
|
55
|
+
},
|
|
56
|
+
props: {
|
|
57
|
+
position: Number,
|
|
58
|
+
},
|
|
59
|
+
data() {
|
|
60
|
+
return {
|
|
61
|
+
console:console,
|
|
62
|
+
listComponentes: [
|
|
63
|
+
{
|
|
64
|
+
value: 'paragraph',
|
|
65
|
+
label: 'Paragrafo'
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: 'question-radio',
|
|
69
|
+
label: 'Dissertativa'
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
value: 'question-attach',
|
|
73
|
+
label: 'Anexo'
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
question: {
|
|
77
|
+
question_type: 'paragraph',
|
|
78
|
+
question: '',
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
watch: {
|
|
83
|
+
question: {
|
|
84
|
+
handler: 'emitQuestion',
|
|
85
|
+
deep: true
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
methods: {
|
|
89
|
+
emitQuestion() {
|
|
90
|
+
this.$emit('change-question', this.question)
|
|
91
|
+
},
|
|
92
|
+
isChangeTypeQuestion(value) {
|
|
93
|
+
return this.listComponentes.includes(value);
|
|
94
|
+
},
|
|
95
|
+
createDataQuestion(data) {
|
|
96
|
+
this.question = { ...this.question , ...data }
|
|
97
|
+
},
|
|
98
|
+
getError(name){
|
|
99
|
+
return this.errors.first(name);
|
|
100
|
+
},
|
|
101
|
+
isValid(name) {
|
|
102
|
+
return this.validated && !this.errors.has(name);
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
107
|
+
|
|
108
|
+
<style>
|
|
109
|
+
|
|
110
|
+
</style>
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<el-radio-group v-model="selected" v-for="(answer, index) in answers" :key="index">
|
|
4
|
+
<question-radio-item
|
|
5
|
+
v-on:change-answer="setAnswers($event, answer)"
|
|
6
|
+
></question-radio-item>
|
|
7
|
+
</el-radio-group>
|
|
8
|
+
<base-button size="sm" type="primary" @click="addOption">Adicionar</base-button>
|
|
9
|
+
<base-button outline size="sm" type="primary" @click="removeLastOption">Remover</base-button>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script>
|
|
14
|
+
import {Radio, RadioGroup} from 'element-ui'
|
|
15
|
+
import QuestionRadioItem from '@burh/nuxt-core/components/burh-ds/Questions/QuestionRadioItem.vue';
|
|
16
|
+
|
|
17
|
+
export default {
|
|
18
|
+
name: 'question-radio',
|
|
19
|
+
components: {
|
|
20
|
+
[Radio.name]: Radio,
|
|
21
|
+
[RadioGroup.name]: RadioGroup,
|
|
22
|
+
QuestionRadioItem
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
dataAnswers: {
|
|
26
|
+
type: Array,
|
|
27
|
+
default: () => [{}, {}]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
data() {
|
|
31
|
+
return {
|
|
32
|
+
selected: null,
|
|
33
|
+
answers: this.dataAnswers,
|
|
34
|
+
minRadios: 2,
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
addOption() {
|
|
39
|
+
this.answers.push({});
|
|
40
|
+
},
|
|
41
|
+
removeLastOption() {
|
|
42
|
+
if(this.answers.length <= this.minRadios) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
this.answers.splice(this.answers.length - 1, 1);
|
|
46
|
+
},
|
|
47
|
+
setAnswers(value, answer) {
|
|
48
|
+
answer['response'] = value;
|
|
49
|
+
this.emitAnswersRadio();
|
|
50
|
+
},
|
|
51
|
+
makeStructureListRadio() {
|
|
52
|
+
const listRadio = this.answers.map(radio => {
|
|
53
|
+
if ( radio.response == this.selected ) {
|
|
54
|
+
return {
|
|
55
|
+
name: radio.response,
|
|
56
|
+
correct: true,
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
name: radio.response,
|
|
62
|
+
correct: false,
|
|
63
|
+
}
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
return listRadio
|
|
67
|
+
},
|
|
68
|
+
emitAnswersRadio() {
|
|
69
|
+
const payload = {
|
|
70
|
+
response: this.selected,
|
|
71
|
+
multiples: this.makeStructureListRadio()
|
|
72
|
+
}
|
|
73
|
+
this.$emit('data-changed', payload)
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
computed: {
|
|
77
|
+
getAnswers() {
|
|
78
|
+
return this.answers;
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
watch: {
|
|
82
|
+
getAnswers: {
|
|
83
|
+
handler: 'emitAnswersRadio',
|
|
84
|
+
deep: true
|
|
85
|
+
},
|
|
86
|
+
selected() {
|
|
87
|
+
this.emitAnswersRadio();
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style lang='scss'>
|
|
94
|
+
.el-radio-group {
|
|
95
|
+
width: 100%;
|
|
96
|
+
}
|
|
97
|
+
</style>
|