This commit is contained in:
parent
a889abcfc0
commit
ba71fc79c9
|
|
@ -21,7 +21,7 @@ const isError = ref(false)
|
||||||
const taskDescribe = ref('')
|
const taskDescribe = ref('')
|
||||||
|
|
||||||
const origin = window.location.href
|
const origin = window.location.href
|
||||||
const taskId = ref('')
|
const taskId = ref('26')
|
||||||
|
|
||||||
if (origin.indexOf('=') > -1) {
|
if (origin.indexOf('=') > -1) {
|
||||||
taskId.value = origin.split('=')[1]
|
taskId.value = origin.split('=')[1]
|
||||||
|
|
@ -42,7 +42,7 @@ const getTaskDetailsData = async () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getTaskDetailsData()
|
// getTaskDetailsData()
|
||||||
|
|
||||||
// 填写意见按钮
|
// 填写意见按钮
|
||||||
const onSubmitOptions = () => {
|
const onSubmitOptions = () => {
|
||||||
|
|
|
||||||
|
|
@ -181,6 +181,7 @@ const onSubmitOptions = () => {
|
||||||
.then(async (valid) => {
|
.then(async (valid) => {
|
||||||
if (valid) {
|
if (valid) {
|
||||||
let files = []
|
let files = []
|
||||||
|
if (fileList.value.length > 0) {
|
||||||
fileList.value.forEach((f) => {
|
fileList.value.forEach((f) => {
|
||||||
let d = {
|
let d = {
|
||||||
file: f.url,
|
file: f.url,
|
||||||
|
|
@ -189,6 +190,7 @@ const onSubmitOptions = () => {
|
||||||
}
|
}
|
||||||
files.push(d)
|
files.push(d)
|
||||||
})
|
})
|
||||||
|
|
||||||
uni.uploadFile({
|
uni.uploadFile({
|
||||||
url: '/manager/option/appUploadFile',
|
url: '/manager/option/appUploadFile',
|
||||||
files: files,
|
files: files,
|
||||||
|
|
@ -214,6 +216,44 @@ const onSubmitOptions = () => {
|
||||||
},
|
},
|
||||||
fail: (err) => {},
|
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(() => {
|
.catch(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue