This commit is contained in:
BianLzhaoMin 2025-04-01 09:53:37 +08:00
parent a889abcfc0
commit ba71fc79c9
2 changed files with 74 additions and 34 deletions

View File

@ -21,7 +21,7 @@ const isError = ref(false)
const taskDescribe = ref('')
const origin = window.location.href
const taskId = ref('')
const taskId = ref('26')
if (origin.indexOf('=') > -1) {
taskId.value = origin.split('=')[1]
@ -42,7 +42,7 @@ const getTaskDetailsData = async () => {
}
}
getTaskDetailsData()
// getTaskDetailsData()
//
const onSubmitOptions = () => {

View File

@ -181,6 +181,7 @@ const onSubmitOptions = () => {
.then(async (valid) => {
if (valid) {
let files = []
if (fileList.value.length > 0) {
fileList.value.forEach((f) => {
let d = {
file: f.url,
@ -189,6 +190,7 @@ const onSubmitOptions = () => {
}
files.push(d)
})
uni.uploadFile({
url: '/manager/option/appUploadFile',
files: files,
@ -214,6 +216,44 @@ const onSubmitOptions = () => {
},
fail: (err) => {},
})
} else {
const boundary = '----WebKitFormBoundary' + Math.random().toString(16).substr(2)
const data =
`--${boundary}\r\n` +
`Content-Disposition: form-data; name="param"\r\n\r\n` +
`${JSON.stringify(opinionModel.value)}\r\n` +
`--${boundary}--`
uni.request({
url: '/manager/option/appUploadFile',
method: 'POST',
header: {
'Content-Type': `multipart/form-data; boundary=${boundary}`,
},
data: data,
success: (res) => {
res = JSON.parse(res.data)
if (res.data === '添加成功') {
uni.$u.toast('提交成功')
opinionModel.value = {
userName: '',
userPhone: '',
unit: '',
userOpinion: '',
}
fileList.value = []
isSuccess.value = true
} else {
uni.$u.toast('添加失败' + res.data)
}
},
fail: (err) => {
//
},
})
console.log(result, 'result')
}
}
})
.catch(() => {