From 901aa568618560e2d3bc0c90ad3e2ff65b5e5430 Mon Sep 17 00:00:00 2001
From: xpz2018 <107107461@qq.com>
Date: Fri, 13 Aug 2021 14:16:23 +0800
Subject: [PATCH] no message
---
pages/home/certificate/index.js | 76 ++++++++++++++++++++++++++++++-
pages/home/certificate/index.wxml | 21 ++++++---
pages/home/certificate/index.wxss | 4 +-
3 files changed, 92 insertions(+), 9 deletions(-)
diff --git a/pages/home/certificate/index.js b/pages/home/certificate/index.js
index 5b429d6..ce069c3 100644
--- a/pages/home/certificate/index.js
+++ b/pages/home/certificate/index.js
@@ -1,5 +1,6 @@
// pages/home/authory/index.js
-import { ocrLicense, checkLicense } from "../../api/user"
+import { ocrLicense } from "../../api/user"
+import { zconfig } from'../../api/ztb'
import { updateUserInfo, identifyEnterprise } from '../../api/ztb'
const util = require('../../../utils/util')
const app = getApp()
@@ -14,7 +15,7 @@ Page({
form: { },
flag: false, // 是否不可以编辑, false:可编辑;true:不可编辑
disabled: true,
- fileList: []
+ imgList: [null]
},
onLoad: function (options) {
this.setData({ safeBottom: app.globalData.safeBottom, form: app.globalData.userInfo })
@@ -116,5 +117,76 @@ Page({
})
}
}
+ },
+ checkLicense: function(url){
+ this.data.form['businessLicenseImg'] = url
+ wx.showLoading({ title: '识别中', mask: true })
+ ocrLicense({businessLicenseUrl: url}).then(result => {
+ this.setData({
+ ['form.name']: result.data.name,
+ ['form.uniformSocialCreditCode']: result.data.uniformSocialCreditCode,
+ ['form.legalPersonName']: result.data.legalPersonName,
+ ['form.locDetail']: result.data.locDetail,
+ })
+ wx.hideLoading()
+ }).catch(error => {
+ wx.hideLoading()
+ util.showToast(error)
+ })
+ },
+ /*******************************************************图片上传************************************************************/
+ chooseImage: function(e) {
+ var index = 0
+ var that = this
+ wx.chooseImage({
+ count: 1, //默认9
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+ sourceType: ['album', 'camera'], //从相册选择
+ success: (res) => {
+ that.setData({ ['imgList[' + index + ']']: res.tempFilePaths[0] })
+ that.uploadFile(res.tempFilePaths[0])
+ }
+ })
+ },
+ uploadFile: function (path) {
+ var that = this
+ var header = { ...zconfig.header, 'X-APP-ID': app.xAppId, appversion: app.version, 'Content-Type': 'multipart/form-data' }
+ wx.uploadFile({
+ url: zconfig.baseUrl + '/recycle-user-center/file-uploading/upload/image',
+ filePath: path,
+ name: 'image',
+ header,
+ success: function (result) {
+ var resp = null
+ if (!util.isEmpty(result.data)) {
+ resp = JSON.parse(result.data)
+ }
+ if (resp && resp.code === 0) {
+ that.checkLicense(resp.data)
+ } else {
+ util.showToast('图片上传失败,请重新上传')
+ }
+ },
+ fail: function (res) {
+ util.showToast('图片上传失败,请重新上传')
+ }
+ })
+ },
+ suffixImage: function(path){
+ return path.substring(path.lastIndexOf('.') + 1)
+ },
+ viewImage: function(e) {
+ var urlList = []
+ for (var i = 0; i < this.data.imgList.length; i++) {
+ if (!util.isEmpty(this.data.imgList[i])) {
+ urlList.push(this.data.imgList[i])
+ }
+ }
+ wx.previewImage({ urls: urlList, current: e.currentTarget.dataset.url })
+ },
+ deleteImg: function(e) {
+ var index = e.currentTarget.dataset.index
+ this.data.imgList[index] = null;
+ this.setData({ imgList: this.data.imgList })
}
})
\ No newline at end of file
diff --git a/pages/home/certificate/index.wxml b/pages/home/certificate/index.wxml
index bcde835..f266f87 100644
--- a/pages/home/certificate/index.wxml
+++ b/pages/home/certificate/index.wxml
@@ -2,22 +2,31 @@
企业认证
+
公司信息