This commit is contained in:
yanran200730
2022-05-30 16:12:00 +08:00
parent 349692bde6
commit 6a5b244d92
4 changed files with 80 additions and 53 deletions

View File

@@ -141,26 +141,33 @@
addPhoto () {
uni.chooseImage({
count: 1,
count: 9,
sizeType: ['compressed'],
success: res => {
this.$loading()
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData()
formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
})
},
confirm () {
if (!this.content) {
return this.$u.toast('文本不能为空')

View File

@@ -150,26 +150,33 @@
addPhoto () {
uni.chooseImage({
count: 1,
count: 9,
sizeType: ['compressed'],
success: res => {
this.$loading()
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData()
formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
})
},
confirm () {
if (!this.content) {
return this.$u.toast('文本不能为空')

View File

@@ -171,26 +171,33 @@
addPhoto () {
uni.chooseImage({
count: 1,
count: 9,
sizeType: ['compressed'],
success: res => {
this.$loading()
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData()
formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
})
},
confirm () {
if (!this.content) {
return this.$u.toast('文本不能为空')

View File

@@ -141,27 +141,33 @@
addPhoto () {
uni.chooseImage({
count: 1,
count: 9,
sizeType: ['compressed'],
success: res => {
this.$loading()
let formData = new FormData()
formData.append('file', res.tempFiles[0])
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
console.log(res)
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData()
formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) {
this.richList.push({
type: 'img',
value: res.data.url
})
} else {
this.$u.toast(res.msg)
}
})
},
confirm () {
if (!this.content) {
return this.$u.toast('文本不能为空')