uu
This commit is contained in:
parent
34f121f4ca
commit
262f553ac5
@ -21,6 +21,7 @@ import * as canvasUtil from "@/common/canvasUtil"
|
|||||||
import tanexPrinterUniSdk from './nativePrint/tanexPrinterUniSdk'
|
import tanexPrinterUniSdk from './nativePrint/tanexPrinterUniSdk'
|
||||||
import printModule from './nativePrint/print'
|
import printModule from './nativePrint/print'
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
|
import { Base64 } from "js-base64"
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props:{
|
props:{
|
||||||
@ -77,13 +78,17 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
// 直接传打印指令给打印机
|
// 直接传打印指令给打印机
|
||||||
handlePrintCommandData(str){
|
handlePrintCommandData(bs64Str){
|
||||||
let { bl, deviceId } = that.checkPrintParam()
|
let that = this
|
||||||
if(!bl) {
|
return new Promise((resolve, reject)=> {
|
||||||
return reject('打印参数校验不通过')
|
let { bl, deviceId } = that.checkPrintParam()
|
||||||
}
|
if(!bl) {
|
||||||
debugger
|
return reject('打印参数校验不通过')
|
||||||
printModule.sendData(str)
|
}
|
||||||
|
let cmdStr = Base64.decode(bs64Str)
|
||||||
|
printModule.sendData(cmdStr)
|
||||||
|
resolve(true)
|
||||||
|
})
|
||||||
},
|
},
|
||||||
checkPrintParam() {
|
checkPrintParam() {
|
||||||
let msg = '', bl = false
|
let msg = '', bl = false
|
||||||
|
|||||||
@ -84,7 +84,7 @@ export default {
|
|||||||
async confirmPrint(opt = { }){
|
async confirmPrint(opt = { }){
|
||||||
let { imageUrl, prtCmdData } = opt
|
let { imageUrl, prtCmdData } = opt
|
||||||
imageUrl = imageUrl || this.imageUrl || []
|
imageUrl = imageUrl || this.imageUrl || []
|
||||||
prtCmdData = prtCmdData || ''
|
prtCmdData = encodeURIComponent(prtCmdData || '')
|
||||||
if(imageUrl.length == 0 && !prtCmdData) {
|
if(imageUrl.length == 0 && !prtCmdData) {
|
||||||
this.showToast('缺少打印内容')
|
this.showToast('缺少打印内容')
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -17,7 +17,8 @@
|
|||||||
"dayjs": "^1.11.10",
|
"dayjs": "^1.11.10",
|
||||||
"file-saver": "2.0.5",
|
"file-saver": "2.0.5",
|
||||||
"pdf-lib": "1.17.1",
|
"pdf-lib": "1.17.1",
|
||||||
"vconsole": "3.15.1"
|
"vconsole": "3.15.1",
|
||||||
|
"js-base64": "3.7.7"
|
||||||
},
|
},
|
||||||
"dcloudext": {
|
"dcloudext": {
|
||||||
"category": [
|
"category": [
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
initData(){
|
initData(){
|
||||||
let urls = this.queryOption?.imageUrl?.split(",")
|
let urls = this.queryOption?.imageUrl?.split(",")
|
||||||
let prtCmdData = this.queryOption?.prtCmdData || ''
|
let prtCmdData = decodeURIComponent(this.queryOption?.prtCmdData || '')
|
||||||
this.pageLoading = false
|
this.pageLoading = false
|
||||||
if(urls?.length > 0) {
|
if(urls?.length > 0) {
|
||||||
this.$refs.curPrint.startPrint({
|
this.$refs.curPrint.startPrint({
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user