| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416 | <!-- 指纹 --><template>	<view id="fingerprint">		<view class="fingerprint_one" v-if="pageType==1">			<view class="fingerprint_one_li" @click="goPage(item)" v-for="(item,index) in fingerprintList" :key="index">				<view class="fingerprint_one_li_l">{{item.name}}</view>				<view :class="item.isConfig?'colorB':'colorA'">{{item.isConfig?'已配置':'无'}}</view>				<img  class="fingerprint_one_li_r" src="@/images/basicsModules/icon_04.png">			</view>		</view>		<view class="tip_tow" v-if="pageType==2">			<view class="tip_tow_l">提醒</view>			<view class="tip_tow_l">请选中门禁点击【指纹采集】并在当前门禁上录入指纹</view>		</view>		<view class="fingerprint_tow" v-if="pageType==2">			<view class="input_tip">请选择可采集的指纹门禁:</view>			<input class="input_search"  type="text" v-model="dialogForm.searchValue" placeholder="请输入门禁名称" @blur="searchGuard()"/>			<view class="fingerprint_tow_border_li" v-for="(item2,index2) in yesUseList" @click="selectGuard(item2,index2)" :key="index2">				<view :class="item2.isCheck?'colorD':'colorC'">{{item2.subName +'+'+ item2.hardName}}</view>				<img  v-if="item2.isCheck" class="fingerprint_tow_border_li_r" src="@/images/basicsModules/icon_xzwt_xz.png">			</view>		</view>		<view v-if="pageType==1" class="tip_one">至少添加一个指纹才可以通过指纹开锁</view>		<view v-if="pageType==1" class="out-button" @click="fingerprintGtherSyncFun">确定</view>		<view v-if="pageType==2" class="out-button" @click="gather">指纹采集</view>		<!-- 指纹采集遮罩-->		  <view class="shade-outfire" v-if="dialogVisible">			<view class="null-box" @click="dialogClose()"></view>			<view class="shade-outfire-n">			  <view class="shade-outfire-n-t">门禁名称</view>			  <img  class="shade-outfire-n-t2" src="@/page_basics/images/icon_zw_bk.png" />			  <img class="shade-outfire-n-m" src="@/page_basics/images/icon_wd_zw.png" />			  <view class="shade-outfire-n-b">指纹采集中...</view>			</view>		  </view>	</view></template><script>    import { config } from '@/api/request/config.js'    import {fingerprintQeryMySubList,fingerprintGther,fingerprintQueryList,fingerprintGtherSync} from '@/api/apiDemo/index.js'	export default {		data() {			return {				//页面状态				pageType:1,				//签名				checked:true,				name:'',				dialogVisible:false,				dialogForm:{					searchValue:'',				},				fingerprintList:[					{						name:'第一个指纹',						num:1,						isConfig:false,					},					{						name:'第二个指纹',						num:2,						isConfig:false,					},					{						name:'第三个指纹',						num:3,						isConfig:false,					},					{						name:'第四个指纹',						num:4,						isConfig:false,					},					{						name:'第五个指纹',						num:5,						isConfig:false,					},				],				yesUseList:[],				fingerNum:null,//第几个指纹			}		},		onLoad() {			this.impowerUseList();			this.fingerprintClick();		},		onShow(){		},		methods: {			//指紋采集			gather(){				let rest=this.yesUseList.some(v=>v.isCheck==true)				if(rest){					this.dialogVisible=true;					this.fingerprintGtherFun()				}else{					uni.showToast({							mask:true,							icon:"none",							position:"center",							title: '请先选择门禁名称!',							duration: 3000						});				}			},		   dialogClose(){			   this.dialogVisible=false;		   },		   searchGuard(){			   this.impowerUseList();		   },		   selectGuard(d,index){			   let _this=this;			   //选中				d.isCheck=!d.isCheck				this.$set(this.yesUseList,index,d)			 //循环实现单选			  if(_this.yesUseList[index].isCheck==true){			    _this.yesUseList.forEach(function(item2) {			      if(item2.hardId==_this.yesUseList[index].hardId){			        item2.isCheck=true			      }else{			        item2.isCheck=false			      }			    })			  }		   },		   //查询用户指纹录取数据		   async fingerprintClick(){		   	let _this=this;		       const {data} = await fingerprintQueryList(uni.getStorageSync('userId'));				if(data.code == 200){					if(data.rows.length>0){						_this.fingerprintList.forEach(function(item){							data.rows.forEach(function(item2){								if(item.num==item2.fingerNum){									item.isConfig=true;								}							})						})					}				}		   },		   //指纹采集		   async fingerprintGtherFun(){		       let _this=this;			   let obj={}			   this.yesUseList.forEach(function(item){					  if(item.isCheck){						  obj.hardId=item.hardId						  obj.num=_this.fingerNum					  }			   })		       const {data} = await fingerprintGther(obj)				if(data.code == 200){					_this.dialogVisible=false;					_this.pageType=1;					_this.fingerprintClick();				}else if(data.code==500){					_this.dialogVisible=false;					uni.showToast({						mask:true,						icon:"none",						position:"center",						title: data.msg,						duration: 5000					});				}		   },		   //指纹同步		   async fingerprintGtherSyncFun(){		       let _this=this;		       const {data} = await fingerprintGtherSync(uni.getStorageSync('userId'))					if(data.code == 200){						uni.redirectTo({						    url: '/pages/mine',						});					}		   },			//查询当前用户已授权门禁列表			async impowerUseList(){				let _this=this;			    const {data} = await fingerprintQeryMySubList(_this.dialogForm)				if(data.code == 200){					_this.yesUseList=data.data;					_this.yesUseList.forEach(function(item){						item.isCheck=false;					})				}			},			//页面跳转            goPage(d){                this.pageType=2;				this.fingerNum=d.num;			},		},	}</script><style lang="stylus" scoped>	#fingerprint{		height: 100%;		  width: 100%;		  display: flex;		  flex-direction: column;		  overflow-y: scroll;		.fingerprint_one{			width: 710rpx;			height: 507rpx;			background: #FFFFFF;			border-radius: 20rpx;			margin: 20rpx;			.fingerprint_one_li{				display: flex;				justify-content: flex-start;				align-items: center;				height: 100rpx;				margin: 0 20rpx;				border-bottom: 1px solid #E0E0E0;				.fingerprint_one_li_l{					font-size: 30rpx;					font-family: PingFang SC;					font-weight: 500;					color: #333333;					text-align: left;					flex: 1;				}				.fingerprint_one_li_r{					width: 12rpx;					height: 24rpx;				}				.colorA{					font-size: 26rpx;					font-family: PingFang SC;					font-weight: 500;					color: #999999;					text-align: right;					margin-right: 40rpx;					flex: 1;				}				.colorB{					font-size: 26rpx;					font-family: PingFang SC;					font-weight: 500;					color: #0183FA;					text-align: right;					margin-right: 40rpx;					flex: 1;				}			}			.fingerprint_one_li:last-child{				border-bottom: none;			}		}		.tip_tow{			margin: 10rpx 0;			.tip_tow_l{				font-size: 24rpx;				font-family: PingFang SC;				font-weight: 500;				color: #FF0000;				line-height: 36rpx;				text-align: left;				margin-left: 36rpx;			}		}		.fingerprint_tow{			width: 710rpx;			background: #FFFFFF;			border-radius: 10px;			margin: 0 20rpx;			padding: 0 20rpx;			box-sizing: border-box;			overflow: hidden;			.input_tip{				font-size: 30rpx;				font-family: PingFang SC;				font-weight: 500;				color: #333333;				line-height: 30rpx;				margin: 34rpx 0;			}			.input_search{				width: 670rpx;				height: 80rpx;				background: #FFFFFF;				border: 1px solid #E0E0E0;				border-radius: 10rpx;				padding-left: 20rpx;				box-sizing: border-box;				margin-bottom: 32rpx;			}			.fingerprint_tow_border_li{				height: 100rpx;				display: flex;				justify-content: space-between;				align-items: center;				margin: 0 20rpx;				border-bottom: 1px solid #E0E0E0;				.fingerprint_tow_border_li_l{}				.fingerprint_tow_border_li_r{					width: 30rpx;					height: 20rpx;				}				.colorC{					font-size: 30rpx;					font-family: PingFang SC;					font-weight: 500;					color: #333333;				}				.colorD{					font-size: 30rpx;					font-family: PingFang SC;					font-weight: 500;					color: #0183FA;				}			}			.fingerprint_tow_border_li:last-child{				border-bottom: none;			}		}		.tip_one{			font-size: 28rpx;			font-family: PingFang SC;			font-weight: 500;			color: #FF0000;			line-height: 30rpx;			margin-top: 36rpx;			text-align: center;		}		.out-button{			position absolute			bottom:140rpx;			left:25rpx;			width:700rpx;			height:100rpx;			line-height:100rpx;			border-radius:10rpx;			text-align center			background #0183FA;			color:#FFFFFF;			font-size: 30rpx;			margin:0 auto;		}	    /* 指纹采集 */	    .shade-outfire {	      height: 100%;	      width: 100%;	      position: fixed;	      display: flex;	      flex-direction: column;	      z-index: 10;	      background: rgba(0, 0, 0, 0.2);	      .null-box {	        flex: 1;	      }	      .shade-outfire-n {	        width: 625rpx;	        height: 550rpx;	        background: #FFFFFF;	        border-radius: 20rpx;	        position: absolute;	        top: 370rpx;	        left: 62rpx;	        .shade-outfire-n-t {				 font-size: 30rpx;				 font-family: PingFang SC;				 font-weight: 500;				 color: #333333;				 text-align: center;				 margin-top: 32rpx;	        }			.shade-outfire-n-t2 {			  width: 182rpx;			  height: 202rpx;			  position: absolute;			  left: 222rpx;			  top: 106rpx;			}	        .shade-outfire-n-m {	          width: 84rpx;	          height: 108rpx;	          position: absolute;	          left: 266rpx;	          top: 150rpx;	        }	        .shade-outfire-n-b {				width: 100%;	         font-size: 30rpx;	         font-family: PingFang SC;	         font-weight: 500;	         color: #0183FA;			 text-align: center;			 position: absolute;			 top: 358rpx;	        }	      }	    }	  }</style>
 |