dedsudiyu hace 11 meses
padre
commit
07cc68aced
Se han modificado 2 ficheros con 36 adiciones y 34 borrados
  1. 34 32
      pages/views/saoCode/scan.vue
  2. 2 2
      utils/homeConfig.js

+ 34 - 32
pages/views/saoCode/scan.vue

@@ -3,8 +3,7 @@
 	<view>
 		<view class="scanCode_box">
 			<view class="title">请扫描设备二维码</view>
-			<camera class='camera' mode="scanCode" @error="cameraError" @scancode='scancode'
-				frame-size='large'>
+			<camera class='camera' mode="scanCode" @error="cameraError" @scancode='scancode' frame-size='large'>
 				<cover-view class='animation' :animation="animation"></cover-view>
 			</camera>
 			<view @click="manualFun()" class="manual">手动选择设备</view>
@@ -13,17 +12,17 @@
 </template>
 <script>
 	let animation = uni.createAnimation({});
-	
+
 	export default {
 		data() {
 			return {
 				animation,
-				form:{},
+				form: {},
 			}
 		},
 		onLoad(option) {
-			if(option.form){
-				this.form=JSON.parse(decodeURIComponent(option.form));
+			if (option.form) {
+				this.form = JSON.parse(decodeURIComponent(option.form));
 			}
 		},
 		onShow() {
@@ -45,43 +44,42 @@
 						})
 						scode = !scode;
 					}
-						that.animation = animation.export()
-					
+					that.animation = animation.export()
+
 				}.bind(this), 3000)
 			},
 			//手动选择设备
-			manualFun(){
+			manualFun() {
 				uni.redirectTo({
-				    url: '/pages_safetyExamine/examineManage/examineAddContent?form='+encodeURIComponent(JSON.stringify(this.form))+'&pageType=3'
+					url: '/pages_safetyExamine/examineManage/examineAddContent?form=' + encodeURIComponent(JSON.stringify(this
+						.form)) + '&pageType=3'
 				});
 			},
-			scancode(e){
-				let self=this;
-			    // 扫描结果
+			scancode(e) {
+				let self = this;
 				let text = decodeURIComponent(e.detail.result)
 				let list = text.split("?")[1].split("&");
-				for(let i=0;i<list.length;i++){
-				    let newList = list[i].split("=");
-				    if(newList[0] == 'code'){
-				        self.code = newList[1];
-				    }else if(newList[0] == 'type'){
-				        self.type = newList[1];
-				    }
-				}
-				let joinHazardIds=[];
-				if(this.form.hazardIds){
-					joinHazardIds=this.form.hazardIds.split(',')
+				let codeData = {};
+				list.forEach((item) => {
+					codeData[item.split("=")[0]] = item.split("=")[1];
+				})
+				self.code = codeData.code;
+				self.type = codeData.type;
+				let joinHazardIds = [];
+				if (this.form.hazardIds) {
+					joinHazardIds = this.form.hazardIds.split(',')
 					joinHazardIds.push(self.code)
-					this.form.joinHazardIds=joinHazardIds
-				}else{
-					this.form.joinHazardIds=self.code
+					this.form.joinHazardIds = joinHazardIds
+				} else {
+					this.form.joinHazardIds = self.code
 				}
 				uni.navigateTo({
-					url: '/pages_safetyExamine/views/examineManage/examineAddTow?form='+encodeURIComponent(JSON.stringify(this.form))+'&joinHazardIds='+self.code
+					url: '/pages_safetyExamine/views/examineManage/examineAddTow?form=' + encodeURIComponent(JSON.stringify(
+						this.form)) + '&joinHazardIds=' + self.code
 				});
-			  }
+			}
 		}
-	
+
 	}
 </script>
 <style>
@@ -94,7 +92,8 @@
 		position: fixed;
 		align-items: center;
 	}
-	.title{
+
+	.title {
 		font-size: 34rpx;
 		font-family: PingFang SC-Medium, PingFang SC;
 		font-weight: 400;
@@ -103,6 +102,7 @@
 		margin-top: 256rpx;
 		text-align: center;
 	}
+
 	.camera {
 		width: 433rpx;
 		height: 434rpx;
@@ -110,6 +110,7 @@
 		margin: 30rpx;
 		overflow: hidden;
 	}
+
 	.animation {
 		position: absolute;
 		top: 10rpx;
@@ -119,7 +120,8 @@
 		background-color: #4CD964;
 		border-radius: 50%;
 	}
-	.manual{
+
+	.manual {
 		width: 300rpx;
 		height: 100rpx;
 		background: #0183FA;

+ 2 - 2
utils/homeConfig.js

@@ -2,7 +2,7 @@ let routeDataList = [
 	//原教职工
 	{
 		name: "随手拍",
-		limits:"demo",
+		limits:"",
 		route: "snapshotManage",
 		routeUrl: "/pages_safetyExamine/views/snapshotManage/snapshotAdd",
 		img: require('@/images/commonality/icon_sy_ssp.png'),
@@ -10,7 +10,7 @@ let routeDataList = [
 	},
 	{
 		name: "安全检查",
-		limits:"demo",
+		limits:"",
 		route: "safetyExamine",
 		routeUrl: "/pages_safetyExamine/views/safetyExamineWorkbench",
 		img: require('@/images/commonality/icon_sy_aqjc.png'),