[Popup.vue] poprawienie rejestracji komponentu

This commit is contained in:
pawlaczyk 2019-01-09 08:10:33 +01:00
parent 23166284d2
commit bf48af50c6
3 changed files with 44 additions and 2 deletions

View File

@ -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"

View File

@ -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')
}
}
},

View File

@ -46,7 +46,9 @@
</template>
<script>
import Popup from'@/components/Popup'
export default {
components: { Popup },
data(){
return{
gentelaman: false,