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,12 +141,21 @@
addPhoto () { addPhoto () {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 9,
sizeType: ['compressed'], sizeType: ['compressed'],
success: res => { success: res => {
this.$loading() res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData() let formData = new FormData()
formData.append('file', res.tempFiles[0]) formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => { this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.richList.push({ this.richList.push({
@@ -157,8 +166,6 @@
this.$u.toast(res.msg) this.$u.toast(res.msg)
} }
}) })
}
})
}, },
confirm () { confirm () {

View File

@@ -150,12 +150,21 @@
addPhoto () { addPhoto () {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 9,
sizeType: ['compressed'], sizeType: ['compressed'],
success: res => { success: res => {
this.$loading() res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData() let formData = new FormData()
formData.append('file', res.tempFiles[0]) formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => { this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.richList.push({ this.richList.push({
@@ -166,8 +175,6 @@
this.$u.toast(res.msg) this.$u.toast(res.msg)
} }
}) })
}
})
}, },
confirm () { confirm () {

View File

@@ -171,12 +171,21 @@
addPhoto () { addPhoto () {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 9,
sizeType: ['compressed'], sizeType: ['compressed'],
success: res => { success: res => {
this.$loading() res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData() let formData = new FormData()
formData.append('file', res.tempFiles[0]) formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => { this.$http.post('/admin/file/add2?type=image', formData).then(res => {
if (res.code === 0) { if (res.code === 0) {
this.richList.push({ this.richList.push({
@@ -187,8 +196,6 @@
this.$u.toast(res.msg) this.$u.toast(res.msg)
} }
}) })
}
})
}, },
confirm () { confirm () {

View File

@@ -141,14 +141,22 @@
addPhoto () { addPhoto () {
uni.chooseImage({ uni.chooseImage({
count: 1, count: 9,
sizeType: ['compressed'], sizeType: ['compressed'],
success: res => { success: res => {
this.$loading() res.tempFiles.forEach(v => {
this.upload(v)
})
}
})
},
upload (img) {
let formData = new FormData() let formData = new FormData()
formData.append('file', res.tempFiles[0]) formData.append('file', img)
this.$loading()
this.$http.post('/admin/file/add2?type=image', formData).then(res => { this.$http.post('/admin/file/add2?type=image', formData).then(res => {
console.log(res)
if (res.code === 0) { if (res.code === 0) {
this.richList.push({ this.richList.push({
type: 'img', type: 'img',
@@ -158,8 +166,6 @@
this.$u.toast(res.msg) this.$u.toast(res.msg)
} }
}) })
}
})
}, },
confirm () { confirm () {