add bar code

This commit is contained in:
lq 2024-07-19 15:59:22 +08:00
parent 6daad2c1aa
commit dcdaf3f919
3 changed files with 21 additions and 1 deletions

6
package-lock.json generated
View File

@ -12,6 +12,7 @@
"@zxing/library": "^0.21.2", "@zxing/library": "^0.21.2",
"axios": "^1.7.2", "axios": "^1.7.2",
"element-plus": "^2.7.5", "element-plus": "^2.7.5",
"jsbarcode": "^3.11.6",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"vue": "^3.4.21", "vue": "^3.4.21",
"vue-axios": "^3.5.2" "vue-axios": "^3.5.2"
@ -1198,6 +1199,11 @@
"node": ">=8.0.0" "node": ">=8.0.0"
} }
}, },
"node_modules/jsbarcode": {
"version": "3.11.6",
"resolved": "https://registry.npmmirror.com/jsbarcode/-/jsbarcode-3.11.6.tgz",
"integrity": "sha512-G5TKGyKY1zJo0ZQKFM1IIMfy0nF2rs92BLlCz+cU4/TazIc4ZH+X1GYeDRt7TKjrYqmPfTjwTBkU/QnQlsYiuA=="
},
"node_modules/jspdf": { "node_modules/jspdf": {
"version": "2.5.1", "version": "2.5.1",
"resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.1.tgz", "resolved": "https://registry.npmmirror.com/jspdf/-/jspdf-2.5.1.tgz",

View File

@ -13,6 +13,7 @@
"@zxing/library": "^0.21.2", "@zxing/library": "^0.21.2",
"axios": "^1.7.2", "axios": "^1.7.2",
"element-plus": "^2.7.5", "element-plus": "^2.7.5",
"jsbarcode": "^3.11.6",
"jspdf": "^2.5.1", "jspdf": "^2.5.1",
"vue": "^3.4.21", "vue": "^3.4.21",
"vue-axios": "^3.5.2" "vue-axios": "^3.5.2"

View File

@ -507,6 +507,7 @@ import jsPDF from 'jspdf'
import { debounce, nextTick, scrollIntoView } from './utils' import { debounce, nextTick, scrollIntoView } from './utils'
import { BrowserQRCodeReader, BrowserQRCodeSvgWriter } from '@zxing/browser' import { BrowserQRCodeReader, BrowserQRCodeSvgWriter } from '@zxing/browser'
import { EncodeHintType } from '@zxing/library' import { EncodeHintType } from '@zxing/library'
import JsBarcode from 'jsbarcode'
export default { export default {
data() { data() {
return { return {
@ -556,6 +557,7 @@ export default {
}, },
mounted() { mounted() {
this.login() this.login()
this.createBarCode()
}, },
methods: { methods: {
savePdf() { savePdf() {
@ -606,7 +608,18 @@ export default {
}) })
.catch(error => console.error(error)) .catch(error => console.error(error))
}, },
handleGeneratebak(idName, name) { createBarCode(){//
const svgElement = document.createElement('svg')
//
let content = '1234567788'
let options = JsBarcode.Options
JsBarcode(svgElement, content, options)
let base64Image = this.convertSvgElementToBase64(svgElement)
console.log('条形码: ',base64Image)
},
handleGeneratebak(idName, name) {//
// //
const url = 'https://www.baihand.com?order_id=' + name//`${getIPAddress}?companyId=80&saleId=${name}`; const url = 'https://www.baihand.com?order_id=' + name//`${getIPAddress}?companyId=80&saleId=${name}`;
// div id // div id