Browse Source

no message

featrue/v4.5
xpz2018 4 years ago
parent
commit
901aa56861
3 changed files with 92 additions and 9 deletions
  1. 76
      pages/home/certificate/index.js
  2. 21
      pages/home/certificate/index.wxml
  3. 4
      pages/home/certificate/index.wxss

76
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 })
}
})

21
pages/home/certificate/index.wxml

@ -2,22 +2,31 @@
<cu-custom bgColor="bg-white" isBack="{{true}}">
<view slot="content">企业认证</view>
</cu-custom>
<view class="text-sg text-gray" style="padding: 12rpx 32rpx;">公司信息</view>
<view class="cu-list menu no-card sm-border">
<!-- <view class="cu-item">
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx;padding: 32rpx 0rpx">
<view style="min-width:200rpx"><text class="text-red must">*</text>营业执照:</view>
<view style="height: 180rpx;border: 1rpx solid #f3f3f3;flex: 1;justify-content: flex-start;">
<wux-uploader count="1" column="3" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader>
<view class="flex flex-center" style="height: 180rpx;border: 1rpx solid #f3f3f3;flex: 1;justify-content: flex-start;">
<view class="image-reader-item" data-index="0" bindtap="chooseImage" wx:if="{{!imgList[0]}}">
<text class="cuIcon-cameraadd md-icon" style="font-size:50rpx"></text>
</view>
<view class="image-reader-item" bindtap="viewImage" data-url="{{imgList[0]}}" wx:else>
<image style="width:100%;height: 100%" src="{{imgList[0]}}" mode="aspectFill"></image>
<view class="delete" catchtap="deleteImg" data-index="0" wx:if="{{!flag}}">
<text class="cuIcon-close {{pathList[0].status===-1?'text-red':'text-white'}}"></text>
</view>
</view>
<view class="md-hint" style="margin-left: 24rpx;">点击上传</view>
</view>
</view>
</view> -->
<view class="bg-white" style="display:block">
</view>
<!-- <view class="bg-white" style="display:block">
<view class="flex text-sg" style="padding: 18rpx 30rpx 0rpx 30rpx"><text class="text-red" style="font-size: 28px">*</text>请拍摄/上传营业执照:</view>
<wux-uploader count="1" column="4" fileList="{{fileList}}" bindcustomevent="onImageChange"></wux-uploader>
<view style="padding: 0rpx 30rpx"><view style="border-top: 1rpx solid #f3f3f3;"></view></view>
</view>
</view> -->
<view class="cu-item">
<view class="flex content cu-item" style="font-size:28rpx">
<view style="min-width:200rpx"><text class="text-red must">*</text>公司名称:</view>

4
pages/home/certificate/index.wxss

@ -11,6 +11,8 @@
list-style: none;
background-size: cover;
border-radius: 6rpx;
margin-left: 24rpx;
border: 1rpx solid #f3f3f3
}
.tspan{
@ -19,7 +21,7 @@
.image-reader-item .md-icon {
position: absolute;
top: 45%;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0.5;

Loading…
Cancel
Save