Compare commits
2 Commits
ee10019aa1
...
faa20e9972
Author | SHA1 | Date |
---|---|---|
|
faa20e9972 | |
|
00d696e516 |
|
@ -0,0 +1,9 @@
|
||||||
|
baidu:
|
||||||
|
face:
|
||||||
|
app-id: 7034646
|
||||||
|
api-key: L3PiEzO9dMFJDExMTjOxuTtq
|
||||||
|
secret-key: 40LMey6WC1MYIqLU4m5Qe8K4foFUM1bc
|
||||||
|
similarity-threshold: 0.8
|
||||||
|
qps-limit-delay: 1000
|
||||||
|
max-retry-attempts: 3
|
||||||
|
retry-delay: 2000
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.yanzhu.common.core.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度人脸识别配置属性类
|
||||||
|
*
|
||||||
|
* @author yanzhu
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ConfigurationProperties(prefix = "baidu.face")
|
||||||
|
public class BaiduFaceProperties {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度人脸识别应用的App ID
|
||||||
|
*/
|
||||||
|
private String appId = "7034646";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度人脸识别应用的API Key
|
||||||
|
*/
|
||||||
|
private String apiKey = "L3PiEzO9dMFJDExMTjOxuTtq";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 百度人脸识别应用的Secret Key
|
||||||
|
*/
|
||||||
|
private String secretKey = "40LMey6WC1MYIqLU4m5Qe8K4foFUM1bc";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相似度阈值,大于此值认为是同一个人
|
||||||
|
*/
|
||||||
|
private double similarityThreshold = 0.8;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* QPS限制相关配置 - 延迟(毫秒)
|
||||||
|
*/
|
||||||
|
private int qpsLimitDelay = 1000;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大重试次数
|
||||||
|
*/
|
||||||
|
private int maxRetryAttempts = 3;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重试延迟(毫秒)
|
||||||
|
*/
|
||||||
|
private int retryDelay = 2000;
|
||||||
|
|
||||||
|
// Getter和Setter方法
|
||||||
|
|
||||||
|
public String getAppId() {
|
||||||
|
return appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAppId(String appId) {
|
||||||
|
this.appId = appId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getApiKey() {
|
||||||
|
return apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSecretKey() {
|
||||||
|
return secretKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecretKey(String secretKey) {
|
||||||
|
this.secretKey = secretKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getSimilarityThreshold() {
|
||||||
|
return similarityThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSimilarityThreshold(double similarityThreshold) {
|
||||||
|
this.similarityThreshold = similarityThreshold;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getQpsLimitDelay() {
|
||||||
|
return qpsLimitDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQpsLimitDelay(int qpsLimitDelay) {
|
||||||
|
this.qpsLimitDelay = qpsLimitDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getMaxRetryAttempts() {
|
||||||
|
return maxRetryAttempts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMaxRetryAttempts(int maxRetryAttempts) {
|
||||||
|
this.maxRetryAttempts = maxRetryAttempts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRetryDelay() {
|
||||||
|
return retryDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRetryDelay(int retryDelay) {
|
||||||
|
this.retryDelay = retryDelay;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.yanzhu.common.core.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核心模块配置类
|
||||||
|
*
|
||||||
|
* @author yanzhu
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan(basePackages = "com.yanzhu.common.core")
|
||||||
|
public class CoreConfig {
|
||||||
|
|
||||||
|
}
|
|
@ -2,7 +2,12 @@ package com.yanzhu.common.core.utils;
|
||||||
|
|
||||||
import com.baidu.aip.face.AipFace;
|
import com.baidu.aip.face.AipFace;
|
||||||
import com.baidu.aip.face.MatchRequest;
|
import com.baidu.aip.face.MatchRequest;
|
||||||
|
import com.yanzhu.common.core.config.BaiduFaceProperties;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
@ -16,28 +21,42 @@ import java.io.ByteArrayOutputStream;
|
||||||
*
|
*
|
||||||
* @author yanzhu
|
* @author yanzhu
|
||||||
*/
|
*/
|
||||||
|
@Component
|
||||||
public class BaiduFaceSimilarityUtils {
|
public class BaiduFaceSimilarityUtils {
|
||||||
|
|
||||||
// 百度人脸识别应用的API Key和Secret Key
|
@Autowired
|
||||||
private static final String APP_ID = "您的AppID"; // 需要设置有效的AppID
|
private BaiduFaceProperties baiduFaceProperties;
|
||||||
private static final String API_KEY = "L3PiEzO9dMFJDExMTjOxuTtq";
|
|
||||||
private static final String SECRET_KEY = "40LMey6WC1MYIqLU4m5Qe8K4foFUM1bc";
|
|
||||||
|
|
||||||
// 初始化AipFace客户端
|
// 初始化AipFace客户端
|
||||||
private static final AipFace client = new AipFace(APP_ID, API_KEY, SECRET_KEY);
|
private static AipFace client;
|
||||||
|
|
||||||
// 相似度阈值,大于此值认为是同一个人
|
// 相似度阈值,大于此值认为是同一个人
|
||||||
private static final double SIMILARITY_THRESHOLD = 0.8;
|
public static double SIMILARITY_THRESHOLD = 0.8;
|
||||||
|
|
||||||
// QPS限制相关常量
|
// QPS限制相关常量
|
||||||
private static final int QPS_LIMIT_DELAY = 1000; // 1秒延迟,避免QPS限制
|
private static int QPS_LIMIT_DELAY = 1000; // 1秒延迟,避免QPS限制
|
||||||
private static final int MAX_RETRY_ATTEMPTS = 3; // 最大重试次数
|
private static int MAX_RETRY_ATTEMPTS = 3; // 最大重试次数
|
||||||
private static final int RETRY_DELAY = 2000; // 重试延迟(毫秒)
|
private static int RETRY_DELAY = 2000; // 重试延迟(毫秒)
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
// 从配置中获取参数
|
||||||
|
String appId = baiduFaceProperties.getAppId();
|
||||||
|
String apiKey = baiduFaceProperties.getApiKey();
|
||||||
|
String secretKey = baiduFaceProperties.getSecretKey();
|
||||||
|
|
||||||
|
// 初始化AipFace客户端
|
||||||
|
client = new AipFace(appId, apiKey, secretKey);
|
||||||
|
|
||||||
static {
|
|
||||||
// 设置网络连接参数
|
// 设置网络连接参数
|
||||||
client.setConnectionTimeoutInMillis(2000);
|
client.setConnectionTimeoutInMillis(2000);
|
||||||
client.setSocketTimeoutInMillis(60000);
|
client.setSocketTimeoutInMillis(60000);
|
||||||
|
|
||||||
|
// 更新静态变量
|
||||||
|
SIMILARITY_THRESHOLD = baiduFaceProperties.getSimilarityThreshold();
|
||||||
|
QPS_LIMIT_DELAY = baiduFaceProperties.getQpsLimitDelay();
|
||||||
|
MAX_RETRY_ATTEMPTS = baiduFaceProperties.getMaxRetryAttempts();
|
||||||
|
RETRY_DELAY = baiduFaceProperties.getRetryDelay();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,18 +243,6 @@ public class BaiduFaceSimilarityUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设置API Key和Secret Key
|
|
||||||
*
|
|
||||||
* @param appId App ID
|
|
||||||
* @param apiKey API Key
|
|
||||||
* @param secretKey Secret Key
|
|
||||||
*/
|
|
||||||
public static void setCredentials(String appId, String apiKey, String secretKey) {
|
|
||||||
// 重新初始化AipFace客户端
|
|
||||||
// 注意:在实际应用中,应该通过配置文件或环境变量来设置这些密钥
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("开始测试人脸相似度算法...");
|
System.out.println("开始测试人脸相似度算法...");
|
||||||
|
|
||||||
|
@ -272,5 +279,4 @@ public class BaiduFaceSimilarityUtils {
|
||||||
|
|
||||||
System.out.println("\n测试完成。");
|
System.out.println("\n测试完成。");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,12 +3,16 @@ package com.yanzhu.common.security.config;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 系统配置
|
* 系统配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
|
@Configuration
|
||||||
|
@ComponentScan(basePackages = "com.yanzhu.common.core")
|
||||||
public class ApplicationConfig
|
public class ApplicationConfig
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class ProMobileAttendanceConfigController extends BaseController
|
||||||
double similarity = BaiduFaceSimilarityUtils.calculateFaceSimilarity(userPicture, attImg);
|
double similarity = BaiduFaceSimilarityUtils.calculateFaceSimilarity(userPicture, attImg);
|
||||||
System.out.println("相似度:"+similarity);
|
System.out.println("相似度:"+similarity);
|
||||||
|
|
||||||
double threshold = 0.8;
|
double threshold = BaiduFaceSimilarityUtils.SIMILARITY_THRESHOLD;
|
||||||
|
|
||||||
if (similarity >= threshold) {
|
if (similarity >= threshold) {
|
||||||
// 相似度达标,允许考勤
|
// 相似度达标,允许考勤
|
||||||
|
|
|
@ -4,29 +4,31 @@ Component({
|
||||||
* 组件的属性列表
|
* 组件的属性列表
|
||||||
*/
|
*/
|
||||||
properties: {
|
properties: {
|
||||||
title:{
|
title: {
|
||||||
type:String
|
type: String,
|
||||||
},
|
},
|
||||||
index:{
|
index: {
|
||||||
type:String
|
type: String,
|
||||||
},
|
},
|
||||||
choose:{
|
choose: {
|
||||||
type:String
|
type: String,
|
||||||
},
|
},
|
||||||
multiple:{
|
multiple: {
|
||||||
type:Boolean,
|
type: Boolean,
|
||||||
value:true
|
value: true,
|
||||||
},
|
},
|
||||||
rectifierData:{
|
rectifierData: {
|
||||||
type:Array,
|
type: Array,
|
||||||
value:[]
|
value: [],
|
||||||
}
|
observer: function (newVal, oldVal) {
|
||||||
|
// 当rectifierData变化时,重新初始化选中状态
|
||||||
|
this.initSelectedData(newVal);
|
||||||
},
|
},
|
||||||
observers: {
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
observers: {},
|
||||||
lifetimes: {
|
lifetimes: {
|
||||||
created: function(){
|
created: function () {
|
||||||
//在组件实例刚刚被创建时执行,注意此时不能调用 setData
|
//在组件实例刚刚被创建时执行,注意此时不能调用 setData
|
||||||
},
|
},
|
||||||
attached: function () {
|
attached: function () {
|
||||||
|
@ -34,6 +36,8 @@ Component({
|
||||||
},
|
},
|
||||||
ready: function () {
|
ready: function () {
|
||||||
// 在组件在视图层布局完成后执行
|
// 在组件在视图层布局完成后执行
|
||||||
|
// 初始化选中数据
|
||||||
|
this.initSelectedData(this.data.rectifierData);
|
||||||
},
|
},
|
||||||
detached: function () {
|
detached: function () {
|
||||||
// 在组件实例被从页面节点树移除时执行
|
// 在组件实例被从页面节点树移除时执行
|
||||||
|
@ -44,87 +48,138 @@ Component({
|
||||||
* 组件的初始数据
|
* 组件的初始数据
|
||||||
*/
|
*/
|
||||||
data: {
|
data: {
|
||||||
show:false,
|
show: false,
|
||||||
gridData:[],
|
gridData: [],
|
||||||
selectedIndex:[]
|
selectedIndex: [],
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组件的方法列表
|
* 组件的方法列表
|
||||||
*/
|
*/
|
||||||
methods: {
|
methods: {
|
||||||
onAddResponsible(){
|
// 初始化选中数据
|
||||||
this.setData({
|
initSelectedData(rectifierData) {
|
||||||
show:true
|
if (!rectifierData || rectifierData.length === 0) return;
|
||||||
})
|
|
||||||
},
|
let selectedIndex = [];
|
||||||
onClose(){
|
let chooses = "";
|
||||||
this.setData({
|
|
||||||
show:false
|
// 遍历数据,查找已选中的用户
|
||||||
})
|
rectifierData.forEach((group, groupIndex) => {
|
||||||
},
|
if (group.userList && group.userList.length > 0) {
|
||||||
onSelected(e){
|
group.userList.forEach((user, userIndex) => {
|
||||||
var data = this.data.rectifierData;
|
if (user.state === true) {
|
||||||
let ei = e.currentTarget.dataset.index;
|
// 记录选中项的索引
|
||||||
let index = ei.split('_');
|
selectedIndex.push(groupIndex + "_" + userIndex);
|
||||||
let userdata = data[index[0]].userList[index[1]];
|
|
||||||
let of = this.data.selectedIndex.indexOf(ei);
|
// 构建显示文本
|
||||||
if(of>-1){
|
let post = user.userPostName
|
||||||
this.data.selectedIndex.splice(of, 1);
|
? " [" + user.userPostName + "]"
|
||||||
userdata.state = false;
|
: "";
|
||||||
}else{
|
chooses += "," + user.userName + post;
|
||||||
this.data.selectedIndex.push(ei);
|
|
||||||
userdata.state = true;
|
|
||||||
}
|
}
|
||||||
if(!this.data.multiple && this.data.selectedIndex.length>0){
|
});
|
||||||
if(this.data.selectedIndex.length>1){
|
}
|
||||||
this.data.selectedIndex.forEach((item) =>{
|
});
|
||||||
let _indexs = item.split('_');
|
|
||||||
|
// 更新数据
|
||||||
|
this.setData({
|
||||||
|
selectedIndex: selectedIndex,
|
||||||
|
choose: chooses ? chooses.substring(1) : "",
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
onAddResponsible() {
|
||||||
|
this.setData({
|
||||||
|
show: true,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onClose() {
|
||||||
|
this.setData({
|
||||||
|
show: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
onSelected(e) {
|
||||||
|
// 使用深拷贝避免直接修改原始数据
|
||||||
|
const data = JSON.parse(JSON.stringify(this.data.rectifierData));
|
||||||
|
let ei = e.currentTarget.dataset.index;
|
||||||
|
let index = ei.split("_");
|
||||||
|
let userdata = data[index[0]].userList[index[1]];
|
||||||
|
let selectedIndex = [...this.data.selectedIndex];
|
||||||
|
let of = selectedIndex.indexOf(ei);
|
||||||
|
|
||||||
|
if (of > -1) {
|
||||||
|
// 取消选中
|
||||||
|
selectedIndex.splice(of, 1);
|
||||||
|
userdata.state = false;
|
||||||
|
} else {
|
||||||
|
// 选中
|
||||||
|
if (!this.data.multiple) {
|
||||||
|
// 单选模式,清空之前选中的项
|
||||||
|
selectedIndex.forEach((item) => {
|
||||||
|
let _indexs = item.split("_");
|
||||||
data[_indexs[0]].userList[_indexs[1]].state = false;
|
data[_indexs[0]].userList[_indexs[1]].state = false;
|
||||||
});
|
});
|
||||||
|
selectedIndex = [ei];
|
||||||
|
} else {
|
||||||
|
// 多选模式
|
||||||
|
selectedIndex.push(ei);
|
||||||
|
}
|
||||||
userdata.state = true;
|
userdata.state = true;
|
||||||
this.data.selectedIndex=[];
|
|
||||||
this.data.selectedIndex.push(ei);
|
|
||||||
}
|
|
||||||
let _post="";
|
|
||||||
if(userdata.userPostName){
|
|
||||||
_post = " ["+userdata.userPostName+"]";
|
|
||||||
}
|
|
||||||
let _gridData=[{'userId':userdata.userId,'userName':userdata.userName+_post,'userPhone':userdata.userPhone}];
|
|
||||||
this.triggerEvent('selected',_gridData)
|
|
||||||
this.setData({
|
|
||||||
choose:_gridData[0].userName,
|
|
||||||
rectifierData:data,
|
|
||||||
show:false
|
|
||||||
})
|
|
||||||
}else{
|
|
||||||
this.setData({
|
|
||||||
rectifierData : data
|
|
||||||
})
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onConfirm(){
|
|
||||||
var data = this.data.rectifierData;
|
|
||||||
let _gridData=[];
|
|
||||||
let chooses="";
|
|
||||||
if(this.data.selectedIndex.length>0){
|
|
||||||
this.data.selectedIndex.forEach((item) =>{
|
|
||||||
let _indexs = item.split('_');
|
|
||||||
let _post="";
|
|
||||||
if(data[_indexs[0]].userList[_indexs[1]].userPostName){
|
|
||||||
_post = " ["+data[_indexs[0]].userList[_indexs[1]].userPostName+"]";
|
|
||||||
}
|
|
||||||
let name = data[_indexs[0]].userList[_indexs[1]].userName+_post;
|
|
||||||
_gridData.push({'userId':data[_indexs[0]].userList[_indexs[1]].userId,'userName':name,'userPhone':data[_indexs[0]].userList[_indexs[1]].userPhone});
|
|
||||||
chooses+=","+name;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
this.triggerEvent('selected',_gridData)
|
|
||||||
this.setData({
|
|
||||||
choose:chooses.substring(1),
|
|
||||||
show:false
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 如果是单选模式且有选中项,直接触发事件并关闭弹窗
|
||||||
|
if (!this.data.multiple && selectedIndex.length > 0) {
|
||||||
|
let _post = userdata.userPostName
|
||||||
|
? " [" + userdata.userPostName + "]"
|
||||||
|
: "";
|
||||||
|
let _gridData = [
|
||||||
|
{
|
||||||
|
userId: userdata.userId,
|
||||||
|
userName: userdata.userName + _post,
|
||||||
|
userPhone: userdata.userPhone,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
this.triggerEvent("selected", _gridData);
|
||||||
|
this.setData({
|
||||||
|
choose: _gridData[0].userName,
|
||||||
|
rectifierData: data,
|
||||||
|
selectedIndex: selectedIndex,
|
||||||
|
show: false,
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
this.setData({
|
||||||
|
rectifierData: data,
|
||||||
|
selectedIndex: selectedIndex,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
})
|
},
|
||||||
|
onConfirm() {
|
||||||
|
const data = this.data.rectifierData;
|
||||||
|
let _gridData = [];
|
||||||
|
let chooses = "";
|
||||||
|
if (this.data.selectedIndex.length > 0) {
|
||||||
|
this.data.selectedIndex.forEach((item) => {
|
||||||
|
let _indexs = item.split("_");
|
||||||
|
let _post = "";
|
||||||
|
if (data[_indexs[0]].userList[_indexs[1]].userPostName) {
|
||||||
|
_post =
|
||||||
|
" [" + data[_indexs[0]].userList[_indexs[1]].userPostName + "]";
|
||||||
|
}
|
||||||
|
let name = data[_indexs[0]].userList[_indexs[1]].userName + _post;
|
||||||
|
_gridData.push({
|
||||||
|
userId: data[_indexs[0]].userList[_indexs[1]].userId,
|
||||||
|
userName: name,
|
||||||
|
userPhone: data[_indexs[0]].userList[_indexs[1]].userPhone,
|
||||||
|
});
|
||||||
|
chooses += "," + name;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.triggerEvent("selected", _gridData);
|
||||||
|
this.setData({
|
||||||
|
choose: chooses.substring(1),
|
||||||
|
show: false,
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
@ -381,7 +381,18 @@ Page({
|
||||||
app.toast("考勤成功");
|
app.toast("考勤成功");
|
||||||
this.returnToPage();
|
this.returnToPage();
|
||||||
} else {
|
} else {
|
||||||
app.toast("考勤失败: " + res.msg);
|
// 显示确认框,提供更友好的错误提示
|
||||||
|
wx.showModal({
|
||||||
|
title: "考勤失败",
|
||||||
|
content: res.msg || "考勤提交失败,请稍后重试",
|
||||||
|
showCancel: false, // 只显示确定按钮
|
||||||
|
confirmColor: "#ff0000", // 深色确认按钮
|
||||||
|
confirmText: "确定",
|
||||||
|
success: function (res) {
|
||||||
|
// 用户点击确定按钮后返回考勤列表页面
|
||||||
|
this.returnToPage();
|
||||||
|
}.bind(this),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -66,8 +66,8 @@
|
||||||
<text class="txt-blue"> 考勤人像刷脸</text>
|
<text class="txt-blue"> 考勤人像刷脸</text>
|
||||||
</view>
|
</view>
|
||||||
<view class="content_box_content att-img">
|
<view class="content_box_content att-img">
|
||||||
<image src="{{faceImage}}" mode="aspectFit" wx:if="{{faceImage}}" />
|
<image src="{{faceImage}}" mode="aspectFit" bindtap="openCamera" wx:if="{{faceImage}}" />
|
||||||
<view wx:else class="placeholder-text">拍照后显示图片</view>
|
<view wx:else class="placeholder-text" bindtap="openCamera">拍照后显示图片</view>
|
||||||
<button bindtap="openCamera">点击打开摄像头刷脸</button>
|
<button bindtap="openCamera">点击打开摄像头刷脸</button>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
|
@ -95,7 +95,7 @@ Page({
|
||||||
form.address = cfgData.address;
|
form.address = cfgData.address;
|
||||||
form.range = cfgData.range;
|
form.range = cfgData.range;
|
||||||
let groupList = (cfgData.groupList || []).map((it) => {
|
let groupList = (cfgData.groupList || []).map((it) => {
|
||||||
it.status = true;
|
it.state = true;
|
||||||
it.userId = it.id;
|
it.userId = it.id;
|
||||||
it.userName = it.groupName;
|
it.userName = it.groupName;
|
||||||
it.subDeptName = it.deptName;
|
it.subDeptName = it.deptName;
|
||||||
|
@ -129,6 +129,10 @@ Page({
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
if (res.code == 200) {
|
if (res.code == 200) {
|
||||||
let tmps = res.rows || [];
|
let tmps = res.rows || [];
|
||||||
|
let findIds = [];
|
||||||
|
if (this.data.cfgData) {
|
||||||
|
findIds = this.data.form.subGroup.map((it) => it.id);
|
||||||
|
}
|
||||||
this.setData({
|
this.setData({
|
||||||
groupList: tmps,
|
groupList: tmps,
|
||||||
});
|
});
|
||||||
|
@ -153,7 +157,7 @@ Page({
|
||||||
subDeptType: val.subDeptType,
|
subDeptType: val.subDeptType,
|
||||||
subDeptTypeName: deptType?.dictLabel || "",
|
subDeptTypeName: deptType?.dictLabel || "",
|
||||||
userList: obj[key].map((it) => {
|
userList: obj[key].map((it) => {
|
||||||
it.status = false;
|
it.state = findIds.includes(it.id);
|
||||||
it.userId = it.id;
|
it.userId = it.id;
|
||||||
it.userName = it.groupName;
|
it.userName = it.groupName;
|
||||||
return it;
|
return it;
|
||||||
|
|
Loading…
Reference in New Issue