init project
This commit is contained in:
172
pages/facialCapturing/index.js
Normal file
172
pages/facialCapturing/index.js
Normal file
@@ -0,0 +1,172 @@
|
||||
// pages/facialCapturing/index.js
|
||||
const app = getApp();
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
image: '../../images/19@3x.png',
|
||||
isPass: false,
|
||||
isDetail: false,
|
||||
info: {}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function(options) {
|
||||
this.setData({
|
||||
isPass: options.isPass ? true : false,
|
||||
isDetail: options.isDetail ? true : false,
|
||||
})
|
||||
this.getData()
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function() {},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function() {
|
||||
return {
|
||||
title: '智慧云馆'
|
||||
}
|
||||
},
|
||||
|
||||
// 拍照
|
||||
photograph() {
|
||||
this.getImage("camera")
|
||||
},
|
||||
|
||||
// 相册
|
||||
photoAlbum() {
|
||||
this.getImage("album")
|
||||
},
|
||||
|
||||
// 拍照或相册
|
||||
getImage(val) {
|
||||
let that = this;
|
||||
wx.chooseImage({
|
||||
count: 1,
|
||||
sizeType: ['compressed'],
|
||||
sourceType: [val],
|
||||
success: function(res) {
|
||||
wx.showLoading({
|
||||
title: '正在上传...',
|
||||
mask: true,
|
||||
})
|
||||
app.$api.memberFaceInfo({
|
||||
filePath: res.tempFilePaths[0]
|
||||
}).then(res => {
|
||||
wx.showToast({
|
||||
title: '上传成功',
|
||||
duration: 2000
|
||||
})
|
||||
that.getData()
|
||||
// if (that.data.isPass) {
|
||||
// setTimeout(function() {
|
||||
// that.pass();
|
||||
// }, 2000)
|
||||
// }
|
||||
}, err => {})
|
||||
},
|
||||
fail: function(res) {
|
||||
wx.hideLoading()
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
// 获取数据
|
||||
getData() {
|
||||
app.$api.memberFaceInfoInfos({}).then(res => {
|
||||
this.setData({
|
||||
info: res.info,
|
||||
image: res.info.faceUrl ? res.info.faceUrl : '../../images/19@3x.png'
|
||||
})
|
||||
}, err => {
|
||||
|
||||
})
|
||||
},
|
||||
|
||||
// 跳过
|
||||
pass() {
|
||||
let route = wx.getStorageSync('history');
|
||||
wx.removeStorageSync('history');
|
||||
if (!route || route == '/pages/login/index') {
|
||||
|
||||
const pages = getCurrentPages();
|
||||
if (pages.length > 1) {
|
||||
wx.navigateBack()
|
||||
} else {
|
||||
return wx.redirectTo({
|
||||
url: '/pages/mine/index',
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
wx.redirectTo({
|
||||
url: route,
|
||||
})
|
||||
},
|
||||
|
||||
saveClick() {
|
||||
if (this.data.isPass) {
|
||||
const _this = this;
|
||||
wx.showModal({
|
||||
title: '上传完成',
|
||||
content: '您已完成所有手机注册流程,请直接站在门禁人脸识别区域进行人脸识别入场',
|
||||
showCancel: false,
|
||||
success: function() {
|
||||
_this.pass();
|
||||
}
|
||||
})
|
||||
} else {
|
||||
wx.navigateBack()
|
||||
}
|
||||
|
||||
|
||||
// const pages = getCurrentPages();
|
||||
// const page = pages[pages.length - 2];
|
||||
// page.enter();
|
||||
//
|
||||
}
|
||||
})
|
||||
6
pages/facialCapturing/index.json
Normal file
6
pages/facialCapturing/index.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"navigationBarTitleText": "运动场馆入门人脸采集信息",
|
||||
"usingComponents": {
|
||||
"header": "/component/header/header"
|
||||
}
|
||||
}
|
||||
34
pages/facialCapturing/index.wxml
Normal file
34
pages/facialCapturing/index.wxml
Normal file
@@ -0,0 +1,34 @@
|
||||
<!--pages/facialCapturing/index.wxml-->
|
||||
<header title="运动场馆入门人脸采集信息"></header>
|
||||
<view class='container'>
|
||||
<view class='pass' bindtap='pass' wx:if="{{isPass}}">跳过</view>
|
||||
<view class='body'>
|
||||
<text wx:if="{{info.modifiedTime}}">上次采集时间: {{info.modifiedTime}}</text>
|
||||
<view class='img-box'>
|
||||
<image class='border-img' src='../../images/20@3x.png'></image>
|
||||
<image src='{{image}}' mode='aspectFit'></image>
|
||||
</view>
|
||||
<view class='state-box'>
|
||||
<text>说明:</text>
|
||||
<view class='state'>
|
||||
<text>1.照片仅用于场馆人脸识别入场</text>
|
||||
<text>2.请在光线明亮的环境下进行拍照</text>
|
||||
<text>3.每隔30天才能更新一次</text>
|
||||
<text>4.必须使用本人头像,否则将导致无法入场</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- <button class='register-btn' bindtap='saveClick' wx:if="{{isDetail && image != '../../images/19@3x.png'}}">我要入场</button> -->
|
||||
<!-- isDetail && -->
|
||||
<button class='register-btn' bindtap='saveClick' wx:if="{{image != '../../images/19@3x.png'}}">上传完成</button>
|
||||
</view>
|
||||
<view class='footer'>
|
||||
<view class='item-btn' bindtap='photograph'>
|
||||
<image src='../../images/18@3x.png' mode='aspectFit'></image>
|
||||
<text>拍照</text>
|
||||
</view>
|
||||
<view class='item-btn' bindtap='photoAlbum'>
|
||||
<image src='../../images/17@3x.png'></image>
|
||||
<text>相册</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
105
pages/facialCapturing/index.wxss
Normal file
105
pages/facialCapturing/index.wxss
Normal file
@@ -0,0 +1,105 @@
|
||||
/* pages/facialCapturing/index.wxss */
|
||||
|
||||
.container {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-height: calc(100vh - 280rpx);
|
||||
padding-bottom: 150rpx;
|
||||
}
|
||||
|
||||
.pass {
|
||||
position: absolute;
|
||||
top: 160rpx;
|
||||
right: 30rpx;
|
||||
width: 120rpx;
|
||||
height: 60rpx;
|
||||
line-height: 60rpx;
|
||||
border-radius: 30rpx;
|
||||
text-align: center;
|
||||
background: #3b3945;
|
||||
color: #FFF;
|
||||
font-size: 28rpx;
|
||||
}
|
||||
|
||||
.body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
font-size: 24rpx;
|
||||
line-height: 24rpx;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
|
||||
.body .img-box {
|
||||
position: relative;
|
||||
width: 500rpx;
|
||||
height: 500rpx;
|
||||
margin: 40rpx 0 30rpx 0;
|
||||
}
|
||||
|
||||
.body .img-box>image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.body .img-box .border-img {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
}
|
||||
|
||||
.body .state-box {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
.body .state-box .state {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.body .state-box .state>text {
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
|
||||
.footer {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
display: flex;
|
||||
width: 100%;
|
||||
height: 150rpx;
|
||||
background: #1a191e;
|
||||
}
|
||||
|
||||
.footer .item-btn {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
font-size: 26rpx;
|
||||
line-height: 26rpx;
|
||||
}
|
||||
|
||||
.footer .item-btn>image {
|
||||
width: 64rpx;
|
||||
height: 52rpx;
|
||||
margin-bottom: 18rpx;
|
||||
}
|
||||
|
||||
.register-btn {
|
||||
margin-top: 40rpx;
|
||||
width: 80%;
|
||||
height: 80rpx;
|
||||
border-radius: 40rpx;
|
||||
background: #ffda2e;
|
||||
color: #252330;
|
||||
font-size: 26rpx;
|
||||
line-height: 80rpx;
|
||||
}
|
||||
Reference in New Issue
Block a user