From bf48af50c6aa0910687eed9fa9f9ea6754889530 Mon Sep 17 00:00:00 2001 From: pawlaczyk Date: Wed, 9 Jan 2019 08:10:33 +0100 Subject: [PATCH] [Popup.vue] poprawienie rejestracji komponentu --- backend/main.go | 3 ++ frontend/app/src/components/Popup.vue | 41 +++++++++++++++++++++++++-- frontend/app/src/views/Game.vue | 2 ++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/backend/main.go b/backend/main.go index 6b58842..2a5107d 100644 --- a/backend/main.go +++ b/backend/main.go @@ -1,5 +1,8 @@ package main +//Uruchomienie na windowsie +// go run main.go connector_couchdb.go connector_mysql.go models.go views.go + import ( "net/http" diff --git a/frontend/app/src/components/Popup.vue b/frontend/app/src/components/Popup.vue index 1e3bd6f..e3caf7c 100644 --- a/frontend/app/src/components/Popup.vue +++ b/frontend/app/src/components/Popup.vue @@ -48,12 +48,49 @@ export default { }, methods:{ submit(){ + //pobiera dane i wysyla na backend jsona dla karty + /*{ "id" : 1, + "IsQuestion" : true , + "Blank" :1 , + "texst": "ALA MA KOTA" + }*/ + if (this.$refs.form.validate()){ //valinnaj JS // this.loading = true; console.log("Dodanie do bazy") + console.log(this.cardText) + console.log(this.cardType) + var blank = 0 + if (this.cardText.match(/_/g)){ + blank = this.cardText.match(/_/g).length; + } + if (this.cardType === "pytanie" && blank === 0){ + //walidacja - karta pytanie musi miec min 1 pole puste + this.inputRules = [false || 'Karta pytanie musi miec min jedno pole na odpwiedz ( znak podłogi _)'] //info zwrotne w dialogu dla uzytkownika + } + + var cardObj = {} + if (this.cardType == "pytanie"){ + cardObj.isQuestion = true + }else{ + cardObj.isQuestion = false + } + cardObj.blank = blank + cardObj.text = this.cardText + + + axios.get(url_status, { + headers: { + 'Content-Type': 'application/json', + } + } + ).then(function(response){ + vm.friendlist = response.data; + }) + .catch(function(error){ + vm.friendlist = "An error occured: " + error; + }); this.$emit('cardAdded') - - } } }, diff --git a/frontend/app/src/views/Game.vue b/frontend/app/src/views/Game.vue index 3a2e0ad..63286b0 100644 --- a/frontend/app/src/views/Game.vue +++ b/frontend/app/src/views/Game.vue @@ -46,7 +46,9 @@