自定义外层问题上传报错
continuous-integration/drone/push Build is passing Details

main
wangxiaoshuang 2025-07-30 13:56:38 +08:00
parent f7a62b2016
commit 98dc6beba5
1 changed files with 16 additions and 12 deletions

View File

@ -1255,18 +1255,22 @@ export default {
text: 'Loading', text: 'Loading',
spinner: 'el-icon-loading' spinner: 'el-icon-loading'
}) })
var fileName = param.file.name try {
var index = fileName.lastIndexOf('.') var fileName = param.file.name
var suffix = fileName.substring(index + 1, url.length) var index = fileName.lastIndexOf('.')
let file = await this.fileToBlob(param.file) var suffix = fileName.substring(index + 1, fileName.length)
// let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file) let file = await this.fileToBlob(param.file)
const taskInfo = JSON.parse(localStorage.getItem('taskInfo')) // let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Customize/${this.visitTaskId}/${fileName}`, file)
const subjectId = taskInfo.SubjectId const taskInfo = JSON.parse(localStorage.getItem('taskInfo'))
let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Read/${subjectId}/${this.visitTaskId}/${fileName}`, file) const subjectId = taskInfo.SubjectId
this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}(${suffix})`, url: this.$getObjectName(res.url) }) let res = await this.OSSclient.put(`/${this.$route.query.trialId}/Read/${subjectId}/${this.visitTaskId}/${fileName}`, file)
this.urls.push(this.$getObjectName(res.url)) this.fileList.push({ name: `${this.$t('trials:emailManageCfg:title:fileName')}${this.fileList.length + 1}(${suffix})`, url: this.$getObjectName(res.url) })
this.$emit("setFormItemData", { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question }) this.urls.push(this.$getObjectName(res.url))
this.$set(this.QuestionsForm, this.question.Id, this.urls.length > 0 ? this.urls.join('|') : '') this.$emit("setFormItemData", { key: this.question.Id, val: this.urls.length > 0 ? this.urls.join('|') : '', question: this.question })
this.$set(this.QuestionsForm, this.question.Id, this.urls.length > 0 ? this.urls.join('|') : '')
} catch (err) {
console.log(err)
}
loading.close() loading.close()
// uploadReadingAnswerImage(this.$route.query.trialId, this.visitTaskId, formData).then(res => { // uploadReadingAnswerImage(this.$route.query.trialId, this.visitTaskId, formData).then(res => {
// if (res.IsSuccess) { // if (res.IsSuccess) {