当前位置: 首页 > news >正文

wordpress如何添加广告悬浮按钮seo如何优化排名

wordpress如何添加广告悬浮按钮,seo如何优化排名,国企500强公司有哪些,dede的网站地图要怎么做uniapp编写微信小程序调用百度OCR 公司有一个识别行驶证需求,调用百度ocr识别 使用了image-tools这个插件,因为百度ocr接口用图片的base64 这里只是简单演示,accesstoken获取接口还是要放在服务器端,不然就暴露了自己的百度项目k…

uniapp编写微信小程序调用百度OCR
公司有一个识别行驶证需求,调用百度ocr识别
使用了image-tools这个插件,因为百度ocr接口用图片的base64
在这里插入图片描述
这里只是简单演示,accesstoken获取接口还是要放在服务器端,不然就暴露了自己的百度项目key

代码我使用了这个博主的代码
https://blog.csdn.net/sjt1010/article/details/108272945

还有需要将百度接口的地址加到微信公众平台,开发管理的服务器域名里

<template><view class="cheliangjinchudengji-index"><view><button type="primary" @click="chooseImg">行驶证拍照识别</button><view style="margin-left:10px ;" v-if="imgList.length > 0"><view v-for="(item,index) in imgList" :key="index"><image :src="item" mode=""></image></view></view><!-- <button type="primary" @click="getBaiduToken">token</button> --><view v-for="item of cardatas" :key="item"><view>{{item}}</view></view></view></view>
</template><script>import { pathToBase64, base64ToPath } from '../../js_sdk/mmmm-image-tools/index.js'import { fetchBaiduOCRDatas  } from '../../utils/basePath';export default {data() {return {imgList: [],token:'',cardatas:{chepai:'',xinghao:''}}},methods: {chooseImg(){let that = this;that.getBaiduToken();uni.chooseImage({success: (chooseImageRes) => {const tempFilePaths = chooseImageRes.tempFilePaths;// #ifdef MP-WEIXINuni.getFileSystemManager().readFile({filePath: tempFilePaths[0],encoding: 'base64',success: r => { console.log(r.data)let base64 = 'data:image/jpeg;base64,'  + r.data;that.imgList.push(base64)that.postBaiduOcr(base64);}})// #endif// // #ifdef APP-PLUS// pathToBase64(tempFilePaths[0])//   .then(base64 => {// 	that.imgList.push(base64)//   })//   .catch(error => {// 	console.error(error)//   })// // #endif}});},postBaiduOcr(imgbase64){let that = this;let accessToken = that.token;fetchBaiduOCRDatas("https://aip.baidubce.com/rest/2.0/ocr/v1/vehicle_license?access_token="+accessToken, {"image":imgbase64} , {'content-type': 'application/x-www-form-urlencoded'}, "POST", res=>{if(res.statusCode=='200' || res.statusCode==200){uni.showToast({type: 'success',title: 'OCR成功!',icon: 'none',duration:3000});that.cardatas.chepai = res.data.words_result.号牌号码.words;that.cardatas.xinghao = res.data.words_result.品牌型号.words;}else{uni.showToast({type: 'error',title:  res.data.error_description,icon: 'none',duration:3000});}})},getBaiduToken(){fetchBaiduOCRDatas("https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=xxxx&client_secret=xxxx", {}, {'Content-Type': 'application/json', 'Accept': 'application/json'}, "POST", res=>{if(res.statusCode=='200' || res.statusCode==200){uni.showToast({type: 'success',title: 'token获取成功!',icon: 'none',duration:3000});this.token = res.data.access_token	}else{uni.showToast({type: 'error',title: res.data.error_description,icon: 'none',duration:3000});}})},}}
</script><style></style>
const fetchBaiduOCRDatas = (url, data, header, method, callback, errCallback)=>{// let token = uni.getStorageSync('token');uni.request({url: url,data: data,method:method,header: header,// {//      'content-type': 'application/x-www-form-urlencoded'//    },success (res) {uni.hideLoading();callback(res);}})
}

在这里插入图片描述
这个行驶证图片是百度开发平台提供的图片

有些人可能有base64传后台需求,但是拍照内存太大需要压缩,加一下压缩图片再转base64代码

chooseImg(){let that = this;that.getBaiduToken();uni.chooseImage({// sizeType: ['compressed'],success: (chooseImageRes) => {const tempFilePaths = chooseImageRes.tempFilePaths;// 压缩uni.compressImage({src: tempFilePaths[0],quality: 0.1,success: res => {uni.getFileSystemManager().readFile({filePath: res.tempFilePath,encoding: 'base64',success: r => { let base64 = 'data:image/jpeg;base64,'  + r.data;that.imgList.push(base64)that.postBaiduOcr(base64);console.log(`压缩111:${base64.length}KB`)}})}})}});
},
http://www.15wanjia.com/news/54250.html

相关文章:

  • 如何与别的网站做友情链接软文兼职10元一篇
  • 城乡和住房建设厅网站首页怎么推广自己的店铺
  • 曰本做爰视频网站网络推广培训
  • 91大神网站建设广州seo培训
  • 新媒体营销论文选题方向连云港seo优化公司
  • 微信如何建立网站厦门小鱼网
  • 做产品类的工作上什么网站好服务营销论文
  • 湖南长沙网站建设公司电话四川seo排名
  • 做暧暧视频网站安全吗工具大全
  • html音乐网站源码链交换反应
  • iis5.1 新建网站网络项目推广平台
  • 用axure原型设计做网站全网营销推广靠谱吗
  • 网站设计优化方案电商平台发展现状与趋势
  • 微商客源神器关键词优化
  • 网站算阵地建设百度软件优化排名
  • 手机网站 设计图深圳做网站的公司
  • 公司做b2b网站百度业务推广
  • 网站建设域名国际新闻最新消息今天军事新闻
  • 昆明著名网站建设智能网站推广优化
  • 青海网站设计高端如何提高网站seo排名
  • 购买网站空间后怎么做河南seo关键词排名优化
  • 电子商务网站技术提高搜索引擎检索效果的方法
  • 搜索引擎找不到的网站湖南企业竞价优化
  • 做跨境电商网站有哪些在线搜索资源
  • 网站实现功能有了域名如何建立网站
  • 做网站免费送域名最新的域名网站
  • 北京住房城乡建设厅网站首页恶意点击软件
  • 开网站建设公司怎么样湖北seo整站优化
  • 做室内设计的网站有哪些百度付费推广
  • 什么语言建手机网站建设企业营销型网站