115 lines
3.5 KiB
Vue
115 lines
3.5 KiB
Vue
<template>
|
|
<!-- 人员资质查询 -->
|
|
<NavBarModal navBarTitle="人员资质查询" />
|
|
<view class="person-check" :style="{ paddingTop: safeAreaInsets?.top + 54 + 'px' }">
|
|
<view class="person-check-item">
|
|
<view @tap="onFaceRecognition">
|
|
<up-image width="60px" height="60px" :src="FaceIcon" />
|
|
<text>人脸识别</text>
|
|
</view>
|
|
<view @tap="onPersonCheck">
|
|
<up-image width="60px" height="60px" :src="CheckIcon" />
|
|
<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>
|
|
|
|
<script setup name="PersonCheck">
|
|
import { ref } from 'vue'
|
|
import FaceIcon from '@/static/image/face.png'
|
|
import CheckIcon from '@/static/image/person-qua.png'
|
|
import NavBarModal from '@/components/NavBarModal/index.vue'
|
|
const { safeAreaInsets } = uni.getSystemInfoSync()
|
|
const showLoading = ref(false) // 是否显示加载中
|
|
|
|
const onFaceRecognition = () => {
|
|
uni.chooseImage({
|
|
count: 1, // 最多选择1张图片
|
|
sizeType: ['original', 'compressed'],
|
|
sourceType: ['camera'], // 选择图片的来源
|
|
success: (res) => {
|
|
showLoading.value = true
|
|
const files = [
|
|
{
|
|
file: res.tempFilePaths[0],
|
|
name: 'file',
|
|
uri: res.tempFilePaths[0],
|
|
},
|
|
]
|
|
uni.uploadFile({
|
|
url: '/bmw/appRecognition/getFaceRecognition',
|
|
files: files,
|
|
name: 'file',
|
|
isUploadFile: true,
|
|
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('人脸识别失败,请重新识别' + data.msg === null ? '' : data.msg)
|
|
}
|
|
},
|
|
fail: (err) => {
|
|
showLoading.value = false
|
|
uni.$u.toast('人脸识别失败')
|
|
},
|
|
})
|
|
},
|
|
fail: (err) => {
|
|
// uni.$u.toast({
|
|
// title: '选择图片失败',
|
|
// icon: 'none',
|
|
// })
|
|
},
|
|
})
|
|
}
|
|
|
|
// 打开人员资质查询页面
|
|
const onPersonCheck = () => {
|
|
console.log('onPersonCheck')
|
|
uni.navigateTo({
|
|
url: '/pages/person-check/aptitude-query/index',
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.person-check-item {
|
|
padding: 30rpx 0;
|
|
width: 100%;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-around;
|
|
|
|
view {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
|
|
& text {
|
|
margin-top: 10rpx;
|
|
font-size: 14px;
|
|
color: #3c9cff;
|
|
}
|
|
}
|
|
}
|
|
</style>
|