Commit 9ce98f17 authored by Jérémie Passerat's avatar Jérémie Passerat

login (basique) ok

parent 3abe5016
...@@ -2353,6 +2353,14 @@ ...@@ -2353,6 +2353,14 @@
"integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==", "integrity": "sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==",
"dev": true "dev": true
}, },
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"requires": {
"follow-redirects": "^1.10.0"
}
},
"babel-eslint": { "babel-eslint": {
"version": "10.1.0", "version": "10.1.0",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.1.0.tgz",
...@@ -5378,8 +5386,7 @@ ...@@ -5378,8 +5386,7 @@
"follow-redirects": { "follow-redirects": {
"version": "1.14.1", "version": "1.14.1",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.1.tgz",
"integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg==", "integrity": "sha512-HWqDgT7ZEkqRzBvc2s64vSZ/hfOceEol3ac/7tKwzuvEyWx3/4UegXh5oBOIotkGsObyk3xznnSRVADBgWSQVg=="
"dev": true
}, },
"for-in": { "for-in": {
"version": "1.0.2", "version": "1.0.2",
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"axios": "^0.21.1",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"jquery": "^3.6.0", "jquery": "^3.6.0",
"jquery-ui-bundle": "^1.12.1-migrate", "jquery-ui-bundle": "^1.12.1-migrate",
......
...@@ -2,12 +2,12 @@ ...@@ -2,12 +2,12 @@
<div> <div>
<Login v-show="etat === 'unlogged'" @user_logged="setLogged"></Login> <Login v-show="etat === 'unlogged'" @user_logged="setLogged"></Login>
<Menu v-show="etat !== 'unlogged'" v-bind:etat="etat" v-bind:isNotif="isNotif" v-bind:variante="variante" @menu_choisi="changerPage"></Menu> <Menu v-show="etat !== 'unlogged'" v-bind:auteur="auteur" v-bind:etat="etat" v-bind:isNotif="isNotif" v-bind:variante="variante" @menu_choisi="changerPage"></Menu>
<Contenu v-show="etat === 'Contenu'" @choix_variante="choixVariante" @publication="publication"></Contenu> <Contenu v-show="etat === 'Contenu'" @choix_variante="choixVariante" @publication="publication"></Contenu>
<Maj v-show="etat === 'Mises à jour'" v-bind:contenuEnPublication="contenuEnPublication" ></Maj> <Maj v-show="etat === 'Mises à jour'" v-bind:contenuEnPublication="contenuEnPublication" ></Maj>
<Profil v-show="etat === 'Profil'" ></Profil> <Profil v-show="etat === 'Profil'" ></Profil>
<Tags v-show="etat === 'Tags'" ></Tags> <Tags v-show="etat === 'Tags'" ></Tags>
<p style="text-align: center" v-show="errorLogin">Login ou mot de passe erroné</p>
</div> </div>
</template> </template>
...@@ -27,13 +27,22 @@ export default { ...@@ -27,13 +27,22 @@ export default {
etat: "unlogged", etat: "unlogged",
variante: false, variante: false,
contenuEnPublication: "", contenuEnPublication: "",
isNotif: false isNotif: false,
errorLogin: false,
auteur: ""
} }
}, },
methods: { methods: {
setLogged: function () { setLogged: function (event) {
//this.$cookies.set("isLogged", true) //this.$cookies.set("isLogged", true)
this.etat = "Contenu" if (event.isLogged){
this.etat = "Contenu"
this.errorLogin = false
this.auteur = event.auteur
}
else {
this.errorLogin = true
}
}, },
changerPage: function (event) { changerPage: function (event) {
if (event.choix === "Deconnexion") if (event.choix === "Deconnexion")
......
<template> <template>
<div id="loginForm"> <div id="loginForm">
<p>Trois comptes temporaires : Auteur 1, Auteur 2, Auteur 3</p>
<label for="identifiant">Identifiant</label> <label for="identifiant">Identifiant</label>
<br> <br>
<input type="text" id="identifiant" placeholder="identifiant" v-model="login" > <input type="text" id="identifiant" placeholder="identifiant" v-model="login" >
...@@ -19,14 +20,21 @@ ...@@ -19,14 +20,21 @@
</template> </template>
<script> <script>
import Service from '../src/service/Service'
export default { export default {
name: "Login", name: "Login",
methods: { methods: {
logIn: function () { logIn: function () {
let that = this
this.$emit("user_logged", {"isLogged" : true}) Service.login([this.login, this.password]).then(function (response) {
if (response.data === "True"){
that.$emit("user_logged", {"isLogged" : true, "auteur": that.login})
} else {
that.$emit("user_logged", {"isLogged" : false})
}
})
} }
}, },
data: function () { data: function () {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<Choix_Mode_Variante class="menuVariante" v-show="variante"></Choix_Mode_Variante> <Choix_Mode_Variante class="menuVariante" v-show="variante"></Choix_Mode_Variante>
<div class="notif" v-on:click="choixIconeNotification" v-show="isNotif" v-bind:style="[!variante ? {'margin-left': '90%'} : {'margin-left': '31.78%'}]"></div> <div class="notif" v-on:click="choixIconeNotification" v-show="isNotif" v-bind:style="[!variante ? {'margin-left': '90%'} : {'margin-left': '31.78%'}]"></div>
<div class="circle" v-on:click="isAffiche = !isAffiche" v-bind:style="[!isNotif ? {'margin-left': '94.75%'} : {'margin-left': '3%'}]"> <div class="circle" v-on:click="isAffiche = !isAffiche" v-bind:style="[!isNotif ? {'margin-left': '94.75%'} : {'margin-left': '3%'}]">
Auteur 1 {{auteur}}
</div> </div>
<div class="menu" v-show="isAffiche"> <div class="menu" v-show="isAffiche">
<div class="sous_menu" v-on:click="choixMenuAnnexe">Profil</div> <div class="sous_menu" v-on:click="choixMenuAnnexe">Profil</div>
...@@ -26,7 +26,7 @@ export default { ...@@ -26,7 +26,7 @@ export default {
isAffiche: false isAffiche: false
} }
}, },
props: ['etat', 'variante', 'isNotif'], props: ['etat', 'variante', 'isNotif', 'auteur'],
methods: { methods: {
choixMenuAnnexe: function (e) { choixMenuAnnexe: function (e) {
this.$emit("menu_choisi", {choix: e.target.innerText}) this.$emit("menu_choisi", {choix: e.target.innerText})
......
...@@ -129,6 +129,9 @@ export default { ...@@ -129,6 +129,9 @@ export default {
$('#ensemble').draggable() $('#ensemble').draggable()
}, },
updated() {
alert('susumesusumemayi')
},
methods: { methods: {
desactiverVolet: function () { desactiverVolet: function () {
this.isActif = !this.isActif this.isActif = !this.isActif
......
...@@ -6,7 +6,6 @@ import VPopover from 'vue-js-popover' ...@@ -6,7 +6,6 @@ import VPopover from 'vue-js-popover'
Vue.config.productionTip = false Vue.config.productionTip = false
Vue.use(VPopover, { tooltip: true }) Vue.use(VPopover, { tooltip: true })
new Vue({ new Vue({
render: h => h(Index), render: h => h(Index),
}).$mount('#app') }).$mount('#app')
import axios from 'axios'
const urlBase = "http://127.0.0.1:5000/"
export default {
login(data) {
let login = data[0]
let motDePasse = data[1]
/* let reponse = ""
axios.get(urlBase + "checkUser?login=" + login + "&password=" + motDePasse).then(function (response) {
reponse = response.data
})*/
return axios.get(urlBase + "checkUser?login=" + login + "&password=" + motDePasse)
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment