This commit is contained in:
parent
bd19e3fc5f
commit
8020780cdc
|
|
@ -26,6 +26,7 @@
|
|||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"image-tools": "^1.4.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
|
|
@ -7790,6 +7791,12 @@
|
|||
"node": ">= 4"
|
||||
}
|
||||
},
|
||||
"node_modules/image-tools": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/image-tools/-/image-tools-1.4.0.tgz",
|
||||
"integrity": "sha512-TKtvJ6iUwM0mfaD4keMnk1ENHFC470QEjBfA3IlvKdEOufzvWbjbaoNcoyYq6HlViF8+d5tOS1ooE6j7CHf1lQ==",
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/immutable": {
|
||||
"version": "4.3.7",
|
||||
"resolved": "https://repo.huaweicloud.com/repository/npm/immutable/-/immutable-4.3.7.tgz",
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@
|
|||
"clipboard": "^2.0.11",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"image-tools": "^1.4.0",
|
||||
"lodash-es": "^4.17.21",
|
||||
"pinia": "^2.3.0",
|
||||
"pinia-plugin-persistedstate": "^4.2.0",
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@
|
|||
size="small"
|
||||
type="primary"
|
||||
text="识别身份证(人像)"
|
||||
@tap="onHandleRecognizeIdCard"
|
||||
@tap="onHandleRecognizeIdCard(1)"
|
||||
/>
|
||||
</template>
|
||||
</up-cell>
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
size="small"
|
||||
type="primary"
|
||||
text="识别身份证(国徽)"
|
||||
@tap="onHandleRecognizeIdCard"
|
||||
@tap="onHandleRecognizeIdCard(2)"
|
||||
/>
|
||||
</template>
|
||||
</up-cell>
|
||||
|
|
@ -153,6 +153,10 @@
|
|||
|
||||
<script setup name="personIdCardForm">
|
||||
import { ref, watch } from 'vue'
|
||||
import { pathToBase64 } from 'image-tools'
|
||||
import { useMemberStore } from '@/stores'
|
||||
|
||||
const memberStore = useMemberStore()
|
||||
const idCardFormRef = ref(null) // 身份证表单ref
|
||||
const idCardModel = ref({
|
||||
age: '',
|
||||
|
|
@ -322,11 +326,67 @@ const onCancelBirthday = () => {
|
|||
showPikerBirthday.value = false
|
||||
}
|
||||
|
||||
// 识别身份证(人像面)
|
||||
const onHandleRecognizeIdCard = () => {
|
||||
const imgToBase64Fun = async (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(path)
|
||||
.then((base64) => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 识别身份证(人像面和国徽面)
|
||||
const onHandleRecognizeIdCard = (type) => {
|
||||
// 1人像面 2国徽面
|
||||
// console.log('识别身份证(人像面)')
|
||||
|
||||
uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
|
||||
return
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: async (res) => {
|
||||
const base64 = await imgToBase64Fun(res.tempFilePaths[0])
|
||||
const param = {
|
||||
imageBase64: base64.split(',')[1],
|
||||
}
|
||||
|
||||
// 上传后台接口
|
||||
uni.request({
|
||||
url: '/bmw/appRecognition/bankCardRecognition',
|
||||
method: 'POST',
|
||||
data: param,
|
||||
header: {
|
||||
// 'Content-Type': 'application/Json',
|
||||
Authorization: memberStore?.token, // token
|
||||
},
|
||||
success: (res) => {
|
||||
const { data: result } = res
|
||||
if (result.code === 200) {
|
||||
uni.$u.toast('识别身份证成功')
|
||||
} else {
|
||||
uni.$u.toast('识别身份证失败,请重新识别')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
console.log(err, '----识别身份证失败')
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.$u.toast({
|
||||
// title: '选择图片失败',
|
||||
// icon: 'none',
|
||||
// })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 表单校验
|
||||
|
|
|
|||
|
|
@ -84,13 +84,27 @@
|
|||
<text> 1: 未完成工资卡上传为【黄灯人员】</text>
|
||||
<text> 2: 生成工资册之前必须上传工资卡</text>
|
||||
</view>
|
||||
|
||||
<up-loading-icon
|
||||
:vertical="true"
|
||||
duration="2000"
|
||||
color="#3c9cff"
|
||||
:show="showLoading"
|
||||
textColor="#3c9cff"
|
||||
text="正在识别中,请稍后..."
|
||||
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%)"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="wageCardForm">
|
||||
import { ref, watch } from 'vue'
|
||||
import { pathToBase64 } from 'image-tools'
|
||||
import { useMemberStore } from '@/stores'
|
||||
|
||||
const memberStore = useMemberStore()
|
||||
const wageCardFormRef = ref(null) // 工资卡见证表单ref
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
const wageCardInfoForm = ref({
|
||||
bankName: '', // 银行名称
|
||||
|
|
@ -250,9 +264,63 @@ const updateWageCardInfo = () => {
|
|||
Object.assign(wageCardInfoForm.value, props.wageCardInfo)
|
||||
}
|
||||
|
||||
const imgToBase64Fun = async (path) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(path)
|
||||
.then((base64) => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 银行卡号识别
|
||||
const onHandleRecognizeBankCard = () => {
|
||||
uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: async (res) => {
|
||||
showLoading.value = true
|
||||
const base64 = await imgToBase64Fun(res.tempFilePaths[0])
|
||||
const param = {
|
||||
imageBase64: base64.split(',')[1],
|
||||
}
|
||||
// 上传后台接口
|
||||
uni.request({
|
||||
url: '/bmw/appRecognition/bankCardRecognition',
|
||||
method: 'POST',
|
||||
data: param,
|
||||
header: {
|
||||
Authorization: memberStore?.token, // token
|
||||
},
|
||||
success: (res) => {
|
||||
showLoading.value = false
|
||||
const { data: result } = res
|
||||
if (result.code === 200) {
|
||||
const { bankCard, bankName } = result.data
|
||||
wageCardInfoForm.value.bankCardCode = bankCard
|
||||
wageCardInfoForm.value.bankName = bankName
|
||||
} else {
|
||||
uni.$u.toast('识别银行卡失败,请重新识别')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('识别银行卡失败,请重新识别')
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.$u.toast({
|
||||
// title: '选择图片失败',
|
||||
// icon: 'none',
|
||||
// })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
// 向父组件暴露方法
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<template>
|
||||
<!-- 考勤打卡页面 -->
|
||||
<view class="attendance-container">
|
||||
<view class="attendance-container app-container">
|
||||
<view class="project-name"> {{ activeProjectName }}</view>
|
||||
|
||||
<view class="attendance-content">
|
||||
|
|
@ -32,18 +32,31 @@
|
|||
</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<up-loading-icon
|
||||
:vertical="true"
|
||||
duration="2000"
|
||||
color="#3c9cff"
|
||||
:show="showLoading"
|
||||
textColor="#3c9cff"
|
||||
text="正在识别中,请稍后..."
|
||||
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%)"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup name="Attendance">
|
||||
import { ref, onMounted, onBeforeUnmount } from 'vue'
|
||||
import { useCommonStore } from '@/stores'
|
||||
import { useCommonStore, useMemberStore } from '@/stores'
|
||||
import { pathToBase64 } from 'image-tools'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
const commonStore = useCommonStore()
|
||||
const memberStore = useMemberStore()
|
||||
const currentTime = ref('') //获取当前的时分秒时间
|
||||
const timeInterval = ref(null) //定时器
|
||||
const activeProjectName = ref('') // 当前选择的工程名称
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
// 打卡记录
|
||||
const onAttendanceRecord = () => {
|
||||
|
|
@ -66,7 +79,82 @@ const onAttendanceHandle = () => {
|
|||
// icon: 'none',
|
||||
// })
|
||||
|
||||
uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: (res) => {
|
||||
showLoading.value = true
|
||||
const files = [
|
||||
{
|
||||
file: res.tempFiles[0],
|
||||
name: 'file',
|
||||
},
|
||||
]
|
||||
|
||||
// 先调人脸识别接口检查人脸是否合规
|
||||
uni.uploadFile({
|
||||
url: '/api/bmw/appRecognition/getFaceRecognition',
|
||||
files: files,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
showLoading.value = false
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.code === 200) {
|
||||
uni.$u.toast('人脸识别成功')
|
||||
|
||||
// 人脸识别成功后调用打卡接口
|
||||
uni.uploadFile({
|
||||
url: '/api/bmw/appRecognition/appPlayCard',
|
||||
files: files,
|
||||
name: 'file',
|
||||
formData: {
|
||||
params: JSON.stringify({
|
||||
idNumber: data.data.idNumber,
|
||||
}),
|
||||
},
|
||||
success: (res) => {
|
||||
const result = JSON.parse(res.data)
|
||||
if (result.code === 200) {
|
||||
uni.$u.toast('打卡成功')
|
||||
} else {
|
||||
uni.$u.toast('打卡失败:' + result.msg)
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast('打卡失败:' + err.msg)
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.$u.toast({
|
||||
// title: '选择图片失败',
|
||||
// icon: 'none',
|
||||
// })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
const imgToBase64Fun = async (data) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
pathToBase64(data)
|
||||
.then((base64) => {
|
||||
resolve(base64)
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// onMounted生命周期 组件挂载时
|
||||
|
|
|
|||
|
|
@ -11,6 +11,16 @@
|
|||
<text>人员资质查询</text>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<up-loading-icon
|
||||
:vertical="true"
|
||||
duration="2000"
|
||||
color="#3c9cff"
|
||||
:show="showLoading"
|
||||
textColor="#3c9cff"
|
||||
text="正在识别中,请稍后..."
|
||||
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%)"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -19,30 +29,50 @@ import { ref } from 'vue'
|
|||
import FaceIcon from '@/static/image/face.png'
|
||||
import CheckIcon from '@/static/image/person-qua.png'
|
||||
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
const onFaceRecognition = () => {
|
||||
// uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
// console.log('onFaceRecognition')
|
||||
|
||||
// 打开前置摄像头
|
||||
// uni.scanCode({
|
||||
// scanType: ['barCode', 'qrCode'],
|
||||
// success: (result) => {
|
||||
// console.log(result)
|
||||
// },
|
||||
// })
|
||||
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: (res) => {
|
||||
console.log(res, '----选取的文件')
|
||||
showLoading.value = true
|
||||
const files = [
|
||||
{
|
||||
file: res.tempFiles[0],
|
||||
name: 'file',
|
||||
},
|
||||
]
|
||||
uni.uploadFile({
|
||||
url: '/api/bmw/appRecognition/getFaceRecognition',
|
||||
files: files,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
showLoading.value = false
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.code === 200) {
|
||||
uni.$u.toast('人脸识别成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/person-details/index?id=${data.data.userId}`,
|
||||
})
|
||||
}, 500)
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
uni.$u.toast({
|
||||
title: '选择图片失败',
|
||||
icon: 'none',
|
||||
})
|
||||
// uni.$u.toast({
|
||||
// title: '选择图片失败',
|
||||
// icon: 'none',
|
||||
// })
|
||||
},
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,16 @@
|
|||
<view>
|
||||
<view>{{ item.title }}</view>
|
||||
</view>
|
||||
|
||||
<up-loading-icon
|
||||
:vertical="true"
|
||||
duration="2000"
|
||||
color="#3c9cff"
|
||||
:show="showLoading"
|
||||
textColor="#3c9cff"
|
||||
text="正在识别中,请稍后..."
|
||||
style="position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%)"
|
||||
/>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -20,6 +30,9 @@
|
|||
import AddIcon from '@/static/image/person/add.png'
|
||||
import EditIcon from '@/static/image/person/edit.png'
|
||||
import FaceIcon from '@/static/image/person/face.png'
|
||||
import { ref } from 'vue'
|
||||
|
||||
const showLoading = ref(false) // 是否显示加载中
|
||||
|
||||
const handleList = [
|
||||
{
|
||||
|
|
@ -52,12 +65,54 @@ const handleList = [
|
|||
// 点击跳转
|
||||
const handleTapPersonEntry = (item) => {
|
||||
if (item.name === 'face') {
|
||||
uni.$u.toast('功能正在开发中,敬请期待...')
|
||||
return
|
||||
uni.chooseImage({
|
||||
count: 1, // 最多选择1张图片
|
||||
sizeType: ['original', 'compressed'],
|
||||
sourceType: ['camera', 'album'], // 选择图片的来源
|
||||
success: (res) => {
|
||||
showLoading.value = true
|
||||
const files = [
|
||||
{
|
||||
file: res.tempFiles[0],
|
||||
name: 'file',
|
||||
},
|
||||
]
|
||||
uni.uploadFile({
|
||||
url: '/api/bmw/appRecognition/getFaceRecognition',
|
||||
files: files,
|
||||
name: 'file',
|
||||
success: (res) => {
|
||||
showLoading.value = false
|
||||
const data = JSON.parse(res.data)
|
||||
if (data.code === 200) {
|
||||
uni.$u.toast('人脸识别成功')
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({
|
||||
url: `/pages/person-details/index?id=${data.data.userId}`,
|
||||
})
|
||||
}, 500)
|
||||
} else {
|
||||
uni.$u.toast('人脸识别失败,请重新识别')
|
||||
}
|
||||
},
|
||||
fail: (err) => {
|
||||
showLoading.value = false
|
||||
uni.$u.toast('人脸识别失败:' + err.msg)
|
||||
},
|
||||
})
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.$u.toast({
|
||||
// title: '选择图片失败',
|
||||
// icon: 'none',
|
||||
// })
|
||||
},
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: item.url,
|
||||
})
|
||||
}
|
||||
uni.navigateTo({
|
||||
url: item.url,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue