|
|
|
@ -10,7 +10,7 @@ |
|
|
|
</view> |
|
|
|
<view class="connected-printer" v-if="printingMethod == 'cloud'"> |
|
|
|
<text>{{cloudPrinterSn ? '已绑定云打印机' : '未绑定云打印机'}}</text> |
|
|
|
<text class="connected-printer-name">{{cloudPrinterName || cloudPrinterSn || '请到后台绑定'}}</text> |
|
|
|
<text class="connected-printer-name">{{cloudPrinterBrandName}} {{cloudPrinterName || cloudPrinterSn || '请到后台绑定'}}</text> |
|
|
|
</view> |
|
|
|
<button type="primary" style="margin-top: 40rpx;font-size: 32rpx;" :loading="isCloudPrint" v-if="printingMethod == 'cloud' && cloudPrinterSn" |
|
|
|
@tap="cloudPrintTest" text=''>云打印测试</button> |
|
|
|
@ -96,10 +96,21 @@ |
|
|
|
isPrint: false, |
|
|
|
isCloudPrint: false, |
|
|
|
printingMethod: uni.getStorageSync('printingMethod') || 'bluetooth', |
|
|
|
cloudPrinterBrand: uni.getStorageSync('cloudPrinterBrand') || 'daqu', |
|
|
|
cloudPrinterSn: '', |
|
|
|
cloudPrinterName: '', |
|
|
|
} |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
cloudPrinterBrandName() { |
|
|
|
const names = { |
|
|
|
daqu: '大趋智能', |
|
|
|
yilianyun: '易联云', |
|
|
|
feieyun: '飞鹅云' |
|
|
|
}; |
|
|
|
return names[this.cloudPrinterBrand || 'daqu'] || '大趋智能'; |
|
|
|
} |
|
|
|
}, |
|
|
|
//页面卸载是关闭蓝牙链接 |
|
|
|
// onUnload() { |
|
|
|
// uni.hideLoading() |
|
|
|
@ -153,9 +164,11 @@ |
|
|
|
}, false, 'GET', 'application/x-www-form-urlencoded').then(res => { |
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
this.printingMethod = res.result.printingMethod || 'bluetooth'; |
|
|
|
this.cloudPrinterBrand = res.result.printerBrand || 'daqu'; |
|
|
|
this.cloudPrinterSn = res.result.printerSn || ''; |
|
|
|
this.cloudPrinterName = res.result.printerName || ''; |
|
|
|
uni.setStorageSync('printingMethod', this.printingMethod); |
|
|
|
uni.setStorageSync('cloudPrinterBrand', this.cloudPrinterBrand); |
|
|
|
uni.setStorageSync('cloudPrinterSn', this.cloudPrinterSn); |
|
|
|
uni.setStorageSync('cloudPrinterName', this.cloudPrinterName); |
|
|
|
} |
|
|
|
@ -177,9 +190,11 @@ |
|
|
|
}, false, 'POST', 'application/x-www-form-urlencoded').then(res => { |
|
|
|
if (res.code == 200 && res.result) { |
|
|
|
this.printingMethod = res.result.printingMethod || method; |
|
|
|
this.cloudPrinterBrand = res.result.printerBrand || 'daqu'; |
|
|
|
this.cloudPrinterSn = res.result.printerSn || ''; |
|
|
|
this.cloudPrinterName = res.result.printerName || ''; |
|
|
|
uni.setStorageSync('printingMethod', this.printingMethod); |
|
|
|
uni.setStorageSync('cloudPrinterBrand', this.cloudPrinterBrand); |
|
|
|
uni.setStorageSync('cloudPrinterSn', this.cloudPrinterSn); |
|
|
|
uni.setStorageSync('cloudPrinterName', this.cloudPrinterName); |
|
|
|
uni.showToast({ |
|
|
|
|