handleFileUpload(event) {
event.preventDefault()
//获取文件信息
this.formData = new FormData()
let file = this.$refs.file.files
this.formData.append('fingerprint', file[0])
this.ruleForm.fingerprint = file[0]['name']
event.srcElement.value = ""
},
submitForms() {
const parms = {
productName: this.ruleForm.productName,
productType: this.ruleForm.productType,
startTime: (this.ruleForm.startTime ? this.ruleForm.startTime.getTime() : ''),
endTime: (this.ruleForm.endTime ? this.ruleForm.endTime.getTime() : '')
}
const json = JSON.stringify(parms)
// 将 json 字符串转化为 Blob 对象
const blob = new Blob([json], {
type: 'application/json',
})
this.formData.append('request', blob)
this.$http({
url: this.$http.adornUrl('/auth/addAuth'),
method: 'post',
headers: {
'Content-Type': 'multipart/form-data'
},
data: this.formData
}).then(({ data }) => {
if (data && data.code == '200') {
this.$message({
message: '申请授权成功',
type: 'success'
})
this.getDataList()
} else {
this.$message.error(data && data.message)
}
this.isShowDialog = false
})
}