chen 2 лет назад
Родитель
Сommit
72e59eb2a4
2 измененных файлов с 66 добавлено и 10 удалено
  1. 2 2
      manifest.json
  2. 64 8
      pages/index/index1.vue

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "数智化产线",
     "appid" : "__UNI__12102E1",
     "description" : "",
-    "versionName" : "1.0.2",
-    "versionCode" : 102,
+    "versionName" : "1.0.3",
+    "versionCode" : 103,
     "transformPx" : false,
     "app-plus" : {
         /* 5+App特有相关 */

+ 64 - 8
pages/index/index1.vue

@@ -57,9 +57,27 @@
 		
 		<!-- 提示信息弹窗 -->
 		<uni-popup ref="message" type="message">
-			<uni-popup-message :type="msgType" fontSizt="30px" :message="messageText" :duration="3000"></uni-popup-message>
+			<uni-popup-message :type="msgType" fontSizt="76rpx" :message="messageText" :duration="3000"></uni-popup-message>
 		</uni-popup>
 		
+		<!-- 普通弹窗 -->
+		<uni-popup ref="popup" type="center"  background-color="#fff" :mask-click="false" >
+			<view class="popup-content popup-height" >
+				<view style="margin: 100rpx 400rpx 200rpx; 400rpx;">
+					<view style="margin: 200rpx 0;font-size:76rpx;">产品000020009528-010010142308AI检测为NG,请确认</view>
+					<view style="margin-bottom: 200rpx;">
+						<uni-row :gutter="100">
+							<uni-col :span="12">
+								<button class="mini-btn" type="default" style="font-size: 60rpx;" @click="productOkOrNg(0)" :loading="btnLoad" :disabled="btnLoad">AI误判</button>
+							</uni-col>
+							<uni-col :span="12">
+								<button class="mini-btn" type="primary" style="font-size: 60rpx;" @click="productOkOrNg(1)" :loading="btnLoad" :disabled="btnLoad">发起维修</button>
+							</uni-col>
+						</uni-row>
+					</view>
+				</view>
+			</view>
+		</uni-popup>
 		
 	</view>
 </template>
@@ -87,6 +105,9 @@
 				imgUrl:'',//https://ai.my-123.cn/pic/product-line/upload/20231218/d0dde7a200584e6cdb2e2f02622b9948.jpg
 				msgType:'',
 				messageText:'',
+				contentText:'',
+				productId:'',
+				btnLoad:false,
 				webSocketStatus:0,
 			}
 		},
@@ -118,21 +139,32 @@
 				})
 				plus.globalEvent.addEventListener('onMessage', function(e) {
 					debugger
-					const data = JSON.parse(e.data);
-					console.log("监听接收的信息:" + data);
+					const data = JSON.parse(e.data.replace(/\"productId\":(\d+)/, '"productId": "$1"'));
+					console.log("监听接收的信息:" + e.data);
+					console.log( data);
 					
 					if(data.eqSn==that.eqSn){
-						that.imgUrl = data.productImage
+						that.productInfoClean();
+						if(data.productId){
+							that.productId = data.productId
+							console.log("产品ID:"+that.productId)
+						}
+						that.imgUrl = data.productAiImage?data.productAiImage:data.productImage
 						that.msgType = data.status==1?'success':'error'
 						that.messageText = data.message
 						that.$refs.message.open()
+						if(data.isNg==1){
+							that.contentText = "产品"+data.qrCode+"AI检测为NG,请确认"
+							that.$refs.popup.open('center')
+						}else{
+							that.$refs.popup.close()
+						}
 						that.getData(1)
 						
 						let innerAudioContext = uni.createInnerAudioContext();
 						innerAudioContext.src = data.status==1?'../../static/cg.mp3':'../../static/sb.mp3';
 						innerAudioContext.play();
 						innerAudioContext.onPause(function() {
-						   uni.$console.info('end');      
 						  innerAudioContext.destroy();//音频播放停止后,就销毁实例  
 						});
 					}
@@ -153,7 +185,7 @@
 						eqSn_equal: that.eqSn
 					}
 				that.api.request(url, params, "get").then((res) => {
-					console.log(res)
+					// console.log(res)
 					that.tableData = res.records
 					that.total = res.total
 					that.loading = false
@@ -173,8 +205,32 @@
 				// })
 			},
 			clickRow(item,index){
-				this.imgUrl = item.productImage
-			}
+				this.imgUrl = item.productAiImage?item.productAiImage:item.productImage
+			},
+			productOkOrNg(isNg){
+				this.btnLoad = true;
+				let that = this,
+				url = "app/api/productOkOrNg",
+				params = {
+					productId:that.productId,
+					aiImg:that.imgUrl,
+					isNg:isNg,
+				}
+				that.api.request(url, params, "get").then((res) => {
+					// uni.showToast({
+					// 	title: '操作成功',
+					// 	duration: 2000
+					// });
+					that.productInfoClean();
+					this.$refs.popup.close()
+				}).catch((res) => {
+					that.btnLoad = false;
+				})
+			},
+			productInfoClean(){
+				this.productId='';
+				this.btnLoad = false;
+			},
 		}
 	}
 </script>