Commit 1e373745 authored by xd's avatar xd

图片地址

parent fe81399e
...@@ -16,3 +16,11 @@ export function editStore(data) { ...@@ -16,3 +16,11 @@ export function editStore(data) {
data data
}) })
} }
// 上传图片
export function uploadPic(data) {
return requestCF({
url: '/admin/auth/util/saveImg',
method: 'post',
data
})
}
\ No newline at end of file
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
<script> <script>
import { quillEditor, Quill } from "vue-quill-editor"; import { quillEditor, Quill } from "vue-quill-editor";
import { container, ImageExtend, QuillWatch } from "quill-image-extend-module"; import { container, ImageExtend, QuillWatch } from "quill-image-extend-module";
import { editStore } from "@/api/sidebar/voucher"; import { editStore, uploadPic } from "@/api/sidebar/voucher";
import "quill/dist/quill.core.css"; import "quill/dist/quill.core.css";
import "quill/dist/quill.snow.css"; import "quill/dist/quill.snow.css";
import "quill/dist/quill.bubble.css"; import "quill/dist/quill.bubble.css";
...@@ -128,38 +128,49 @@ export default { ...@@ -128,38 +128,49 @@ export default {
return true return true
}, },
async afterRead (file) { async afterRead (file) {
this.addForm.logo = await this.getImgUrl(file.file)//使用上传的方法。file.file // this.addForm.logo = await this.getImgUrl(file.file)//使用上传的方法。file.file
this.addForm.logo = this.getImgUrl(file.file)
}, },
async getImgUrl(file) { // async getImgUrl(file) {
// let params = new FormData()
// params.append('file', file)
// let url = 'http://139.155.48.151:8084/admin/auth/util/saveImg'
// const img = await axios.post(url, params)
// let urls = img.data.data.imgPath
// console.log(urls,'urls')
// return urls
// },
getImgUrl(file) {
let params = new FormData() let params = new FormData()
params.append('file', file) params.append('file', file)
let url = 'http://139.155.48.151:8084/admin/auth/util/saveImg' uploadPic(params).then(res => {
const img = await axios.post(url, params) console.log(res,'文件');
let urls = img.data.data.imgPath return res.data.imgPath
console.log(urls,'urls') })
return urls
}, },
deleteLogo(file) { deleteLogo(file) {
this.addForm.logo = '' this.addForm.logo = ''
}, },
async handleSave() { handleBannerList() {
let list = [] let list = []
let carousel = 'http://139.155.48.151/img/39e948a1-83ae-4769-bd8b-cbdca065a17a.jpeg,http://139.155.48.151/img/1f10d588-13bf-4436-98f0-88bebe557f6f.jpg' let carousel = ''
this.addForm.oyStallCode = 1 this.bannerList.forEach( item => {
let lists = '' console.log(item.file,'item');
await this.bannerList.forEach( async item => { let img = this.getImgUrl(item.file)
let img = await this.getImgUrl(item.file) console.log(img,'img')
console.log(img,'imggggg')
list.push(img) list.push(img)
lists = list.toString() carousel = list.toString()
}) console.log(carousel,'carousel1');
console.log(carousel,'carousel111') return carousel
console.log(lists,'lists') })
},
editStore(Object.assign(this.addForm,{ carousel })).then( res => { handleSave() {
console.log(res,'res') this.addForm.oyStallCode = 1
}) const carousel = this.handleBannerList()
console.log(carousel,'carouse2')
// editStore(Object.assign(this.addForm,{ carousel })).then( res => {
// console.log(res,'res')
// })
}, },
deleteBanner(file) { deleteBanner(file) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment