Commit 02f5c0ea authored by xd's avatar xd

页面轮播图 以及修改轮播图多图上传测试

parent 9224f37c
......@@ -126,6 +126,8 @@
pagination: {
el: '.swiper-pagination',
},
observer:true,
observeParents:true
})
$(function () {
showQRInfo()
......@@ -134,19 +136,17 @@
$.ajax({
type: 'GET',
url: `http://139.155.48.151:8084/admin/auth/stall/getByOyStallCode?oyStallCode=${oyStallCode}`,
// url: `http://139.155.48.151:8084/admin/auth/stall/getByOyStallCode?oyStallCode=1`,
success: function (data) {
console.log(data,'data')
var str = "";
for (i = 0; i < data.data.carousel.length; i++) {
var _data = data.data.carousel[i]
str += '<div class="swiper-slide"><img src="'+ _data + '" alt=""></div>'
for (i = 0; i < data.data.carousel.length; i++) {
var _data = data.data.carousel[i]
str += '<div class="swiper-slide"><img src="'+ _data + '" alt=""></div>'
}
$("#slider").append(str)
var mySwiper = new Swiper('.swiper-container', {
loop: true,
autoplay: true,
pagination: '.swiper-pagination',
})
let r1 = document.getElementById('slider').innerHTML
let r = document.getElementById('slider').innerHTML
let info = data.data.stallInfo
$("#logo").attr('src',info.logo)
$(".title").text(info.name)
......
......@@ -57,6 +57,7 @@
:before-read="beforeRead"
:after-read="afterAddBanner"
@delete="deleteBanner"
multiple="true"
/>
<quill-editor
v-model="addForm.summary"
......@@ -170,11 +171,25 @@ export default {
this.$emit("input", this.addForm.summary);
},
beforeRead(file) {
//上传之前校验
if (file.type !== "image/jpeg" && file.type !== "image/png") {
this.$toast("只允许上传jpg/png格式的图片!")
return false;
if(file.type) {
if (file.type !== "image/jpeg" && file.type !== "image/png") {
this.$toast("只允许上传jpg/png格式的图片!")
return false;
}
}else {
console.log(222);
file.forEach( item => {
if (item.type !== "image/jpeg" && item.type !== "image/png") {
this.$toast("只允许上传jpg/png格式的图片!")
}
})
// console.log(file,'file');
// console.log(file.type,'file.type');
}
//上传之前校验
return true;
},
async afterRead(file) {
......@@ -183,18 +198,27 @@ export default {
console.log(this.addForm.logo, "this.addForm.logo");
},
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 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;
},
async afterAddBanner(file) {
let img = await this.getImgUrl(file.file);
this.list.push(img);
console.log(this.list, "list");
if(file.file) {
let img = await this.getImgUrl(file.file);
this.list.push(img);
}else {
file.forEach(async item => {
let imgs = await this.getImgUrl(item.file)
this.list.push(imgs);
console.log(this.list,'list1')
})
}
},
deleteBanner(file, index) {
this.list.splice(index.index, 1);
......@@ -230,11 +254,13 @@ export default {
this.$toast("请输入正文")
return false
}
editStore(Object.assign(this.addForm,{ carousel })).then( res => {
if(res.result == 'success') {
this.$router.go(-1)
}
})
console.log(Object.assign(this.addForm,{ carousel }),'11');
editStore(Object.assign(this.addForm,{ carousel })).then( res => {
if(res.result == 'success') {
this.$router.go(-1)
}
})
}
}
};
......
......@@ -5,7 +5,7 @@
<img class="logos-logo" :src="test.manInfo.logoUrl" />
</div>
<div class="manInfo-name" @click="manInfoClick">我的专柜:{{test.manInfo.barName}}</div>
<div class="manInfo-switch" @click="switchBarClick">
<div class="manInfo-switch" @click="switchBarClick" v-if="flag == 1">
<div class="switch-text">切换</div>
<img class="switch-icon" :src="test.manInfo.icon['1']" />
</div>
......@@ -26,7 +26,7 @@
<img class="menu-logo" :src="test.menuInfo.icon['2']" />
<div class="menu-text">任务列表</div>
</div>
<div class="menu" @click="menu05Click" v-if="flag == 1">
<div class="menu margin1" @click="menu05Click" v-if="flag == 1">
<img class="menu-logo" :src="test.menuInfo.icon['5']" />
<div class="menu-text">活动模版</div>
</div>
......@@ -40,7 +40,7 @@
<img class="menu-logo" :src="test.menuInfo.icon['4']" />
<div class="menu-text">专柜维护</div>
</div>
<div class="menu" @click="handleCoupon" v-if="flag == 1">
<div class="menu margin2" @click="handleCoupon" v-if="flag == 1">
<img class="menu-logo" :src="test.menuInfo.icon['1']" />
<div class="menu-text">优惠券管理</div>
</div>
......@@ -218,7 +218,7 @@ export default {
userInfoResOld: "",
userInfoResNew: ""
},
flag: 1
flag: 2
};
},
created() {
......
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