| | |
| | | <view class="footer-box"> |
| | | <view class="submit-button" @click="submit">下一步</view> |
| | | </view> |
| | | <u-picker keyName="name" :show="show" :columns="columns" @confirm="confirm" @cancel="show = false"></u-picker> |
| | | <!-- <tly-picture-cut ref="tlyPictureCut" :pictureSrc="photoSrc" @createImg="uploadImg"></tly-picture-cut> --> |
| | | <u-picker :show="show" :columns="columns" keyName="name" @cancel="show = false" @confirm="confirm"></u-picker> |
| | | <qf-image-cropper ref="cropper" :width="280" :height="280" :radius="30" @crop="uploadImg"></qf-image-cropper> |
| | | </view> |
| | | </template> |
| | | |
| | | <script> |
| | | import tlyPictureCut from "@/components/tly-picture-cut/tlyPictureCut.vue"; |
| | | import QfImageCropper from '@/uni_modules/qf-image-cropper/components/qf-image-cropper/qf-image-cropper.vue'; |
| | | import { mapState } from 'vuex' |
| | | export default { |
| | | data() { |
| | | return { |
| | | photoSrc: "", |
| | | show: false, |
| | | visit: '', |
| | | type: '', |
| | |
| | | faceImg: '', |
| | | faceImgUrl: '', |
| | | imgurl: '', |
| | | imgurlUrl: '' |
| | | imgurlUrl: '', |
| | | companyName: '' |
| | | } |
| | | } |
| | | }, |
| | | |
| | | computed: { |
| | | ...mapState(['member']) |
| | | }, |
| | | |
| | | components: { tlyPictureCut, QfImageCropper }, |
| | | |
| | | onLoad(option) { |
| | | if (this.member) { |
| | | this.visitorData.name = this.member.name |
| | | this.visitorData.phone = this.member.phone |
| | | this.visitorData.idcardNo = this.member.idcardDecode |
| | | this.visitorData.companyName = this.member.visitCompanyName |
| | | this.visitorData.faceImg = this.member.faceImg |
| | | if (this.member.faceImg) { |
| | | this.visitorData.faceImgUrl = this.member.prefixUrl + this.member.faceImg |
| | | } |
| | | this.visitorData.imgurl = this.member.imgurl |
| | | if (this.member.imgurl) { |
| | | this.visitorData.imgurlUrl = this.member.prefixUrl + this.member.imgurl |
| | | } |
| | | this.visitorData.idcardType = this.member.idcardType |
| | | if (this.member.idcardType === 0) { |
| | | this.visitorData.idcardTypeName = '身份证' |
| | | } else if (this.member.idcardType === 1) { |
| | | this.visitorData.idcardTypeName = '港澳证件' |
| | | } else if (this.member.idcardType === 2) { |
| | | this.visitorData.idcardTypeName = '护照' |
| | | } |
| | | } |
| | | this.visitorData.userAnswerId = option.userAnswerId |
| | | this.getVisit() |
| | | uni.$on('update', (data) => { |
| | | this.uploadImg(data.tempFilePath) |
| | | }) |
| | | // uni.$on('update', (data) => { |
| | | // this.uploadImg(data.tempFilePath) |
| | | // }) |
| | | }, |
| | | |
| | | methods: { |
| | |
| | | }) |
| | | }, |
| | | uploadImg(file) { |
| | | var that = this |
| | | that.$refs.cropper.close() |
| | | uni.showLoading({ title: '上传中', mask: true }); |
| | | uni.uploadFile({ |
| | | url: `${this.$baseUrl}public/api/uploadFtp.do`, |
| | | filePath: file, |
| | | filePath: file.tempFilePath, |
| | | name: 'file', |
| | | formData: { |
| | | folderCode: 'MEMBER_IMG' |
| | | }, |
| | | success: (uploadFileRes) => { |
| | | let res = JSON.parse(uploadFileRes.data) |
| | | if (this.type === 'faceImg') { |
| | | this.visitorData.faceImg = res.data.halfPath |
| | | this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | } else { |
| | | this.visitorData.imgurl = res.data.halfPath |
| | | this.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | } |
| | | this.visitorData.faceImg = res.data.halfPath |
| | | this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | }, |
| | | fail(err) { |
| | | alert('失败') |
| | | }, |
| | | complete() { |
| | | uni.hideLoading(); |
| | |
| | | }); |
| | | }, |
| | | upload(type) { |
| | | this.type = type |
| | | var that = this |
| | | that.type = type |
| | | if (type === 'faceImg') { |
| | | that.$refs.cropper.open() |
| | | return |
| | | } |
| | | uni.chooseImage({ |
| | | count: 1, |
| | | success: (chooseImageRes) => { |
| | | if (type === 'faceImg') { |
| | | uni.navigateTo({ |
| | | url: `/pages/cropping/cropping?item=${JSON.stringify({ tempFilePath: chooseImageRes.tempFilePaths[0] })}` |
| | | }) |
| | | return |
| | | } |
| | | uni.showLoading({ title: '上传中', mask: true }); |
| | | for (let i = 0; i < chooseImageRes.tempFilePaths.length; i++) { |
| | | // if (type === 'faceImg') { |
| | | // that.photoSrc = chooseImageRes.tempFilePaths[0]; |
| | | // that.$refs.tlyPictureCut.showPop(); |
| | | // } |
| | | if (type === 'imgurl') { |
| | | uni.showLoading({ title: '上传中', mask: true }); |
| | | uni.uploadFile({ |
| | | url: `${this.$baseUrl}public/api/uploadFtp.do`, |
| | | filePath: chooseImageRes.tempFilePaths[i], |
| | | url: `${that.$baseUrl}public/api/uploadFtp.do`, |
| | | filePath: chooseImageRes.tempFilePaths[0], |
| | | name: 'file', |
| | | formData: { |
| | | folderCode: 'MEMBER_IMG' |
| | | }, |
| | | success: (uploadFileRes) => { |
| | | timeout: 60000, |
| | | success: (uploadFileRes) => { |
| | | let res = JSON.parse(uploadFileRes.data) |
| | | if (type === 'faceImg') { |
| | | this.visitorData.faceImg = res.data.halfPath |
| | | this.visitorData.faceImgUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | } else { |
| | | this.visitorData.imgurl = res.data.halfPath |
| | | this.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | } |
| | | that.visitorData.imgurl = res.data.halfPath |
| | | that.visitorData.imgurlUrl = res.data.prefixPath + res.data.folder + res.data.halfPath |
| | | }, |
| | | complete() { |
| | | if (i === chooseImageRes.tempFilePaths.length - 1) { |
| | | uni.hideLoading(); |
| | | } |
| | | uni.hideLoading(); |
| | | } |
| | | }); |
| | | } |
| | | }, |
| | | fail(err) { |
| | | alert('api报错') |
| | | } |
| | | }); |
| | | }, |
| | |
| | | } |
| | | </script> |
| | | |
| | | <style> |
| | | <style lang="scss"> |
| | | page { |
| | | background-color: #F7F7F7 !important; |
| | | } |
| | |
| | | display: flex; |
| | | flex-direction: column; |
| | | .title1_a { |
| | | font-size: 30rpx; |
| | | font-size: 30rpx !important; |
| | | font-weight: 400; |
| | | color: #222222; |
| | | display: flex; |
| | |
| | | } |
| | | } |
| | | .title1_b { |
| | | font-size: 24rpx; |
| | | font-size: 24rpx !important; |
| | | font-weight: 400; |
| | | color: #999999; |
| | | } |