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", "name": "@odit/lfk-selfservice",
"version": "0.7.8", "version": "0.7.8",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",
"release": "release-it", "release": "release-it",
"postbuild": "node env_fix.js" "postbuild": "node env_fix.js"
}, },
"dependencies": { "dependencies": {
"jsbarcode": "^3.11.5", "bwip-js": "^3.2.2",
"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",
"validator": "13.5.2", "validator": "13.5.2",
"vue-i18n": "9.1.4", "vue": "3.0.9",
"vue-toastification": "2.0.0-rc.1", "vue-i18n": "9.1.4",
"vue": "3.0.9", "vue-router": "4.0.5",
"vue-router": "4.0.5" "vue-toastification": "2.0.0-rc.1"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/jit": "0.1.18", "@tailwindcss/aspect-ratio": "0.2.0",
"@tailwindcss/aspect-ratio": "0.2.0", "@tailwindcss/forms": "0.3.2",
"@tailwindcss/forms": "0.3.2", "@tailwindcss/jit": "0.1.18",
"@tailwindcss/line-clamp": "0.2.0", "@tailwindcss/line-clamp": "0.2.0",
"@tailwindcss/typography": "0.4.0", "@tailwindcss/typography": "0.4.0",
"@vitejs/plugin-vue": "1.2.1", "@vitejs/plugin-vue": "1.2.1",
"@vue/compiler-sfc": "3.0.11", "@vue/compiler-sfc": "3.0.11",
"autoprefixer": "10.2.5", "autoprefixer": "10.2.5",
"tailwindcss": "2.1.1", "release-it": "14.6.1",
"release-it": "14.6.1", "tailwindcss": "2.1.1",
"vite": "2.1.5" "vite": "2.1.5"
}, },
"release-it": { "release-it": {
"git": { "git": {
"commit": true, "commit": true,
"requireCleanWorkingDir": false, "requireCleanWorkingDir": false,
"commitMessage": "🚀Bumped version to v${version}", "commitMessage": "🚀Bumped version to v${version}",
"requireBranch": "dev", "requireBranch": "dev",
"push": true, "push": true,
"tag": true, "tag": true,
"tagName": null, "tagName": null,
"tagAnnotation": "v${version}" "tagAnnotation": "v${version}"
}, },
"npm": { "npm": {
"publish": false "publish": false
}, },
"hooks": { "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" "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 // optional, will fallback to baseurl_selfservice/imprint
url_imprint: '', url_imprint: '',
// optional, will fallback to baseurl_selfservice/privacy // optional, will fallback to baseurl_selfservice/privacy
url_privacy: '' url_privacy: '',
codeformat: 'code39'
}; };

View File

@ -331,11 +331,22 @@
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"; import bwipjs from "bwip-js";
function textToBase64Barcode(text){ function textToBase64Barcode(text){
var canvas = document.createElement("canvas"); 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"); return canvas.toDataURL("image/png");
} }
@ -353,6 +364,7 @@ const state = reactive({
delete_active: false, delete_active: false,
fullobject: {} fullobject: {}
}) })
state.barcode = textToBase64Barcode("12345");
const toast = useToast(); const toast = useToast();
const props = defineProps({ const props = defineProps({
token: String token: String