修改上传图片分类, 优化接口报错处理

This commit is contained in:
mengxiaolong
2020-08-07 18:08:32 +08:00
parent 7b9915c12f
commit e90dc72a15
2 changed files with 68 additions and 30 deletions

View File

@@ -14,7 +14,10 @@
{{ supplement.descriptionInsurant }} {{ supplement.descriptionInsurant }}
</p> </p>
</div> </div>
<van-uploader :after-read="insurantUpload" name="id" v-model="supplement.idImgList" /> <p class="uploadTitle">身份证正面照片</p>
<van-uploader :max-count="1" :after-read="insurantUpload" name="insurantIdCardA" v-model="supplement.insurantIdCardA" />
<p class="uploadTitle">身份证背面照片</p>
<van-uploader :max-count="1" :after-read="insurantUpload" name="insurantIdCardB" v-model="supplement.insurantIdCardB" />
</div> </div>
</div> </div>
<div class="updateInfo"> <div class="updateInfo">
@@ -26,7 +29,12 @@
{{ supplement.descriptionPolicyholder }} {{ supplement.descriptionPolicyholder }}
</p> </p>
</div> </div>
<van-uploader :after-read="policyHolderUpload" name="copy" v-model="supplement.copyImgList" /> <p class="uploadTitle">身份证正面照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderIdCardA" v-model="supplement.policyholderIdCardA" />
<p class="uploadTitle">身份证背面照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderIdCardB" v-model="supplement.policyholderIdCardB" />
<p class="uploadTitle">银行卡照片</p>
<van-uploader :max-count="1" :after-read="policyHolderUpload" name="policyholderBankCardA" v-model="supplement.policyholderBankCardA" />
</div> </div>
</div> </div>
</div> </div>
@@ -145,10 +153,13 @@ export default {
// 投保人问题描述 // 投保人问题描述
descriptionPolicyholder: '', descriptionPolicyholder: '',
// 被保人身份证明 // 被保人身份证明
idImgList: [], insurantIdCardA: [],
insurantIdCardB: [],
insurantUploadResult: [], insurantUploadResult: [],
// 投保人身份证明等资料 // 投保人身份证明等资料
copyImgList: [], policyholderIdCardA: [],
policyholderIdCardB: [],
policyholderBankCardA: [],
policyholderUploadResult: [] policyholderUploadResult: []
}, },
newContract: { newContract: {
@@ -192,19 +203,29 @@ export default {
} }
}, },
methods: { methods: {
async policyHolderUpload(file) { async policyHolderUpload(file, detail) {
// 微信端将上传的图片保存到localstorage中供签名回调使用
if (this.isWeixin) {
localStorage.setItem(detail.name, file.content)
}
let res = await this.afterRead(file) let res = await this.afterRead(file)
this.supplement.policyholderUploadResult.push({ this.supplement.policyholderUploadResult.push({
rgssUrl: res.path rgssUrl: res.path
}) })
}, },
async insurantUpload(file) { async insurantUpload(file, detail) {
if (this.isWeixin) {
localStorage.setItem(detail.name, file.content)
}
let res = await this.afterRead(file) let res = await this.afterRead(file)
this.supplement.insurantUploadResult.push({ this.supplement.insurantUploadResult.push({
rgssUrl: res.path rgssUrl: res.path
}) })
}, },
async cardUpload(file) { async cardUpload(file, detail) {
if (this.isWeixin) {
localStorage.setItem(detail.name, file.content)
}
let res = await this.afterRead(file) let res = await this.afterRead(file)
this.transfer.cardUploadResult.push({ this.transfer.cardUploadResult.push({
rgssUrl: res.path rgssUrl: res.path
@@ -522,6 +543,11 @@ export default {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.uploadTitle {
font-size: 14px;
margin-bottom: 0.5em;
}
.bottom-btn { .bottom-btn {
z-index: 1; z-index: 1;
} }
@@ -620,7 +646,6 @@ export default {
} }
p { p {
line-height: 22px; line-height: 22px;
padding-bottom: 7px;
} }
} }
} }

View File

@@ -119,7 +119,7 @@ export default {
data() { data() {
return { return {
active: 0, active: 0,
pendingListLoading: false, pendingListLoading: true,
processedListLoading: false, processedListLoading: false,
pendingListFinished: false, pendingListFinished: false,
processedListFinished: false, processedListFinished: false,
@@ -149,6 +149,7 @@ export default {
this.searchValue = '' this.searchValue = ''
}, },
async loadMore() { async loadMore() {
try {
const rs = await getQuestionList({ const rs = await getQuestionList({
type: this.active, type: this.active,
pageInfo: { pageInfo: {
@@ -162,9 +163,15 @@ export default {
if (this.active === 0) { if (this.active === 0) {
this.pendingListLoading = false this.pendingListLoading = false
this.pendingList.push(...rs.content.list) this.pendingList.push(...rs.content.list)
this.pendingList.sort((prev, next) => {
return -(new Date(prev.createdTime).getTime() - new Date(next.createdTime).getTime())
})
} else { } else {
this.processedListLoading = false this.processedListLoading = false
this.processedList.push(...rs.content.list) this.processedList.push(...rs.content.list)
this.processedList.sort((prev, next) => {
return -(new Date(prev.createdTime).getTime() - new Date(next.createdTime).getTime())
})
} }
if (rs.content.pageNum >= rs.content.pages && this.active === 0) { if (rs.content.pageNum >= rs.content.pages && this.active === 0) {
this.pendingListFinished = true this.pendingListFinished = true
@@ -177,6 +184,12 @@ export default {
this.pendingListLoading = false this.pendingListLoading = false
this.processedListLoading = false this.processedListLoading = false
} }
} catch (reson) {
this.pendingListLoading = false
this.pendingListFinished = true
this.processedListLoading = false
this.processedListFinished = true
}
}, },
changeProblemList() { changeProblemList() {
this.currentPage = 1 this.currentPage = 1