Commit 1e373745 authored by xd's avatar xd

图片地址

parent fe81399e
......@@ -16,3 +16,11 @@ export function editStore(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 @@
<script>
import { quillEditor, Quill } from "vue-quill-editor";
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.snow.css";
import "quill/dist/quill.bubble.css";
......@@ -128,38 +128,49 @@ export default {
return true
},
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()
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
uploadPic(params).then(res => {
console.log(res,'文件');
return res.data.imgPath
})
},
deleteLogo(file) {
this.addForm.logo = ''
},
async handleSave() {
handleBannerList() {
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'
this.addForm.oyStallCode = 1
let lists = ''
await this.bannerList.forEach( async item => {
let img = await this.getImgUrl(item.file)
console.log(img,'imggggg')
let carousel = ''
this.bannerList.forEach( item => {
console.log(item.file,'item');
let img = this.getImgUrl(item.file)
console.log(img,'img')
list.push(img)
lists = list.toString()
})
console.log(carousel,'carousel111')
console.log(lists,'lists')
editStore(Object.assign(this.addForm,{ carousel })).then( res => {
console.log(res,'res')
})
carousel = list.toString()
console.log(carousel,'carousel1');
return carousel
})
},
handleSave() {
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) {
......
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