Обратная связь готова

This commit is contained in:
iriska-gri committed 2023-09-12 16:48:57 +03:00
1 parent fd2309c154
commit 0a9601629c
5 files changed
+42 -36

No files matched your search

+26 -32
View File
@@ -51,14 +51,14 @@
</v-container>
</v-card-text>
<v-card-actions class="pt-0">
<!-- <my-helper
:pretext="t_userComment"
/> -->
<small v-if="average < 5 || comment.length > 0" class="pl-5">
Вы оценили сайт на <span class="font-weight-black">{{average}}</span> {{myLabel()}}
</small>
<v-spacer/>
<v-btn
color="blue-darken-1"
variant="text"
text="Закрыть"
@@ -68,15 +68,9 @@
color="blue-darken-1"
variant="text"
:text="t_userComment.length==0?'Отправить':'Обновить'"
@click="proba"
@click="feedSend"
/>
<!-- <v-btn
v-else
color="blue-darken-1"
variant="text"
text="Обновить"
@click="proba"
/> -->
</v-card-actions>
</v-card>
</template>
@@ -96,33 +90,31 @@ export default {
setup(props, context) {
const comment = ref("")
const t_baseCriteria = ref([])
const tab_userComment = ref([])
const t_userComment = ref([])
function f_baseCriteria() {
axiosApiInstance.get('api/feedback/baseCriteria/')
.then(data => {
t_baseCriteria.value = data.data.results
})
}
t_baseCriteria.value = data.data.results
t_baseCriteria.value.map(e=>
e.rating = e.get_criteria[0].rating
)
})
}
function f_userComment() {
axiosApiInstance.get(`api/feedback/userComment/`)
.then(data => {
t_userComment.value = data.data.results
.then(data => {
t_userComment.value = data.data.results
comment.value=t_userComment.value[0].comment
})
}
}
onMounted(() => {
f_baseCriteria()
f_userComment()
})
const ratingStatus = computed(() => {
const decFeed = []
t_baseCriteria.value.map(e =>
@@ -157,22 +149,24 @@ export default {
context.emit('menusClose')
}
function proba() {
const feedObj = {}
function feedSend() {
const feedObj = {}
feedObj.comment = comment.value
feedObj.ratingstatus = ratingStatus.value.decFeed
if (t_userComment.value.length==0) {
axiosApiInstance.post(`api/feedback/userComment/`, feedObj)
axiosApiInstance.post(`api/feedback/userComment/`, feedObj).then(data => {
console.log(data);
})
}
else {
axiosApiInstance.put(`api/feedback/userCommentUp/${t_userComment.value[0].id}/`, feedObj)
}
f_userComment()
console.log(t_userComment.value, '111111111111111111111111111111');
axiosApiInstance.put(`api/feedback/userCommentUp/${t_userComment.value[0].id}/`, feedObj).then(data => {
console.log(data);
}
)}
menusCloses()
}
return {t_baseCriteria, t_userComment, tab_userComment, comment, average, menusCloses, myLabel, proba}
return {t_baseCriteria, t_userComment, comment, average, menusCloses, myLabel, feedSend}
}
+7 -2
View File
@@ -50,7 +50,8 @@
</template>
<script>
import {useAppStore} from '@/store/app'
import { ref, onMounted, computed } from 'vue'
import {useAppStore} from '@/store/app'
import {useAccountStore} from '@/store/AccountStore'
import {pagecounter} from '@/utils/universal_functions'
import NewsList from '@/components/news-list.vue'
@@ -68,8 +69,12 @@ import {useAppStore} from '@/store/app'
},
setup(){
onMounted(() => {
pagecounter()
})
const appStore = useAppStore()
pagecounter()
const model= null
const accountStore = useAccountStore()