fingerprint.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <!-- 指纹 -->
  2. <template>
  3. <view id="fingerprint">
  4. <view class="fingerprint_one" v-if="pageType==1">
  5. <view class="fingerprint_one_li" @click="goPage('add')" v-for="item in fingerprintList">
  6. <view class="fingerprint_one_li_l">{{item.name}}</view>
  7. <view :class="item.isConfig?'colorB':'colorA'">{{item.isConfig?'已配置':'无'}}</view>
  8. <img class="fingerprint_one_li_r" src="@/images/icon_04.png">
  9. </view>
  10. </view>
  11. <view class="tip_tow" v-if="pageType==2">
  12. <view class="tip_tow_l">提醒</view>
  13. <view class="tip_tow_l">请选中门禁点击【指纹采集】并在当前门禁上录入指纹</view>
  14. </view>
  15. <view class="fingerprint_tow" v-if="pageType==2">
  16. <view class="input_tip">请选择可采集的指纹门禁:</view>
  17. <input class="input_search" type="text" v-model="dialogForm.searchValue" placeholder="请输入门禁名称" @blur="searchGuard()"/>
  18. <view class="fingerprint_tow_border_li" v-for="item in yesUseList" @click="selectGuard(item)">
  19. <view :class="item.isCheck?'colorD':'colorC'">{{item.subName +'+'+ item.hardName}}</view>
  20. <img v-if="item.isCheck" class="fingerprint_tow_border_li_r" src="@/images/Version2.2/icon_xzwt_xz.png">
  21. </view>
  22. </view>
  23. <view v-if="pageType==1" class="tip_one">至少添加一个指纹才可以通过指纹开锁</view>
  24. <view v-if="pageType==1" class="out-button" @click="fingerprintGtherSyncFun">确定</view>
  25. <view v-if="pageType==2" class="out-button" @click="gather">指纹采集</view>
  26. <!-- 指纹采集遮罩-->
  27. <view class="shade-outfire" v-if="dialogVisible">
  28. <view class="null-box" @click="dialogClose()"></view>
  29. <view class="shade-outfire-n">
  30. <view class="shade-outfire-n-t">门禁名称</view>
  31. <img class="shade-outfire-n-t2" src="@/images/icon_zw_bk.png" />
  32. <img class="shade-outfire-n-m" src="@/images/icon_wd_zw2.png" />
  33. <view class="shade-outfire-n-b">指纹采集中...</view>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { config } from '@/api/request/config.js'
  40. import {fingerprintQeryMySubList,fingerprintGther,fingerprintQueryList,fingerprintGtherSync} from '@/api/index.js'
  41. export default {
  42. data() {
  43. return {
  44. //页面状态
  45. pageType:1,
  46. //签名
  47. checked:true,
  48. name:'',
  49. dialogVisible:false,
  50. dialogForm:{
  51. searchValue:'',
  52. },
  53. fingerprintList:[
  54. {
  55. name:'第一个指纹',
  56. num:1,
  57. isConfig:false,
  58. },
  59. {
  60. name:'第二个指纹',
  61. num:2,
  62. isConfig:false,
  63. },
  64. {
  65. name:'第三个指纹',
  66. num:3,
  67. isConfig:false,
  68. },
  69. {
  70. name:'第四个指纹',
  71. num:4,
  72. isConfig:false,
  73. },
  74. {
  75. name:'第五个指纹',
  76. num:5,
  77. isConfig:false,
  78. },
  79. ],
  80. yesUseList:[],
  81. }
  82. },
  83. onLoad() {
  84. this.impowerUseList();
  85. },
  86. onShow(){
  87. },
  88. methods: {
  89. //指紋采集
  90. gather(){
  91. this.dialogVisible=true;
  92. this.fingerprintGtherFun()
  93. },
  94. dialogClose(){
  95. this.dialogVisible=false;
  96. },
  97. searchGuard(){
  98. this.impowerUseList();
  99. },
  100. selectGuard(d){
  101. let _this=this;
  102. this.yesUseList.forEach(function(item){
  103. if(item.hardId==d.hardId){
  104. item.isCheck=!item.isCheck;
  105. item.subName='贺洋测试'
  106. }
  107. })
  108. console.log(this.yesUseList)
  109. },
  110. //查询用户指纹录取数据
  111. async fingerprintClick(){
  112. let _this=this;
  113. const {data} = await fingerprintQueryList(uni.getStorageSync('userId'));
  114. if(data.code == 200){
  115. uni.navigateTo({
  116. url: '/pages/fingerprint',//指纹信息
  117. });
  118. }
  119. },
  120. //指纹采集
  121. async fingerprintGtherFun(){
  122. let _this=this;
  123. let obj={}
  124. this.yesUseList.forEach(function(item){
  125. if(item.isCheck){
  126. obj.hardId=item.hardId
  127. obj.num=1
  128. }
  129. })
  130. const {data} = await fingerprintGther(obj)
  131. if(data.code == 200){
  132. _this.dialogVisible=false;
  133. _this.pageType=1;
  134. _this.fingerprintClick();
  135. }else if(data.code==500){
  136. _this.dialogVisible=false;
  137. uni.showToast({
  138. mask:true,
  139. icon:"none",
  140. position:"center",
  141. title: data.msg,
  142. duration: 5000
  143. });
  144. }
  145. },
  146. //指纹同步
  147. async fingerprintGtherSyncFun(){
  148. let _this=this;
  149. const {data} = await fingerprintGtherSync(uni.getStorageSync('userId'))
  150. if(data.code == 200){
  151. uni.redirectTo({
  152. url: '/pages/mine',
  153. });
  154. }
  155. },
  156. //查询当前用户已授权门禁列表
  157. async impowerUseList(){
  158. let _this=this;
  159. const {data} = await fingerprintQeryMySubList(_this.dialogForm)
  160. if(data.code == 200){
  161. _this.yesUseList=data.data;
  162. _this.yesUseList.forEach(function(item){
  163. item.isCheck=false;
  164. })
  165. }
  166. },
  167. //页面跳转
  168. goPage(type){
  169. if(type == 'add'){//学生卡上传
  170. this.pageType=2;
  171. }
  172. },
  173. },
  174. }
  175. </script>
  176. <style lang="stylus" scoped>
  177. #fingerprint{
  178. height: 100%;
  179. width: 100%;
  180. display: flex;
  181. flex-direction: column;
  182. overflow-y: scroll;
  183. .fingerprint_one{
  184. width: 710rpx;
  185. height: 507rpx;
  186. background: #FFFFFF;
  187. border-radius: 20rpx;
  188. margin: 20rpx;
  189. .fingerprint_one_li{
  190. display: flex;
  191. justify-content: flex-start;
  192. align-items: center;
  193. height: 100rpx;
  194. margin: 0 20rpx;
  195. border-bottom: 1px solid #E0E0E0;
  196. .fingerprint_one_li_l{
  197. font-size: 30rpx;
  198. font-family: PingFang SC;
  199. font-weight: 500;
  200. color: #333333;
  201. text-align: left;
  202. flex: 1;
  203. }
  204. .fingerprint_one_li_r{
  205. width: 12rpx;
  206. height: 24rpx;
  207. }
  208. .colorA{
  209. font-size: 26rpx;
  210. font-family: PingFang SC;
  211. font-weight: 500;
  212. color: #999999;
  213. text-align: right;
  214. margin-right: 40rpx;
  215. flex: 1;
  216. }
  217. .colorB{
  218. font-size: 26rpx;
  219. font-family: PingFang SC;
  220. font-weight: 500;
  221. color: #0183FA;
  222. text-align: right;
  223. margin-right: 40rpx;
  224. flex: 1;
  225. }
  226. }
  227. }
  228. .tip_tow{
  229. margin: 10rpx 0;
  230. .tip_tow_l{
  231. font-size: 24rpx;
  232. font-family: PingFang SC;
  233. font-weight: 500;
  234. color: #FF0000;
  235. line-height: 36rpx;
  236. text-align: left;
  237. margin-left: 36rpx;
  238. }
  239. }
  240. .fingerprint_tow{
  241. width: 710rpx;
  242. background: #FFFFFF;
  243. border-radius: 10px;
  244. margin: 0 20rpx;
  245. padding: 0 20rpx;
  246. box-sizing: border-box;
  247. overflow: hidden;
  248. .input_tip{
  249. font-size: 30rpx;
  250. font-family: PingFang SC;
  251. font-weight: 500;
  252. color: #333333;
  253. line-height: 30rpx;
  254. margin: 34rpx 0;
  255. }
  256. .input_search{
  257. width: 670rpx;
  258. height: 80rpx;
  259. background: #FFFFFF;
  260. border: 1px solid #E0E0E0;
  261. border-radius: 10rpx;
  262. padding-left: 20rpx;
  263. box-sizing: border-box;
  264. margin-bottom: 32rpx;
  265. }
  266. .fingerprint_tow_border_li{
  267. height: 100rpx;
  268. display: flex;
  269. justify-content: space-between;
  270. align-items: center;
  271. margin: 0 20rpx;
  272. border-bottom: 1px solid #E0E0E0;
  273. .fingerprint_tow_border_li_l{}
  274. .fingerprint_tow_border_li_r{
  275. width: 30rpx;
  276. height: 20rpx;
  277. }
  278. .colorC{
  279. font-size: 30rpx;
  280. font-family: PingFang SC;
  281. font-weight: 500;
  282. color: #333333;
  283. }
  284. .colorD{
  285. font-size: 30rpx;
  286. font-family: PingFang SC;
  287. font-weight: 500;
  288. color: #0183FA;
  289. }
  290. }
  291. }
  292. .tip_one{
  293. font-size: 28rpx;
  294. font-family: PingFang SC;
  295. font-weight: 500;
  296. color: #FF0000;
  297. line-height: 30rpx;
  298. margin-top: 36rpx;
  299. text-align: center;
  300. }
  301. .out-button{
  302. position absolute
  303. bottom:140rpx;
  304. left:25rpx;
  305. width:700rpx;
  306. height:100rpx;
  307. line-height:100rpx;
  308. border-radius:10rpx;
  309. text-align center
  310. background #0183FA;
  311. color:#FFFFFF;
  312. font-size: 30rpx;
  313. margin:0 auto;
  314. }
  315. /* 指纹采集 */
  316. .shade-outfire {
  317. height: 100%;
  318. width: 100%;
  319. position: fixed;
  320. display: flex;
  321. flex-direction: column;
  322. z-index: 10;
  323. background: rgba(0, 0, 0, 0.2);
  324. .null-box {
  325. flex: 1;
  326. }
  327. .shade-outfire-n {
  328. width: 625rpx;
  329. height: 550rpx;
  330. background: #FFFFFF;
  331. border-radius: 20rpx;
  332. position: absolute;
  333. top: 370rpx;
  334. left: 62rpx;
  335. .shade-outfire-n-t {
  336. font-size: 30rpx;
  337. font-family: PingFang SC;
  338. font-weight: 500;
  339. color: #333333;
  340. text-align: center;
  341. margin-top: 32rpx;
  342. }
  343. .shade-outfire-n-t2 {
  344. width: 182rpx;
  345. height: 202rpx;
  346. position: absolute;
  347. left: 222rpx;
  348. top: 106rpx;
  349. }
  350. .shade-outfire-n-m {
  351. width: 84rpx;
  352. height: 108rpx;
  353. position: absolute;
  354. left: 266rpx;
  355. top: 150rpx;
  356. }
  357. .shade-outfire-n-b {
  358. width: 100%;
  359. font-size: 30rpx;
  360. font-family: PingFang SC;
  361. font-weight: 500;
  362. color: #0183FA;
  363. text-align: center;
  364. position: absolute;
  365. top: 358rpx;
  366. }
  367. }
  368. }
  369. }
  370. </style>