feat: generate code

This commit is contained in:
Settel 2022-03-09 09:45:04 +01:00
parent a158735157
commit efbd1d25a1

View File

@ -6,26 +6,29 @@
<tr>
<td>Name: </td>
<td><input v-model="name" /></td>
<td v-if="id" class="admin-edit-player__table-cell-delete" rowspan="5">
<td v-if="id" class="admin-edit-player__table-cell-delete">
<span class="admin-edit-player__button-delete" @click="deletePlayer">delete player</span>
</td>
</tr>
<tr>
<td>Score: </td>
<td><input v-model="score" /></td>
<td></td>
</tr>
<tr>
<td>Authcode: </td>
<td><input v-model="authcode" size="6" maxlength="6" /></td>
<td><span class="admin-edit-player__button-generate-code" @click="generateCode">generate code</span></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td></td>
<td>
<button class="admin-edit-player__button-save" @click="save">{{id ? 'save' : 'create'}}</button>
</td>
<td></td>
</tr>
</table>
</Infobox>
@ -54,6 +57,12 @@ export default {
await this.$engine.deletePlayer({ id: this.id })
this.$emit('close')
},
generateCode() {
this.authcode = ''
for (var i = 0; i < 6; i++) {
this.authcode += '' + Math.floor(Math.floor(Math.random() * 10000) / 100) % 10
}
},
},
}
</script>
@ -101,5 +110,15 @@ export default {
color: #ffffff;
}
}
&__button-generate-code {
margin-left: 3em;
font-size: 16px;
font-family: Dosis;
color: #d0d0d0;
cursor: pointer;
&:hover {
color: #ffffff;
}
}
}
</style>