diff --git a/db.sqlite3 b/db.sqlite3
index c6516f9a8..c375dd6bb 100644
Binary files a/db.sqlite3 and b/db.sqlite3 differ
diff --git a/feedback/serializers.py b/feedback/serializers.py
index cfccfba2f..541da52cb 100644
--- a/feedback/serializers.py
+++ b/feedback/serializers.py
@@ -12,9 +12,11 @@ class RatingStatusSerializer(serializers.ModelSerializer):
class BaseCriteriaSerializer(serializers.ModelSerializer):
+ get_criteria = RatingStatusSerializer(many=True)
+
class Meta:
model = BaseCriteria
- fields = '__all__'
+ fields = ['id', 'name', 'ico', 'rating', 'color', 'get_criteria']
class UserCommentSerializer(serializers.ModelSerializer):
diff --git a/feedback/views.py b/feedback/views.py
index 8dcde3032..ab8772803 100644
--- a/feedback/views.py
+++ b/feedback/views.py
@@ -11,8 +11,13 @@ from .models import *
class BaseCriteriaAPI(ListAPIView):
- queryset = BaseCriteria.objects.all()
+ print('-----------Отправляю GET запрос в таблицу BaseCriteria-----------')
serializer_class = BaseCriteriaSerializer
+ queryset = BaseCriteria.objects.all()
+
+
+
+
class UserCommentAPI(ListCreateAPIView):
diff --git a/front/src/components/cardLike.vue b/front/src/components/cardLike.vue
index 260ffdfa1..0907f24b4 100644
--- a/front/src/components/cardLike.vue
+++ b/front/src/components/cardLike.vue
@@ -51,14 +51,14 @@
-
+
-
Вы оценили сайт на {{average}} {{myLabel()}}
-
+
@@ -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}
}
diff --git a/front/src/views/HomePage.vue b/front/src/views/HomePage.vue
index 8facde90b..d1e795b72 100644
--- a/front/src/views/HomePage.vue
+++ b/front/src/views/HomePage.vue
@@ -50,7 +50,8 @@