heyang 2 年之前
父节点
当前提交
fa6358a532
共有 2 个文件被更改,包括 138 次插入45 次删除
  1. 24 0
      api/index.js
  2. 114 45
      pages/fingerprint.vue

+ 24 - 0
api/index.js

@@ -33,6 +33,30 @@ export const fingerprintQueryList  = (data) => {
         method: 'GET',
     })
 };
+//指纹-查询当前用户已授权门禁列表
+export const fingerprintQeryMySubList  = (data) => {
+    return apiResquest({
+        url: `/laboratory/haikang/user/queryMySubList`,
+        method: 'GET',
+		data: data,
+    })
+};
+//指纹-指纹采集
+export const fingerprintGther  = (data) => {
+    return apiResquest({
+        url: `/laboratory/haikang/userFinger/capture/`+data.hardId+'/'+data.num,
+        method: 'POST',
+        data: {...data}
+    })
+};
+//指纹-指纹同步设备
+export const fingerprintGtherSync  = (data) => {
+    return apiResquest({
+        url: `/laboratory/haikang/userFinger/print/`+data,
+        method: 'POST',
+        data: {...data}
+    })
+};
 //气瓶列表-列表
 export const gasList  = (data) => {
     return apiResquest({

+ 114 - 45
pages/fingerprint.vue

@@ -2,14 +2,9 @@
 <template>
 	<view id="fingerprint">
 		<view class="fingerprint_one" v-if="pageType==1">
-			<view class="fingerprint_one_li" @click="goPage('add')">
-				<view class="fingerprint_one_li_l">指纹</view>
-				<view :class="!checked?'colorA':'colorB'">{{!checked?'无':'已配置'}}</view>
-				<img  class="fingerprint_one_li_r" src="@/images/icon_04.png">
-			</view>
-			<view class="fingerprint_one_li" @click="goPage('add')">
-				<view class="fingerprint_one_li_l">指纹</view>
-				<view :class="!checked?'colorA':'colorB'">{{!checked?'无':'已配置'}}</view>
+			<view class="fingerprint_one_li" @click="goPage('add')" v-for="item in fingerprintList">
+				<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/icon_04.png">
 			</view>
 		</view>
@@ -19,14 +14,14 @@
 		</view>
 		<view class="fingerprint_tow" v-if="pageType==2">
 			<view class="input_tip">请选择可采集的指纹门禁:</view>
-			<input class="input_search"  type="text" v-model="name" placeholder="请输入门禁名称" />
-			<view class="fingerprint_tow_border_li">
-				<view :class="checked?'colorC':'colorD'">实验室名称+门禁名称</view>
-				<img  class="fingerprint_tow_border_li_r" src="@/images/Version2.2/icon_xzwt_xz.png">
+			<input class="input_search"  type="text" v-model="dialogForm.searchValue" placeholder="请输入门禁名称" @blur="searchGuard()"/>
+			<view class="fingerprint_tow_border_li" v-for="item in yesUseList" @click="selectGuard(item)">
+				<view :class="item.isCheck?'colorD':'colorC'">{{item.subName +'+'+ item.hardName}}</view>
+				<img  v-if="item.isCheck" class="fingerprint_tow_border_li_r" src="@/images/Version2.2/icon_xzwt_xz.png">
 			</view>
 		</view>
 		<view v-if="pageType==1" class="tip_one">至少添加一个指纹才可以通过指纹开锁</view>
-		<view v-if="pageType==1" class="out-button" @click="clickOut">确定</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">
@@ -43,7 +38,7 @@
 
 <script>
     import { config } from '@/api/request/config.js'
-    import { } from '@/api/index.js'
+    import {fingerprintQeryMySubList,fingerprintGther,fingerprintQueryList,fingerprintGtherSync} from '@/api/index.js'
 	export default {
 		
 		data() {
@@ -54,11 +49,43 @@
 				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:[],
+				
 				
 			}
 		},
 		onLoad() {
-         
+			this.impowerUseList();
 		},
 		onShow(){
 			
@@ -66,43 +93,85 @@
 		},
 		
 		methods: {
+			//指紋采集
 			gather(){
 				 this.dialogVisible=true;
+				 this.fingerprintGtherFun()
 			},
 		   dialogClose(){
 			   this.dialogVisible=false;
 		   },
-		    //退出按钮
-            clickOut(){
-                let self = this;
-                uni.showModal({
-                    // title: '确认要退出吗?',
-                    content: '确认要退出吗',
-                    cancelColor:"#999",
-                    confirmColor:"#0183FA",
-                    success: function (res) {
-                        if (res.confirm) {
-                            self.logout();
-                            console.log('用户点击确定');
-                        } else if (res.cancel) {
-                            console.log('用户点击取消');
-                        }
-                    }
-                });
+		   searchGuard(){
+			   this.impowerUseList();
+		   },
+		   selectGuard(d){
+			  let _this=this;
+			  this.yesUseList.forEach(function(item){
+				  if(item.hardId==d.hardId){
+					   item.isCheck=!item.isCheck;
+					   item.subName='贺洋测试'
+				  }
+			  })
+			  
+			  console.log(this.yesUseList)
+		   },
+		   //查询用户指纹录取数据
+		   async fingerprintClick(){
+		   	let _this=this;
+		       const {data} = await fingerprintQueryList(uni.getStorageSync('userId'));
+		   	if(data.code == 200){
+		   		uni.navigateTo({
+		   			url: '/pages/fingerprint',//指纹信息
+		   		});
+		   	}
+		   },
+		   //指纹采集
+		   async fingerprintGtherFun(){
+		       let _this=this;
+			   let obj={}
+			   this.yesUseList.forEach(function(item){
+					  if(item.isCheck){
+						  obj.hardId=item.hardId
+						  obj.num=1
+					  }
+			   })
+		       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;
+					})
+				}
 			},
-			//退出登录
-            async logout() {
-                let self = this;
-                const {data} = await logout();
-                if(data.code == 200){
-                    uni.removeStorageSync('token');
-                    uni.removeStorageSync('userId');
-                    uni.removeStorageSync('userType');
-                    uni.redirectTo({
-                        url: '/pages/login',
-                    });
-                }
-            },
 			//页面跳转
             goPage(type){
                 if(type == 'add'){//学生卡上传