Configureable barcode format via bwp-js

This commit is contained in:
Nicolai Ort 2023-02-01 17:39:03 +01:00
parent e5a01bcd76
commit 9e06c46411
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
4 changed files with 3197 additions and 55 deletions

View File

@ -1,52 +1,52 @@
{
"name": "@odit/lfk-selfservice",
"version": "0.7.8",
"scripts": {
"dev": "vite",
"build": "vite build",
"release": "release-it",
"postbuild": "node env_fix.js"
},
"dependencies": {
"jsbarcode": "^3.11.5",
"marked": "2.0.3",
"redaxios": "0.4.1",
"toastify-js": "1.10.0",
"validator": "13.5.2",
"vue-i18n": "9.1.4",
"vue-toastification": "2.0.0-rc.1",
"vue": "3.0.9",
"vue-router": "4.0.5"
},
"devDependencies": {
"@tailwindcss/jit": "0.1.18",
"@tailwindcss/aspect-ratio": "0.2.0",
"@tailwindcss/forms": "0.3.2",
"@tailwindcss/line-clamp": "0.2.0",
"@tailwindcss/typography": "0.4.0",
"@vitejs/plugin-vue": "1.2.1",
"@vue/compiler-sfc": "3.0.11",
"autoprefixer": "10.2.5",
"tailwindcss": "2.1.1",
"release-it": "14.6.1",
"vite": "2.1.5"
},
"release-it": {
"git": {
"commit": true,
"requireCleanWorkingDir": false,
"commitMessage": "🚀Bumped version to v${version}",
"requireBranch": "dev",
"push": true,
"tag": true,
"tagName": null,
"tagAnnotation": "v${version}"
},
"npm": {
"publish": false
},
"hooks": {
"after:bump": "npx auto-changelog --commit-limit false -p -u --hide-credit && git add CHANGELOG.md && node order_i18n.js && git add src/locales"
}
}
}
{
"name": "@odit/lfk-selfservice",
"version": "0.7.8",
"scripts": {
"dev": "vite",
"build": "vite build",
"release": "release-it",
"postbuild": "node env_fix.js"
},
"dependencies": {
"bwip-js": "^3.2.2",
"marked": "2.0.3",
"redaxios": "0.4.1",
"toastify-js": "1.10.0",
"validator": "13.5.2",
"vue": "3.0.9",
"vue-i18n": "9.1.4",
"vue-router": "4.0.5",
"vue-toastification": "2.0.0-rc.1"
},
"devDependencies": {
"@tailwindcss/aspect-ratio": "0.2.0",
"@tailwindcss/forms": "0.3.2",
"@tailwindcss/jit": "0.1.18",
"@tailwindcss/line-clamp": "0.2.0",
"@tailwindcss/typography": "0.4.0",
"@vitejs/plugin-vue": "1.2.1",
"@vue/compiler-sfc": "3.0.11",
"autoprefixer": "10.2.5",
"release-it": "14.6.1",
"tailwindcss": "2.1.1",
"vite": "2.1.5"
},
"release-it": {
"git": {
"commit": true,
"requireCleanWorkingDir": false,
"commitMessage": "🚀Bumped version to v${version}",
"requireBranch": "dev",
"push": true,
"tag": true,
"tagName": null,
"tagAnnotation": "v${version}"
},
"npm": {
"publish": false
},
"hooks": {
"after:bump": "npx auto-changelog --commit-limit false -p -u --hide-credit && git add CHANGELOG.md && node order_i18n.js && git add src/locales"
}
}
}

3129
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -10,5 +10,6 @@ const config = {
// optional, will fallback to baseurl_selfservice/imprint
url_imprint: '',
// optional, will fallback to baseurl_selfservice/privacy
url_privacy: ''
url_privacy: '',
codeformat: 'code39'
};

View File

@ -331,11 +331,22 @@
import { reactive } from "vue";
import { TYPE, useToast } from "vue-toastification";
import axios from "redaxios";
import JsBarcode from "jsbarcode";
import bwipjs from "bwip-js";
function textToBase64Barcode(text){
var canvas = document.createElement("canvas");
JsBarcode(canvas, text, {format: "CODE128", displayValue:false});
bwipjs.toCanvas(canvas,
{
bcid: config.codeformat,
text: text,
scale: 4,
height: 10,
// width: 10,
includetext: true,
textxalign: 'center',
backgroundcolor: 'ffffff'
}
)
return canvas.toDataURL("image/png");
}
@ -353,6 +364,7 @@ const state = reactive({
delete_active: false,
fullobject: {}
})
state.barcode = textToBase64Barcode("12345");
const toast = useToast();
const props = defineProps({
token: String