|
@@ -51,30 +51,29 @@ export default {
|
|
|
mounted() {
|
|
|
// this.removeBottom(-1)
|
|
|
// this.tabFloor()
|
|
|
- console.log(`floorsArr---------------:\n`, this.floorsArr)
|
|
|
this.init()
|
|
|
},
|
|
|
watch: {
|
|
|
// 监听floorsArr的变化
|
|
|
- /* floorsArr: {
|
|
|
- handler(newVal, oldVal) {
|
|
|
- this.init()
|
|
|
+ '$store.state.floorsArr': {
|
|
|
+ handler(newV, oldV) {
|
|
|
+ newV && this.init()
|
|
|
},
|
|
|
- deep: true,
|
|
|
- immediate: true
|
|
|
- } */
|
|
|
+ deep: true
|
|
|
+ }
|
|
|
},
|
|
|
computed: {
|
|
|
...mapGetters(['floorsArr'])
|
|
|
},
|
|
|
methods: {
|
|
|
init() {
|
|
|
- window.vm = this
|
|
|
+ if (!this.floorsArr.length) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
this.floorIdArr = []
|
|
|
this.floorsArr.map(item => {
|
|
|
this.floorIdArr.push(item.seq)
|
|
|
})
|
|
|
- console.log('cookie:', this.$cookie.get('currentFloorId'))
|
|
|
this.currentFloorId = Number(this.$cookie.get('currentFloorId') || 100)
|
|
|
this.changeFloor(0)
|
|
|
},
|
|
@@ -84,7 +83,6 @@ export default {
|
|
|
* @description 点击图例下方的,上下切换按钮
|
|
|
*/
|
|
|
changeFloor(flag) {
|
|
|
- console.log(this.floorIdArr)
|
|
|
const len = this.floorIdArr.length
|
|
|
let index = this.floorIdArr.findIndex(item => item === this.currentFloorId)
|
|
|
// 点击上箭头
|
|
@@ -98,9 +96,6 @@ export default {
|
|
|
}
|
|
|
// 数据处理
|
|
|
this.handleCookie()
|
|
|
- // debugger
|
|
|
- console.log('---------------index:', index, '--------------')
|
|
|
- console.log('---------------floorIdArr:', this.floorIdArr, '--------------')
|
|
|
//楼层位置处理,
|
|
|
const inner = document.querySelectorAll('.floor-item')
|
|
|
const innerbox = document.querySelector('.floor-center')
|
|
@@ -113,7 +108,8 @@ export default {
|
|
|
// flag 为0时,timer设置为0
|
|
|
flag === 0 && (timer = 0)
|
|
|
if (index >= showNumber - 1) {
|
|
|
- index < len - 1 && animate(innerbox, { marginTop: -height * (index - (showNumber - 2)) }, timer)
|
|
|
+ animate(innerbox, { marginTop: -height * (index - (showNumber - 2)) }, timer)
|
|
|
+ // index < len - 1 && animate(innerbox, { marginTop: -height * (index - (showNumber - 2)) }, timer)
|
|
|
} else {
|
|
|
// 前 showNumber 条的margin-top设置为0
|
|
|
animate(innerbox, { marginTop: 0 }, 500)
|
|
@@ -138,7 +134,6 @@ export default {
|
|
|
// 最后一条的 下箭头设置为禁用
|
|
|
case len - 1:
|
|
|
this.currentFloorId = this.floorIdArr[len - 1]
|
|
|
- console.log('currentFloorId', this.currentFloorId)
|
|
|
this.showT = true
|
|
|
this.showB = false
|
|
|
break
|
|
@@ -155,9 +150,6 @@ export default {
|
|
|
*/
|
|
|
handleCookie() {
|
|
|
let currentFloor = this.floorsArr.filter(item => item.seq == this.currentFloorId)[0]
|
|
|
- console.log('------------------------')
|
|
|
- console.log('currentFloor', currentFloor)
|
|
|
- console.log('------------------------')
|
|
|
this.$cookie.set('floorNow', currentFloor.code, 3)
|
|
|
this.$cookie.set('floorMapId', currentFloor.gname, 3)
|
|
|
this.$cookie.set('currentFloorId', currentFloor.seq, 3)
|
|
@@ -175,21 +167,6 @@ export default {
|
|
|
this.handleCookie()
|
|
|
this.handleUpDownStatus(index, this.floorIdArr.length)
|
|
|
},
|
|
|
- /* tabFloor(item = this.floor, index) {
|
|
|
- console.log(this.num)
|
|
|
- if (this.num <= -1) {
|
|
|
- this.showT = true
|
|
|
- }
|
|
|
- if (this.num > -1) {
|
|
|
- this.showB = true
|
|
|
- }
|
|
|
- this.$cookie.set('floorNow', item.code, 3)
|
|
|
- this.$cookie.set('floorMapId', item.gname, 3)
|
|
|
- this.floorId = this.$cookie.get('floorNow') || item.code
|
|
|
- this.floorMapIdName = this.$cookie.get('floorMapId') || item.gname
|
|
|
- this.$emit('emitFloor', item)
|
|
|
- }, */
|
|
|
-
|
|
|
removeTop(num) {
|
|
|
console.log(num)
|
|
|
if (num == -1) {
|