lilei 2 年 前
コミット
6e2cc3a190

+ 10 - 2
manifest.json

@@ -87,11 +87,19 @@
             /* ios打包配置 */
             "ios" : {
                 "idfa" : false,
-                "dSYMs" : false
+                "dSYMs" : false,
+                "UIBackgroundModes" : "audio,bluetooth-central"
             },
             /* SDK配置 */
             "sdkConfigs" : {
-                "ad" : {}
+                "ad" : {},
+                "speech" : {
+                    "baidu" : {
+                        "appid" : "27051620",
+                        "apikey" : "uFrhrEO2NhtO72CKuRYB9MNt",
+                        "secretkey" : "GWNVXBvBY21B7h2PvB6pvmXTgN6jdndR"
+                    }
+                }
             },
             "icons" : {
                 "android" : {

+ 29 - 5
pages/common/printTag/printTag.vue

@@ -1,5 +1,6 @@
 <template>
 	<view class="printTag">
+		<u-alert-tips :show="show" @close="show = false" type="warning" description="正在打印中,请勿息屏或退出应用!"></u-alert-tips>
 		<view class="print-nums flex flex_column align_center justify_center">
 			<view>打印数量</view>
 			<view class="u-ninput">
@@ -8,7 +9,7 @@
 		</view>
 		<view class="shelf-info">
 			<view class="shelf-info-title">
-				<view>{{infoData&&infoData.shelfName || '--'}}</view>
+				<view class="shelf-name">{{infoData&&infoData.shelfName || '--'}}</view>
 				<view class="pno">{{infoData&&infoData.shelfPlaceCode}}</view>
 			</view>
 			<view>产品编码:{{fromPage == 'smdy'?infoData.productCode : infoData.productEntity&&infoData.productEntity.code}}</view>
@@ -36,6 +37,7 @@
 		},
 		data() {
 			return {
+				show: false,
 				infoData: null,
 				fromPage: '',
 				printInfo: null,
@@ -50,6 +52,10 @@
 			_this.printNum = _this.fromPage == 'smdy' ? _this.infoData.confirmQty : _this.infoData.qty
 			_this.printNum = _this.printNum||1
 			console.log(_this.infoData)
+			// 保持屏幕常亮
+			uni.setKeepScreenOn({
+				keepScreenOn: true
+			});
 		},
 		onUnload() {
 			// this.$refs.kkprinter.closeConnect()
@@ -57,11 +63,22 @@
 			this.infoData = null
 			this.printInfo = null
 			this.fromPage = ''
+			// 保持屏幕常亮
+			uni.setKeepScreenOn({
+				keepScreenOn: false
+			});
 		},
 		// 监听页面返回,返回 event = {from:backbutton、 navigateBack} ,backbutton 表示来源是左上角返回按钮或 android 返回键;navigateBack表示来源是 uni.navigateBack
 		onBackPress(event){
 			if(event.from == 'backbutton'){
-				this.cancel()
+				if(this.isParinting){
+					uni.showToast({
+						icon:'none',
+						title: '正在打印中...'
+					})
+				}else{
+					this.cancel()
+				}
 				return true  // 阻止默认返回行为(会导致无限循环)
 			}
 		},
@@ -123,14 +140,15 @@
 					return
 				}
 				this.isParinting = true
+				this.show = true
 				const command = printTempl(tsc,this.printInfo)
 				blesdk.senBlData(opt.deviceId, opt.serviceId, opt.writeId, command.getData(), this.onPrintSuccess);
 			},
 			// 打印成功
 			onPrintSuccess(){
-				// uni.navigateBack()
 				this.$refs.kkprinter.onPrintSuccess()
 				this.isParinting = false
+				this.show = false
 			}
 		}
 	}
@@ -172,17 +190,23 @@
 		border-radius: 12rpx;
 		color: #707070;
 		.shelf-info-title{
-			font-size: 32rpx;
+			font-size: 30rpx;
 			color: #222222;
 			display: flex;
 			justify-content: space-between;
 			margin-bottom: 10rpx;
+			.shelf-name{
+				flex:1;
+				margin-right: 10rpx;
+			}
 			.pno{
 				background: rgba(3, 54, 146, 0.15);
 				border-radius: 100rpx;
-				padding: 4rpx 20rpx;
+				padding: 0 20rpx;
 				color: #033692;
 				font-size: 26rpx;
+				height: 40rpx;
+				margin-top:5rpx;
 			}
 		}
 	}

+ 27 - 1
pages/replenishmentManage/manualPrint.vue

@@ -1,6 +1,7 @@
 <template>
 	<view class="replenishment-manualPrint-wrap">
 		<view class="replenishment-manualPrint-body">
+			<u-alert-tips :show="!show" @close="show = false" type="warning" description="正在打印中,请勿息屏或退出应用!"></u-alert-tips>
 			<view class="part-list">
 				<!-- 补货产品 -->
 				<partList :list="partList" title="补货产品" model="checkbox" fromPage="manualPrint" ref="partList" noDataText="暂无产品" @allChecked="allCheckedCallback"></partList>
@@ -26,11 +27,13 @@
 		components: { partList, kkPrinter },
 		data() {
 			return {
+				show: false,
 				replenishBillSn: '',
 				basicInfoData:null,
 				partList: [],
 				allChecked: false,
 				printIndex: 0,
+				isParinting: false
 			}
 		},
 		onReady() {
@@ -43,9 +46,30 @@
 			this.replenishBillSn = option.sn
 			this.getDetail()
 			this.getPartList()
+			// 保持屏幕常亮
+			uni.setKeepScreenOn({
+				keepScreenOn: true
+			});
 		},
 		onUnload() {
 			// this.$refs.kkprinter.closeConnect()
+			// 保持屏幕常亮
+			uni.setKeepScreenOn({
+				keepScreenOn: false
+			});
+		},
+		onBackPress(event){
+			if(event.from == 'backbutton'){
+				if(this.isParinting){
+					uni.showToast({
+						icon:'none',
+						title: '正在打印中...'
+					})
+				}else{
+					uni.navigateBack({delta: 1})
+				}
+				return true  // 阻止默认返回行为(会导致无限循环)
+			}
 		},
 		methods: {
 			// 查询详情
@@ -111,6 +135,7 @@
 						_this.printIndex = 0
 						_this.$refs.kkprinter.onPrintSuccess()
 						_this.isParinting = false
+						_this.show = false
 					}
 				});
 			},
@@ -122,6 +147,7 @@
 					 	return
 					 }
 					 this.isParinting = true
+					 this.show = true
 					 this.printOnce(opt,tsc,blesdk,result[this.printIndex])
 				}else{
 					this.toashMsg("请选择产品!")
@@ -140,7 +166,7 @@
 	overflow: hidden;
 	padding-bottom: 102upx;
 	.replenishment-manualPrint-body{
-		> view{
+		.part-list{
 			padding: 10rpx 25rpx;
 			background-color: #fff;
 			margin-bottom: 20rpx;