improve gestion affichage

This commit is contained in:
vincent 2019-04-25 11:43:15 +02:00
parent 298118efe9
commit e2903028fc
2 changed files with 42 additions and 13 deletions

View File

@ -164,7 +164,7 @@
"212": "Dorcel TV\n", "212": "Dorcel TV\n",
"213": "Dorcel XXX\n", "213": "Dorcel XXX\n",
"214": "Libido TV\n", "214": "Libido TV\n",
"215": "Penthouse HD\n", "215": " Penthouse Gold\n",
"216": "Penthouse Black\n", "216": "Penthouse Black\n",
"217": "Colmax TV\n", "217": "Colmax TV\n",
"218": "Pink X\n", "218": "Pink X\n",
@ -336,7 +336,7 @@
"614": "RTL2\n", "614": "RTL2\n",
"615": "Fun Radio\n", "615": "Fun Radio\n",
"616": "NRJ\n", "616": "NRJ\n",
"617": "Ch\u00e9rie\n", "617": "Ch\u00e9rie FM\n",
"618": "Rire & Chansons\n", "618": "Rire & Chansons\n",
"619": "Nostalgie\n", "619": "Nostalgie\n",
"620": "RMC\n", "620": "RMC\n",

View File

@ -2,19 +2,20 @@
<div> <div>
<h1>ChaineTV</h1> <h1>ChaineTV</h1>
<div> <div>
<input name="chaine-input" v-model=chaine type="text"> <input v-on:keyup.enter="checkchaine()" name="chaine-input" v-model=chaine type="text">
</div> </div>
<div> <div>
<button v-on:click="checkchaine()">search</button> <button v-on:click="checkchaine()">search</button>
<button v-on:click="parsechaine">update chaine</button> <button v-on:click="parsechaine()">update chaine</button>
</div> </div>
<div > <div >
<ul> <ul v-if="arrayresultchaines">
<li v-for="message in messages" :key="message"> <li v-for="result in arrayresultchaines" v-bind:key="result.chaine" >
{{message}} {{result.chaine}} : {{result.name}}
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
</template> </template>
@ -26,7 +27,7 @@ export default {
name: 'chainetv', name: 'chainetv',
data() { data() {
return { return {
messages: [], arrayresultchaines: [],
chaine: '', chaine: '',
}; };
}, },
@ -37,8 +38,8 @@ export default {
path += num; path += num;
axios.get(path) axios.get(path)
.then((res) => { .then((res) => {
this.messages.push(num + ' ==> ' + res.data); this.arrayresultchaines.push({"chaine":num,"name":res.data});
console.log(this.messages);
}) })
.catch((error) => { .catch((error) => {
// eslint-disable-next-line // eslint-disable-next-line
@ -46,15 +47,21 @@ export default {
}); });
}, },
checkchaine() { checkchaine() {
this.message=null this.arrayresultchaines=[];
this.getchaine(this.chaine); const arraychaine=this.chaine.split(' ');
arraychaine.forEach(element => {
if (element != ""){
this.getchaine(element);
}
});
}, },
parsechaine() { parsechaine() {
const path = process.env.ROOT_API + '/api/v1/chaine/'; const path = process.env.ROOT_API + '/api/v1/chaine/';
axios.put(path) axios.put(path)
.then((res) => { .then((res) => {
this.message = res.data; this.messages = res.data;
}) })
.catch((error) => { .catch((error) => {
@ -68,12 +75,34 @@ export default {
<style scoped> <style scoped>
h1, h2 { h1, h2 {
font-weight: normal; font-weight: normal;
font-size: 2em;
font-weight: bold;
} }
ul { ul {
list-style-type: none; list-style-type: none;
padding: 0; padding: 0;
} }
input[type=text] {
border-radius: 4px;
padding: 12px 20px;
margin: 8px 0;
box-sizing: border-box;
}
input[type=text]:focus {
border: 2px solid rgb(30, 66, 230);
}
button {
background-color: #4CAF50;
border: none;
color: white;
padding: 16px 32px;
text-decoration: none;
margin: 4px 2px;
cursor: pointer;
}
a { a {
color: #42b983; color: #42b983;
} }