123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- /*
- * @Author: gaorf30153 gaorf30153@hundsun.com
- * @Date: 2024-06-18 10:39:19
- * @LastEditors: gaorf30153 gaorf30153@hundsun.com
- * @LastEditTime: 2024-06-24 16:00:17
- * @FilePath: \issuer-plugin\plugin\components\pickerTime\pickerTime.js
- * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
- */
- import Api from "../../api/index.js"
- import { requestFnc } from "../../utils/request.js"
- import { getStore, setStore } from "../../utils/index.js"
-
- Component({
- properties: {
- type: {
- type: Number,
- value: 1,
- },
- },
- data: {
- isLoading: false,
- sides: 1,
- leftPath: "",
- rightPath: "",
- identity: {},
- },
- attached: function () {},
- methods: {
- //选择图片
- chooseImage(e) {
- console.log(e.currentTarget.dataset.side)
- this.setData({
- sides: e.currentTarget.dataset.side,
- })
- this.compressRef = this.selectComponent("#compress")
- this.compressRef._changImg()
- },
- ////图片压缩成功
- compressRes(file) {
- this.setData({
- isLoading: true,
- })
- //正面
- this.setData({
- leftPath: file.detail[0],
- })
- let imgStr = this.data.leftPath.split(";")[1].split(",")[1]
- this.triggerEvent("leftImage", imgStr)
- let data = {
- filename: Api.ocrCorp.filename,
- data: {
- imageStr: imgStr,
- vehicleId: getStore("vehicleId"),
- },
- }
- requestFnc(
- Api.ocrCorp.url,
- data,
- (res) => {
- let corpInfoObj = JSON.parse(res.encryptedData)
- corpInfoObj.imageId = res.imageId
- for (let key in corpInfoObj) {
- this.data.identity[key] = corpInfoObj[key]
- }
- this.setData({
- isLoading: false,
- identity: this.data.identity,
- })
- // setStore("corpInfo", this.data.identity)
- this.triggerEvent("ocrInfo", this.data.identity)
- },
- (msg) => {
- this.setData({
- isLoading: false,
- })
- }
- )
- },
- viewImage(e) {
- wx.previewImage({
- urls: [e.currentTarget.dataset.type],
- })
- },
- delImg(e) {
- let data = e.currentTarget.dataset.type
- wx.showModal({
- title: "提示",
- content: "确定要删除此照片吗?",
- success: (res) => {
- if (res.confirm) {
- this.setData({
- leftPath: "",
- })
- this.triggerEvent("delImg")
- }
- },
- })
- },
- },
- })
|