var vms = Vue.component("amplify-lzgcjs", {
template: `
`,
props: {
modeltitle:{
type:String
},
},
data() {
return {
show: false,
height: 510,
width: 910,
forData: [],
arrowLeft: -45,
arrowRight:-45,
interval:undefined,
left:0,
direction:'left',
projectId:JSON.parse(localStorage.getItem("data")).id,
datas:[]
}
},
mounted() {
},
methods: {
openAmplify() {
this.show = true
this.getData()
},
closeAmplify() {
this.show = false
},
closeAmplifyAll(e) {
if (e.target.className == 'amplify-fixed') {
this.show = false
}
},
// 调用接口
getData() {
let that = this
axios.get("/api/building/info?project_id=" + this.projectId).then(res => {
let data = res.data.data
let type = {}
for (let info of data) {
if (!type[info.sub_type]) {
type[info.sub_type] = new Array()
}
info.url = (info.file_path.indexOf("https") != -1) ? info.file_path : info.file_src
info.text = info.file_name
type[info.sub_type].push(info)
}
that.forData = type[5];
console.log(type)
// console.log(that.forData)
that.forData.map(item=>this.datas.push(item.url))
}).catch(err => {
})
},
carouselMouseover() {
this.arrowLeft = 10
this.arrowRight = 10
clearInterval(this.interval);
},
carouselMouseout() {
this.arrowLeft = -30
this.arrowRight = -30
this.direction = 'left'
this.interval = setInterval(this.timer, 3000);
},
clickCtrl(direction) {
this.direction = direction
this.timer()
},
timer() {
if (this.direction == 'left') {
this.left = this.left - this.width
if (this.left == -((this.forData.length) * this.width)) {
this.left = 0
}
} else {
if (this.left == 0) {
this.left = -((this.forData.length - 1) * this.width)
} else {
this.left = this.left + this.width
}
}
},
},
watch: {}
})