这是没有进行身份证照片验证的 如果要判断上传的图片是否为身份证 可以参考阿里云的
阿里云身份证验证超链接
最后放上了上传身份证图片的人像框和国徽框
引入的js文件在图片后面
wxml

<template><view class="ID-mian"><h3>身份证正面(上传)</h3><view class="card-zheng"><view class="zheng_left" v-show="isShow"><image src="../../static/zheng.png" mode="" @tap='touchphoto1'></image></view><view class="zheng_right" v-show="!isShow"><image :src="V_TPID"></image></view></view><h3>身份证反面(上传)</h3><view class="card-fan"><view class="fan_left" v-show="isShow1"><image src="../../static/fan.png" mode="" @tap='touchphoto2'></image></view><view class="fan_right" v-show="!isShow1"><image :src="V_TPID1"></image></view></view><view style="display: flex;align-items: center;margin-top: 10px;"><button style="width: 100%;height:40px;line-height: 40px; color:white;background-color: #39B54A;font-size: 14px;"@click="back">确认上传</button></view></view>
</template>

js

const util = require('@/util.js');
export default {data(){return{V_TPID: '',V_TPID1: '',curl: '',isShow:true,isShow1:true,}},onLoad(option) {this.curl = 后台请求地址;},methods: {//上传身份证touchphoto1() {let that = thiswx.chooseImage({count: 1, // 默认9success: function(res) {util.showLoading('图片上传中...');uni.request({url: 你的接口, data: {参数},header: {//自定义请求头信息},method: 'POST',success: (info) => {if (info.data.errcode == "00000") {that.V_TPID = info.data.V_TPIDthat.isShow=falseuni.showToast({icon: 'none',title: "上传成功",duration: 4000});util.hideLoading();} else {uni.showToast({icon: 'none',title: info.data.msg,duration: 4000});util.hideLoading();}util.hideLoading();},error: (info) => {util.hideLoading();},});},})},touchphoto2() {let that = thiswx.chooseImage({count: 1, // 默认9success: function(res) {util.showLoading('图片上传中...');uni.request({    url: 接口地址。data: {参数},header: {//自定义请求头信息},method: 'POST',success: (info) => {if (info.data.errcode == "00000") {that.V_TPID1 = info.data.V_TPIDthat.isShow1=falseuni.showToast({icon: 'none',title: "上传成功",duration: 4000});} else {uni.showToast({icon: 'none',title: info.data.msg,duration: 4000});util.hideLoading();}util.hideLoading();},error: (info) => {util.hideLoading();},});}})},//返回上一页back(){if(this.isShow==false && this.isShow1==false){uni.navigateBack()}else{uni.showToast({icon: 'none',title: "身份证信息未完善",duration: 4000});util.hideLoading();}}},}

css

.ID-mian {background-color: white;}.card-zheng {width: 100%;height: 200px;display: flex;justify-content: space-around;}.zheng_left {width: 70%;height: 100%;display: inline-block;}.zheng_left image {width: 90%;height: 60%;line-height: 70%;margin-top: 30px;margin-left: 10px;}.zheng_right {width: 70%;height: 100%;display: inline-block;}.zheng_right image {width: 90%;height: 60%;line-height: 70%;margin-top: 30px;margin-left: 10px;}.card-fan {width: 100%;height: 200px;display: flex;justify-content: space-around;}.fan_left {width: 70%;height: 100%;display: inline-block;}.fan_left image {width: 90%;height: 60%;line-height: 70%;margin-top: 30px;margin-left: 10px;}.fan_right {width: 70%;height: 100%;display: inline-block;}.fan_right image {width: 90%;height: 60%;line-height: 70%;margin-top: 30px;margin-left: 10px;}



util.js

/* 2. 设置加载动画 */
export function showLoading(message) {if (wx.showLoading) {    // 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理wx.showLoading({title: message, mask: true});} else {    // 低版本采用Toast兼容处理并将时间设为20秒以免自动消失wx.showToast({title: message, icon: 'loading', mask: true, duration: 20000});}
}
export function hideLoading() {if (wx.hideLoading) {    // 基础库 1.1.0 微信6.5.6版本开始支持,低版本需做兼容处理wx.hideLoading();} else {wx.hideToast();}
}

uniapp简单的身份证照片(正反面)上传相关推荐

  1. JQUERY插件JqueryAjaxFileUplaoder----更简单的异步文件上传

    异步上传相信大家都做过类似的功能,JqueryAjaxFileUploader为我们提供了更简单的实现和使用方式.不过既然是JQUERY的插件那么它所依赖的环境大家都懂得.JqueryAjaxFile ...

  2. uni-app 小程序多图上传

    uni-app 小程序多图上传: 官方提示说,App支持多文件上传,微信小程序只支持单文件上传,传多个文件需要反复调用本API.所以跨端的写法就是循环调用本API 步骤: //1.首先通过 uni.c ...

  3. ASP.NET Web API实现简单的文件下载与上传

    ASP.NET Web API实现简单的文件下载与上传.首先创建一个ASP.NET Web API项目,然后在项目下创建FileRoot目录并在该目录下创建ReportTemplate.xlsx文件, ...

  4. 七牛云 vue 图片上传简单解说,js 上传文件图片

    七牛云 vue 图片上传简单解说,js 上传文件图片 一.七牛云简介 首次使用七牛云存储进行项目的图片存储,整了一上午才整明白,这些官方的教程把明白人也给说糊涂了,文档很不规范. 七牛云有免费的使用额 ...

  5. uniapp APP用户修改头像(上传到OSS)

    uniapp APP用户修改头像(上传到OSS) 点击头像进行修改头像 点击头像跳转到新的页面(先判断用户是否登陆),选择图片,确认上传. <image class="portrait ...

  6. 上传身份证照片js_js上传身份证正反面

    图片生成 * { margin: 0; padding: 0; box-sizing: border-box; list-style: none; } body { font-size: 12px; ...

  7. [server]基于uniapp创建小程序并上传照片到阿里云OSS

    先说在前头,最近忙,随想随记,所以有些博客写了一半就发了,后续会慢慢补齐的.抱歉! 前端使用uniapp开发,后台挂在阿里云.选uniapp开发的原因是我这边人手不够,同时也不想维护这么多客户端,故选 ...

  8. 基于cropper和sweetalert的简单图片/头像裁剪上传

    基本功能 前端基本样式: 进行图片裁剪及上传: 点击上传后,js会将截取到的数据转为图片数据利用ajax发送给后台进行存储.存储成功后,刷新前端页面,头像改变. 上传成功后:自动刷新网页,更改头像 基 ...

  9. Vue封装一个简单轻量的上传文件组件

    一.之前遇到的一些问题 项目中多出有上传文件的需求,使用现有的UI框架实现的过程中,不知道什么原因,总会有一些莫名其妙的bug.比如用某上传组件,明明注明(:multiple="false& ...

最新文章

  1. Cow Toll Paths(floyd变形)
  2. 单片机为什么一直用C语言,不用其他编程语言?只有学过的知道!
  3. 基于java的银行综合业务柜台系统设计与实现(含源文件)
  4. Java23种设计模式之概念篇
  5. apache域名本地映射
  6. Java讲课笔记10:类的封装
  7. matlab lj( )函数,matlab 函数调用问题
  8. 【Flask】下载多个文件
  9. OpenCV精进之路(八):图像轮廓和图像分割修复——轮廓查询和多边形包围轮廓
  10. Elastic Job 入门
  11. 《Java开发实战经典》习题第4章第10题:在排序好的数组中添加一个数字,将添加后的数字插入到数组合适的位置
  12. 云数据库模糊查询与索引管理
  13. 拼多多API接口调用方法(内附上多个可用API)
  14. python 爬虫框架scrapy优势_Python 爬虫框架Scrapy 简单介绍
  15. 一言不合就想斗图?快用深度学习帮你生成表情包
  16. 打印机服务器ip修改,怎样改打印机服务器的ip地址
  17. c++ 隐藏和显示标题栏
  18. c语言幼儿园自动分班,【资源学习】c语言程序代码,登录幼儿园200个小朋友的数据...
  19. stringstream切割字符串
  20. 1. Nacos的安装与启动

热门文章

  1. XP sp3共享最大连接数修改工具 EvID4226Patch.exe
  2. Photoshop快速的制作标准一寸证件照(8张的或者9张的)
  3. python(remove_bg)一键抠图换背景 智能抠图
  4. 基于Opencv-python人脸口罩检测(附完整代码)
  5. Android Studio中layout_gravity与gravity
  6. 在不同的paste网站上搜索泄漏的凭据Scavenger
  7. 如何实现高效的团队合作?
  8. python神器排行_9款强大的Python工具包,第5款神器期待已久!
  9. vue.js 默认选中select_vue select二级联动第二级默认选中第一个option值的实例
  10. AsyncQueryHandler 异步查询数据