安全培训 附件上传功能优化
This commit is contained in:
parent
a873168d86
commit
f9d9bf2cf8
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name" : "兰坪实名制",
|
||||
"appid" : "__UNI__517BDE0",
|
||||
"appid" : "__UNI__DC0416B",
|
||||
"description" : "兰坪实名制",
|
||||
"versionName" : "1.0.11",
|
||||
"versionCode" : 111,
|
||||
|
|
|
|||
|
|
@ -363,12 +363,12 @@
|
|||
<text>公司级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(1)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.companyExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.companyExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(1)">
|
||||
{{ entryTrainBean.companyExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -376,12 +376,12 @@
|
|||
<text>部门级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(2)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.deptExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.deptExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(2)">
|
||||
{{ entryTrainBean.deptExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -389,12 +389,12 @@
|
|||
<text>班组级级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(2)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.eamExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.eamExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(3)">
|
||||
{{ entryTrainBean.eamExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -1808,45 +1808,34 @@ export default {
|
|||
sourceType: ['camera'],
|
||||
success: res => {
|
||||
console.log('?? ~ res-拍照:', res)
|
||||
this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
|
||||
uni.uploadFile({
|
||||
url: config.realFileUrl + `file/uploadFaceRecognition`, //服务器地址
|
||||
fileType: 'image', //ZFB必填,不然报错
|
||||
filePath: res.tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
|
||||
formData: {
|
||||
file: base64,
|
||||
optMode: 'replace',
|
||||
photoType: 'face',
|
||||
uniqueKey: this.entryIdNumberBean.idNumber
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
console.log(uploadFileRes)
|
||||
if (uploadFileRes.statusCode == 200) {
|
||||
uploadFileRes = JSON.parse(uploadFileRes.data)
|
||||
if (uploadFileRes.code == 200) {
|
||||
this.faceImgUrl = base64
|
||||
|
||||
if (type === 1) {
|
||||
this.entryTrainBean.companyExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
if (type === 2) {
|
||||
this.entryTrainBean.deptExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
if (type === 3) {
|
||||
this.entryTrainBean.eamExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast(uploadFileRes.msg)
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast('上传失败')
|
||||
uni.uploadFile({
|
||||
url: config.realFileUrl + `file/upload`, //服务器地址
|
||||
fileType: 'image', //ZFB必填,不然报错
|
||||
filePath: res.tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
|
||||
name: 'imgFile',
|
||||
formData: {
|
||||
photoType: 'Contract'
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
console.log(uploadFileRes)
|
||||
if (uploadFileRes.statusCode == 200) {
|
||||
if (type === 1) {
|
||||
this.entryTrainBean.companyExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
if (type === 2) {
|
||||
this.entryTrainBean.deptExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
if (type === 3) {
|
||||
this.entryTrainBean.eamExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast('上传失败')
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
uni.$u.toast('上传失败')
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
|
|
|
|||
|
|
@ -375,12 +375,12 @@
|
|||
<text>公司级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(1)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.companyExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.companyExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(1)">
|
||||
{{ entryTrainBean.companyExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -388,12 +388,12 @@
|
|||
<text>部门级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(2)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.deptExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.deptExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(2)">
|
||||
{{ entryTrainBean.deptExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -401,12 +401,12 @@
|
|||
<text>班组级级考试</text>
|
||||
</view>
|
||||
<view class="img-box">
|
||||
<view class="img-item upload-btn" @click="uploadFileTraining(2)">
|
||||
<image class="img" src="@/static/realName/tianjia-img.png" mode=""></image>
|
||||
</view>
|
||||
<view class="img-item" v-if="entryTrainBean.eamExamFilePath">
|
||||
<image class="img" :src="entryTrainBean.eamExamFilePath" mode=""></image>
|
||||
</view>
|
||||
<view style="margin-left: 40rpx" class="signBtn" @click="uploadFileTraining(3)">
|
||||
{{ entryTrainBean.eamExamFilePath ? '重新上传' : '附件上传' }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="form-input-box">
|
||||
|
|
@ -1881,45 +1881,34 @@ export default {
|
|||
sourceType: ['camera'],
|
||||
success: res => {
|
||||
console.log('?? ~ res-拍照:', res)
|
||||
this.imgToBase64(res.tempFilePaths[0]).then(base64 => {
|
||||
uni.uploadFile({
|
||||
url: config.realFileUrl + `file/uploadFaceRecognition`, //服务器地址
|
||||
fileType: 'image', //ZFB必填,不然报错
|
||||
filePath: res.tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
|
||||
formData: {
|
||||
file: base64,
|
||||
optMode: 'replace',
|
||||
photoType: 'face',
|
||||
uniqueKey: this.entryIdNumberBean.idNumber
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
console.log(uploadFileRes)
|
||||
if (uploadFileRes.statusCode == 200) {
|
||||
uploadFileRes = JSON.parse(uploadFileRes.data)
|
||||
if (uploadFileRes.code == 200) {
|
||||
this.faceImgUrl = base64
|
||||
|
||||
if (type === 1) {
|
||||
this.entryTrainBean.companyExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
if (type === 2) {
|
||||
this.entryTrainBean.deptExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
if (type === 3) {
|
||||
this.entryTrainBean.eamExamFilePath = uploadFileRes.data.url
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast(uploadFileRes.msg)
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast('上传失败')
|
||||
uni.uploadFile({
|
||||
url: config.realFileUrl + `file/upload`, //服务器地址
|
||||
fileType: 'image', //ZFB必填,不然报错
|
||||
filePath: res.tempFilePaths[0], //这个就是我们上面拍照返回或者先中照片返回的数组
|
||||
name: 'imgFile',
|
||||
formData: {
|
||||
photoType: 'Contract'
|
||||
},
|
||||
success: uploadFileRes => {
|
||||
console.log(uploadFileRes)
|
||||
if (uploadFileRes.statusCode == 200) {
|
||||
if (type === 1) {
|
||||
this.entryTrainBean.companyExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
},
|
||||
fail: err => {
|
||||
if (type === 2) {
|
||||
this.entryTrainBean.deptExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
if (type === 3) {
|
||||
this.entryTrainBean.eamExamFilePath = config.realBaseUrl + JSON.parse(uploadFileRes.data).data.url
|
||||
}
|
||||
} else {
|
||||
uni.$u.toast('上传失败')
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
uni.$u.toast('上传失败')
|
||||
console.log(err)
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: err => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue