officialAccount/pages/addoldman/yibao.vue

259 lines
5.6 KiB
Vue

<template>
<div class="container">
<view class="white-content">
<view class="content-title">
<view class="content-weight">医保卡上传</view>
<image class="content-img" src="@/static/index/bian.png" />
</view>
<view class="white-photo" @click="getMessage">
<view class="photo-left">
<view class="photo-weight">医保卡正面</view>
<view class="photo-font">请上传身份证医保卡正面</view>
</view>
<image class="photo" src="@/static/index/yibaocard.png" />
</view>
<view class="white-photo" style="margin-top: 30rpx;" @click="getMessage">
<view class="photo-left">
<view class="photo-weight">医保卡背面</view>
<view class="photo-font">请上传身份证医保卡背面</view>
</view>
<image class="photo" src="@/static/index/backyibaocard.png" />
</view>
<view class="white-message">
<view class="message-title">
<view class="shu"></view>
<view class="message-weight">
确认户口本本人页信息
</view>
</view>
<view style="margin-bottom: 20rpx;">
<view v-for="(item,index) in nameArray" :key="index" class="one">
<view class="one-left">{{item}}</view>
<view class="one-right">自动获得</view>
</view>
</view>
</view>
</view>
<view class="gray-font">
<view class="">注意事项:</view>
<view class="">
1.同一个医保卡号只能认证一个账号;
</view>
<view class="">2.正反面医保卡信息应为同一医保卡信息;</view>
<view class="">3.所有上传照片需清晰且未遮挡,请勿进行美化和修改;</view>
<view class="">4.所有上传信息均会被妥善保管,不会用于其他商业用途或传输给第三方;</view>
</view>
<view class="finish-button" @click="next">
下一步
</view>
</div>
</template>
<script setup>
import {
ref
} from 'vue'
const nameArray = ["姓名", "社会保障卡号码", "社会保障卡卡号", "发卡日期"]
// 本地保存的临时文件路径
const tempImagePath = ref('')
// 拍照并上传
function getMessage() {
// 使用 UniApp 的 API 调用摄像头
uni.chooseImage({
count: 1,
sourceType: ['camera'],
success: chooseRes => {
tempImagePath.value = chooseRes.tempFilePaths[0]
// 拍照成功后,调用上传函数
uploadImage(tempImagePath.value)
},
fail: err => {
console.error('拍照失败:', err)
}
})
}
// 上传图片到服务器
function uploadImage(filePath) {
uni.uploadFile({
url: `${uni.getStorageSync('serverUrl')}/api/ocr/idCard`, // 替换为你的POST接口地址
filePath,
name: 'file', // 后端接收时的字段名
header: {
'X-Access-Token': uni.getStorageSync('token') || '',
},
formData: {
// 可以根据接口需要添加额外表单字段
// userId: '12345'
},
success: uploadRes => {
console.log("????", JSON.parse(JSON.parse(uploadRes.data).result).data)
},
fail: err => {
uni.showToast({
title: '上传出错',
icon: 'error'
})
}
})
}
const next = () => {
uni.navigateTo({
url: "/pages/addoldman/hukou"
});
}
</script>
<style lang="scss" scoped>
.container {
display: flex;
flex-direction: column;
min-height: 100vh;
width: 100%;
background-color: rgb(239, 241, 252);
position: relative;
box-shadow: 2rpx 2rpx 4rpx rgba(0, 0, 0, 0.1);
.white-content {
width: 90%;
margin-left: 5%;
margin-top: 30rpx;
// height: 1200rpx;
border-radius: 35rpx;
background-color: rgb(245, 251, 254);
.content-title {
display: flex;
// align-items: center;
height: 100rpx;
position: relative;
.content-weight {
// font-size: 35rpx;
font-weight: 600;
margin-left: 70rpx;
margin-top: 20rpx;
}
.content-img {
position: absolute;
right: 0;
top: 0;
width: 400rpx;
height: 100%;
}
}
}
.white-photo {
width: 90%;
margin-left: 5%;
// margin-top: 30rpx;
height: 300rpx;
border-radius: 35rpx;
background-color: #fff;
box-shadow: 4rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
justify-content: space-around;
align-items: center;
display: flex;
.photo {
width: 300rpx;
height: 200rpx;
}
}
.white-message {
width: 90%;
margin-left: 5%;
margin-top: 30rpx;
margin-bottom: 30rpx;
// height: 800rpx;
border-radius: 35rpx;
background-color: #fff;
box-shadow: 4rpx 4rpx 8rpx rgba(0, 0, 0, 0.1);
justify-content: space-around;
// align-items: center;
display: flex;
flex-direction: column;
.message-title {
width: 100%;
height: 100rpx;
align-items: center;
display: flex;
.shu {
width: 10rpx;
height: 30rpx;
background-color: #0097FF;
border-radius: 10rpx;
margin: 0 20rpx 0 30rpx;
}
.message-weight {
font-size: 30rpx;
// font-weight: 600;
}
}
.one {
width: 90%;
margin-left: 5%;
border-bottom: 1rpx solid #d7d7d7;
height: 90rpx;
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
.one-left {
margin-left: 10rpx;
}
.one-right {
margin-right: 10rpx;
color: #999999;
}
}
}
}
.photo-left {
.photo-weight {
font-size: 26rpx;
font-weight: 600;
}
.photo-font {
font-size: 23rpx;
margin-top: 10rpx;
}
}
.gray-font {
padding: 30rpx 60rpx;
color: #999999;
}
.finish-button {
display: flex;
justify-content: center;
align-items: center;
width: 70%;
height: 100rpx;
margin: 0rpx auto;
margin-bottom: 80rpx;
color: #fff;
background: linear-gradient(to right, #00C9FF, #0076FF);
border-radius: 50rpx;
font-size: 35rpx;
}
</style>