77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
// 本地资格补充核验页 U63
|
|||
|
|
// 用户上传佐证材料(工作证明/居住证明等)
|
||
|
|
|
||
|
|
Page({
|
||
|
|
data: {
|
||
|
|
eligibilityType: '',
|
||
|
|
evidenceTypes: [
|
||
|
|
{ value: 'employment_proof', label: '工作证明', desc: '劳动合同/工牌/在职证明等' },
|
||
|
|
{ value: 'residence_proof', label: '居住证明', desc: '房产证/租赁合同/水电账单等' },
|
||
|
|
{ value: 'household_proof', label: '户籍证明', desc: '户口本/户籍页等' },
|
||
|
|
{ value: 'other', label: '其他材料', desc: '能证明您在丹阳的材料' }
|
||
|
|
],
|
||
|
|
selectedType: '',
|
||
|
|
uploadedFileIds: [] as string[]
|
||
|
|
},
|
||
|
|
|
||
|
|
onLoad(options: Record<string, string>) {
|
||
|
|
if (options.type) {
|
||
|
|
this.setData({ eligibilityType: options.type })
|
||
|
|
}
|
||
|
|
},
|
||
|
|
|
||
|
|
onShow() {
|
||
|
|
// TODO: P04-V11 加载当前用户的已上传佐证
|
||
|
|
},
|
||
|
|
|
||
|
|
// 选择佐证类型
|
||
|
|
onEvidenceTypeSelect(e: WechatMiniprogram.TouchEvent) {
|
||
|
|
this.setData({ selectedType: e.currentTarget.dataset.type })
|
||
|
|
},
|
||
|
|
|
||
|
|
// 上传图片
|
||
|
|
onChooseImage() {
|
||
|
|
wx.chooseMedia({
|
||
|
|
count: 6,
|
||
|
|
mediaType: ['image'],
|
||
|
|
sourceType: ['album', 'camera'],
|
||
|
|
success: (res) => {
|
||
|
|
// TODO: P04-V11 上传到对象存储,获取fileId
|
||
|
|
res.tempFiles.forEach(file => {
|
||
|
|
console.log('选择的图片:', file.tempFilePath)
|
||
|
|
})
|
||
|
|
wx.showToast({ title: '上传成功', icon: 'success' })
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
// 提交审核
|
||
|
|
onSubmit() {
|
||
|
|
if (!this.data.selectedType) {
|
||
|
|
wx.showToast({ title: '请选择佐证类型', icon: 'none' })
|
||
|
|
return
|
||
|
|
}
|
||
|
|
if (this.data.uploadedFileIds.length === 0) {
|
||
|
|
wx.showToast({ title: '请上传佐证材料', icon: 'none' })
|
||
|
|
return
|
||
|
|
}
|
||
|
|
// TODO: P04-V11 调用API提交
|
||
|
|
wx.showLoading({ title: '提交中...' })
|
||
|
|
setTimeout(() => {
|
||
|
|
wx.hideLoading()
|
||
|
|
wx.showToast({ title: '已提交审核', icon: 'success' })
|
||
|
|
setTimeout(() => {
|
||
|
|
wx.navigateBack()
|
||
|
|
}, 1500)
|
||
|
|
}, 1000)
|
||
|
|
},
|
||
|
|
|
||
|
|
// 删除已上传图片
|
||
|
|
onRemoveImage(e: WechatMiniprogram.TouchEvent) {
|
||
|
|
const index = e.currentTarget.dataset.index
|
||
|
|
const ids = this.data.uploadedFileIds
|
||
|
|
ids.splice(index, 1)
|
||
|
|
this.setData({ uploadedFileIds: ids })
|
||
|
|
}
|
||
|
|
})
|