Taro实现微信小程序自定义拍照截图识别

效果图:

代码:

<template>
    <view class="lary-top" :style="{ height: `${topBarHight}px` }"></view>
    <Camera
        v-show="!canvasShow"
        class="camera-photo"
        :style="{
            width: `${info.windowWidth}px`,
            height: `${info.windowHeight}px`,
        }"
    >
        <view
            class="page-flex"
            :style="{
                width: `${info.windowWidth}px`,
                height: `${info.windowHeight}px`,
            }"
        >
            <view
                :style="{
                    height: `${info.windowHeight}px`,
                    width: `${convasXL}px`,
                }"
                class="page-mask page-mask-lr take-photo"
            >
                <view
                    class="colose-x"
                    :style="{ marginTop: `${convasY - 75}px` }"
                >
                    <cover-image
                        src="@/assets/imgs/icon-x.png"
                        style="height: 24px; width: 24px"
                        @tap="evtBack"
                    >
                    </cover-image>
                </view>
            </view>
            <view
                class="page-content"
                :style="{ height: `${info.windowHeight}px` }"
            >
                <view
                    class="page-mask"
                    :style="{ height: `${convasY - 40}px` }"
                ></view>
                <view
                    class="camera-frame"
                    :style="{
                        width: `100%`,
                        height: `${canvasHeight}px`,
                    }"
                >
                    <view class="corner top-left"></view>
                    <view class="corner top-right"></view>
                    <view class="corner bottom-left"></view>
                    <view class="corner bottom-right"></view>
                </view>
                <view
                    class="page-mask tackPhoto"
                    :style="{ height: `${convasY + 40}px` }"
                >
                    <view class="confirm-photo" @tap="takePhoto">
                        >
                        <view class="in-box"></view>
                    </view>
                </view>
            </view>
            <view
                :style="{
                    height: `${info.windowHeight}px`,
                    width: `${convasXL}px`,
                }"
                class="page-mask page-mask-lr"
            ></view>
        </view>
        <view class="id-card">
            请对准框内拍摄
            <view class="id-card-text">题目</view>
        </view>
    </Camera>
    <view
        v-show="canvasShow"
        class="canvas-main"
        :style="{
            height: `${info.windowHeight}px`,
            width: `${info.windowWidth}px`,
        }"
    >
        <TopNavbar ref="topbarRef" :navbar-props="{ title: '' }">
            <template #left>
                <Left @click="evtBack" /&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值