add barcode to profile
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Philipp Dormann 2023-02-01 14:48:06 +01:00
parent 1603a097f7
commit 851190e6a7
Signed by: philipp
GPG Key ID: 3BB9ADD52DCA4314
3 changed files with 13 additions and 0 deletions

View File

@ -8,6 +8,7 @@
"postbuild": "node env_fix.js" "postbuild": "node env_fix.js"
}, },
"dependencies": { "dependencies": {
"jsbarcode": "^3.11.5",
"marked": "2.0.3", "marked": "2.0.3",
"redaxios": "0.4.1", "redaxios": "0.4.1",
"toastify-js": "1.10.0", "toastify-js": "1.10.0",

View File

@ -52,6 +52,7 @@
"tos": "AGBs", "tos": "AGBs",
"total": "Gesamt", "total": "Gesamt",
"view_my_data": "Meine Läuferdaten einsehen", "view_my_data": "Meine Läuferdaten einsehen",
"registrierungscode": "Registrierungscode",
"vorname": "Vorname", "vorname": "Vorname",
"you_have_been_registered": "Sie wurden registriert!", "you_have_been_registered": "Sie wurden registriert!",
"you_have_not_provided_a_valid_access_key": "Sie haben keinen gültigen Zugangsschlüssel angegeben..." "you_have_not_provided_a_valid_access_key": "Sie haben keinen gültigen Zugangsschlüssel angegeben..."

View File

@ -153,6 +153,8 @@
<form class="form flex flex-wrap w-full"> <form class="form flex flex-wrap w-full">
<div class="w-full"> <div class="w-full">
<div class="form-element"> <div class="form-element">
<div class="text-lg">{{ $t('registrierungscode') }}</div>
<img alt="Registrierungscode" :src="state.barcode">
<div class="text-lg">{{ $t('vorname') }}</div> <div class="text-lg">{{ $t('vorname') }}</div>
<p <p
class="h-10 w-full dark:bg-gray-800 rounded text-base outline-none dark:text-gray-100 text-gray-600 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out" class="h-10 w-full dark:bg-gray-800 rounded text-base outline-none dark:text-gray-100 text-gray-600 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out"
@ -329,8 +331,16 @@
import { reactive } from "vue"; import { reactive } from "vue";
import { TYPE, useToast } from "vue-toastification"; import { TYPE, useToast } from "vue-toastification";
import axios from "redaxios"; import axios from "redaxios";
import JsBarcode from "jsbarcode";
function textToBase64Barcode(text){
var canvas = document.createElement("canvas");
JsBarcode(canvas, text, {format: "CODE128", displayValue:false});
return canvas.toDataURL("image/png");
}
const state = reactive({ const state = reactive({
barcode: "",
phone: "", phone: "",
email: "", email: "",
firstname: "", firstname: "",
@ -358,6 +368,7 @@ axios.get(`${config.baseurl}api/runners/me/${accesstoken}`)
state.group = data.group; state.group = data.group;
state.sponsorings = data.distanceDonations; state.sponsorings = data.distanceDonations;
state.fullobject = data; state.fullobject = data;
state.barcode = textToBase64Barcode(state.fullobject.id);
}).catch((error) => { }).catch((error) => {
toast.error("Profil konnte nicht geladen werden..."); toast.error("Profil konnte nicht geladen werden...");
}) })