<template>
    <!-- 人员入场 -->
    <view
        :key="item.name"
        class="person-handle"
        v-for="item in handleList"
        @tap="handleTapPersonEntry(item)"
        :style="{
            background: `linear-gradient(to bottom, ${item.bgc_color_1}, ${item.bgc_color_2})`,
        }"
    >
        <image :src="item.icon" mode="widthFix" class="icon-img" />
        <view>
            <view>{{ item.title }}</view>
        </view>
    </view>
</template>

<script setup name="personEntry">
import AddIcon from '@/static/image/person/add.png'
import EditIcon from '@/static/image/person/edit.png'
import FaceIcon from '@/static/image/person/face.png'

const handleList = [
    {
        name: 'add',
        icon: AddIcon,
        title: '新增人员信息',
        bgc_color_1: '#9ee07f',
        bgc_color_2: '#57cd7e',
        url: `/pages/person-entry/child-pages/addAndEditPerson?type=${1}`,
    },
    {
        name: 'edit',
        icon: EditIcon,
        title: '修改人员信息',
        bgc_color_1: '#14e3fe',
        bgc_color_2: '#3ebefe',
        url: '/pages/person-entry/child-pages/editPerson',
    },

    {
        name: 'face',
        icon: FaceIcon,
        title: '人脸识别查找',
        bgc_color_1: '#d8c1ea',
        bgc_color_2: '#91cbf0',
        url: '/pages/person-entry/child-pages/faceRecognition',
    },
]

// 点击跳转
const handleTapPersonEntry = (item) => {
    if (item.name === 'face') {
        uni.$u.toast('功能正在开发中，敬请期待...')
        return
    }
    uni.navigateTo({
        url: item.url,
    })
}
</script>

<style scoped lang="scss">
.person-handle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 70rpx 0;
    border-radius: 20rpx;
    margin: 20rpx;
    .icon-img {
        width: 64rpx;
        height: 64rpx;
    }

    view {
        margin-left: 28rpx !important;
        color: #fff;
        font-size: 48rpx;
        font-weight: bold;
        margin-left: 20rpx;
        font-family: PingFang SC;
    }
}
</style>
