覆盖11.20的代码
This commit is contained in:
@@ -59,36 +59,42 @@
|
||||
console.log(formInfo.shopInfo)
|
||||
if (res) {
|
||||
formInfo.url = res;
|
||||
nextTick(() => {
|
||||
const barcodeText = '1234567890';
|
||||
const query = uni.createSelectorQuery();
|
||||
query.select('#barcodeCanvas')
|
||||
.fields({ node: true, size: true })
|
||||
.exec((res) => {
|
||||
if (res[0]) {
|
||||
const canvas = res[0].node;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = uni.getSystemInfoSync().pixelRatio;
|
||||
canvas.width = res[0].width * dpr;
|
||||
canvas.height = res[0].height * dpr;
|
||||
ctx.scale(dpr, dpr);
|
||||
|
||||
JsBarcode(canvas, barcodeText, {
|
||||
width: 2,
|
||||
height: 100,
|
||||
displayValue: true,
|
||||
fontOptions: 'bold',
|
||||
font: 'monospace',
|
||||
textAlign: 'center',
|
||||
textPosition: 'bottom',
|
||||
textMargin: 2,
|
||||
fontSize: 20,
|
||||
background: '#ffffff',
|
||||
lineColor: '#000000'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
try {
|
||||
nextTick(() => {
|
||||
const query = uni.createSelectorQuery();
|
||||
query.select('#barcodeCanvas')
|
||||
.fields({
|
||||
node: true,
|
||||
size: true
|
||||
})
|
||||
.exec((res) => {
|
||||
if (res[0]) {
|
||||
const canvas = res[0].node;
|
||||
const ctx = canvas.getContext('2d');
|
||||
const dpr = uni.getSystemInfoSync().pixelRatio;
|
||||
canvas.width = res[0].width * dpr;
|
||||
canvas.height = res[0].height * dpr;
|
||||
ctx.scale(dpr, dpr);
|
||||
|
||||
JsBarcode(canvas, formInfo.url, {
|
||||
width: 2,
|
||||
height: 100,
|
||||
displayValue: true,
|
||||
fontOptions: 'bold',
|
||||
font: 'monospace',
|
||||
textAlign: 'center',
|
||||
textPosition: 'bottom',
|
||||
textMargin: 2,
|
||||
fontSize: 20,
|
||||
background: '#ffffff',
|
||||
lineColor: '#000000'
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
} catch (error) {
|
||||
//TODO handle the exception
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user