<template>
    <!-- 人员资质查询 -->
    <view class="person-check">
        <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>
    </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'

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, '----选取的文件')
        },
        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>
