var vms = Vue.component("amplify-jsfh", { template: `
`, props: { }, data() { return { show:false, costIndex:0, imgRollInterval:undefined, direction:'left', list:[], number:2, projectId:JSON.parse(window.localStorage.getItem("data")).id, } }, mounted(){ // 图片轮播 定时器 this.imgRollInterval = setInterval(this.imgRoll,5000); }, methods: { openAmplify(){ this.show = true this.getTypeSonListB() }, closeAmplify(){ this.show = false }, closeAmplifyAll(e){ if(e.target.className == 'amplify-fixed'){ this.show = false } }, getTypeSonListB() { this.list = [] axios.post("/system/photoTechnicalReview/getPhotoTechnicalReview",{projectId:this.projectId}).then(res => { var list = [] res.data.rows.forEach((item)=>{ list.push(item.photoUrl) }) this.list = list }) }, carouselLeft(){ this.direction = 'left' this.manufacturingCostRoll() }, carouselRight(){ this.direction = 'right' this.manufacturingCostRoll() }, manufacturingCostRoll(){ var width = $(".bzh-content-img").innerWidth() if(this.direction == 'right'){ if(this.costIndex == this.list.length - this.number){ this.costIndex = 0 }else{ this.costIndex = this.costIndex + 1 } }else{ if(this.costIndex == 0){ this.costIndex = this.list.length - this.number }else{ this.costIndex = this.costIndex - 1 } } console.log(this.costIndex) $(this.$refs.rollImgMax).animate({scrollLeft:(this.number*width*this.costIndex)+'px'}) this.direction = 'right' }, imgRoll(){ var width = $(".bzh-content-img").innerWidth() if(this.costIndex == this.list.length - this.number){ this.costIndex = 0 }else{ this.costIndex = this.costIndex + 1 } $(this.$refs.rollImgMax).animate({scrollLeft:(this.number*width*this.costIndex)+'px'}) }, costMouseover(){ clearInterval(this.imgRollInterval); }, costMouseout(){ this.imgRollInterval=setInterval(this.imgRoll,5000); }, }, watch:{ }, })