add bar code
This commit is contained in:
parent
6daad2c1aa
commit
dcdaf3f919
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -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",
|
||||||
|
|
|
@ -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"
|
||||||
|
|
15
src/App.vue
15
src/App.vue
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user