修复bug
This commit is contained in:
@@ -9,10 +9,6 @@
|
|||||||
<i class="iconfont"></i>
|
<i class="iconfont"></i>
|
||||||
<span>文本</span>
|
<span>文本</span>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="false" class="ep-draggable-item item" tid="defaultModule.image">
|
|
||||||
<i class="iconfont"></i>
|
|
||||||
<span>图片</span>
|
|
||||||
</div>
|
|
||||||
<div class="ep-draggable-item item" tid="defaultModule.longText">
|
<div class="ep-draggable-item item" tid="defaultModule.longText">
|
||||||
<i class="iconfont"></i>
|
<i class="iconfont"></i>
|
||||||
<span>长文</span>
|
<span>长文</span>
|
||||||
@@ -21,6 +17,10 @@
|
|||||||
<i class="iconfont"></i>
|
<i class="iconfont"></i>
|
||||||
<span>表格</span>
|
<span>表格</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="ep-draggable-item item" tid="defaultModule.html">
|
||||||
|
<i class="iconfont"></i>
|
||||||
|
<span>html</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="title">辅助元素</div>
|
<div class="title">辅助元素</div>
|
||||||
<div class="left-item__wrapper">
|
<div class="left-item__wrapper">
|
||||||
@@ -210,7 +210,7 @@
|
|||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
$('#hiprint-printTemplate').empty()
|
$('#hiprint-printTemplate').empty()
|
||||||
this.hiprintTemplate = newHiprintPrintTemplate('temulables', {
|
this.hiprintTemplate = newHiprintPrintTemplate('temulables', {
|
||||||
template: {},
|
template: template,
|
||||||
settingContainer: '#PrintElementOptionSetting',
|
settingContainer: '#PrintElementOptionSetting',
|
||||||
fields: [{
|
fields: [{
|
||||||
field: 'html',
|
field: 'html',
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ export const customProvider = function (options) {
|
|||||||
console.log(data, options, templateData)
|
console.log(data, options, templateData)
|
||||||
const elId = options.elId || 'barCode-' + new Date().getTime()
|
const elId = options.elId || 'barCode-' + new Date().getTime()
|
||||||
const codeWidth = parseInt((options.width - 22) * 0.85)
|
const codeWidth = parseInt((options.width - 22) * 0.85)
|
||||||
|
options.elId = `${elId}`
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt"><svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg></div>`)
|
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
|
||||||
|
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
|
||||||
|
</div>`)
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
JsBarcode('#'+ elId, '96778555251', {
|
JsBarcode('#'+ elId, '96778555251', {
|
||||||
format: "CODE128B",
|
format: "CODE128B",
|
||||||
@@ -23,7 +27,6 @@ export const customProvider = function (options) {
|
|||||||
margin: 0,
|
margin: 0,
|
||||||
displayValue: false
|
displayValue: false
|
||||||
})
|
})
|
||||||
options.elId = `${elId}`
|
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
const codeHtml = $(`#codewrapper-${elId}`).html()
|
const codeHtml = $(`#codewrapper-${elId}`).html()
|
||||||
@@ -68,7 +71,68 @@ export const customProvider = function (options) {
|
|||||||
options: {
|
options: {
|
||||||
width: 316,
|
width: 316,
|
||||||
height: 120,
|
height: 120,
|
||||||
elId: ''
|
elId: '',
|
||||||
|
formatter: function (data, options, templateData) {
|
||||||
|
console.log(data, options, templateData)
|
||||||
|
const elId = options.elId || 'barCode-' + new Date().getTime()
|
||||||
|
const codeWidth = parseInt((options.width - 22) * 0.85)
|
||||||
|
options.elId = `${elId}`
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
$('body').append(`<div id="codewrapper-${elId}" style="width: ${codeWidth}pt">
|
||||||
|
<svg id="${elId}" width="100%" display="block" height="100%" class="hibarcode_imgcode" preserveAspectRatio="none slice"></svg>
|
||||||
|
</div>`)
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
JsBarcode('#'+ elId, '96778555251', {
|
||||||
|
format: "CODE128B",
|
||||||
|
width: 2,
|
||||||
|
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
||||||
|
margin: 0,
|
||||||
|
displayValue: false
|
||||||
|
})
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const codeHtml = $(`#codewrapper-${elId}`).html()
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
$(`body>#codewrapper-${elId}`).remove()
|
||||||
|
// eslint-disable-next-line no-undef
|
||||||
|
const resizeObserver = new ResizeObserver(() => {
|
||||||
|
JsBarcode('#'+ elId, '96778555251', {
|
||||||
|
format: "CODE128B",
|
||||||
|
width: 2,
|
||||||
|
height: parseInt(hinnn.pt.toPx(options.height - 22).toString()) * 0.6,
|
||||||
|
margin: 0,
|
||||||
|
displayValue: false
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
setTimeout(() => {
|
||||||
|
const node = document.getElementById(`temuBarCode-${elId}`)
|
||||||
|
if (node) {
|
||||||
|
resizeObserver.observe(node)
|
||||||
|
}
|
||||||
|
}, 0)
|
||||||
|
var html = `
|
||||||
|
<div class="temuBarCode" id="temuBarCode-${elId}">
|
||||||
|
<div class="temuBarCode-top">
|
||||||
|
<div class="hiprint-printElement-text-content hiprint-printElement-content">(AA+AAA)*20PCS</div>
|
||||||
|
<div class="hiprint-printElement-text-content hiprint-printElement-content">AA 20PCS+AAA 20PCS</div>
|
||||||
|
</div>
|
||||||
|
<div class="temuBarCode-middle">
|
||||||
|
<div class="hiprint-printElement-text-content hiprint-printElement-content temuBarCode-code" style="width: 100%">
|
||||||
|
${codeHtml}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="temuBarCode-bottom">
|
||||||
|
<div class="hiprint-printElement-text-content hiprint-printElement-content">1034130097</div>
|
||||||
|
<div class="hiprint-printElement-text-content hiprint-printElement-content">Made in China</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
return html
|
||||||
|
},
|
||||||
|
},
|
||||||
|
printElementType: {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ const initWindow = () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
window.eval = code => {
|
window.eval = code => {
|
||||||
|
console.log(code)
|
||||||
return interpreter.evaluate(transformCode(code))
|
return interpreter.evaluate(transformCode(code))
|
||||||
}
|
}
|
||||||
window.JsBarcode = JsBarcode
|
window.JsBarcode = JsBarcode
|
||||||
|
|||||||
Reference in New Issue
Block a user