|
|
@ -46,6 +46,7 @@ export default { |
|
|
|
{ id: 1, name: '项目经理', mine: 0, pm: 1, sequence: 1 }, |
|
|
|
{ id: 2, name: '运维', mine: 0, pm: 0, sequence: 2 }, |
|
|
|
], |
|
|
|
roleLeft: 0, |
|
|
|
}; |
|
|
|
}, |
|
|
|
|
|
|
@ -69,6 +70,16 @@ export default { |
|
|
|
} else { |
|
|
|
this.roles = [...this.visibleRoles]; |
|
|
|
} |
|
|
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
const query = uni.createSelectorQuery().in(this); |
|
|
|
query |
|
|
|
.selectAll('.tab-children') |
|
|
|
.boundingClientRect(data => { |
|
|
|
this.roleLeft = data[0].left; |
|
|
|
}) |
|
|
|
.exec(); |
|
|
|
}); |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
@ -77,7 +88,6 @@ export default { |
|
|
|
...mapMutations('task', ['setPermanents', 'clearEndFlag']), |
|
|
|
|
|
|
|
scroll(e) { |
|
|
|
console.log(e.detail.scrollLeft); |
|
|
|
this.scrollLeft = e.detail.scrollLeft; |
|
|
|
}, |
|
|
|
|
|
|
@ -88,10 +98,7 @@ export default { |
|
|
|
.selectAll('.tab-children') |
|
|
|
.boundingClientRect(data => { |
|
|
|
data.forEach(item => { |
|
|
|
this.tabList.push({ |
|
|
|
width: item.width, |
|
|
|
left: item.left, |
|
|
|
}); |
|
|
|
this.tabList.push({ width: item.width }); |
|
|
|
}); |
|
|
|
}) |
|
|
|
.exec(); |
|
|
@ -102,14 +109,15 @@ export default { |
|
|
|
// 当前滚动的位置 |
|
|
|
let left = 0; |
|
|
|
for (let i = 0; i < index; i++) { |
|
|
|
left += this.tabList[i].width + (this.tabList[0].left - 8) * 2; |
|
|
|
left += this.tabList[i].width + (this.roleLeft - 8) * 2; |
|
|
|
} |
|
|
|
left += (this.tabList[index].width + (this.tabList[0].left - 8) * 2) / 2; |
|
|
|
|
|
|
|
left += (this.tabList[index].width + (this.roleLeft - 8) * 2) / 2; |
|
|
|
if (left > screenWidth) { |
|
|
|
this.scrollLeft = left - screenWidth + screenWidth / 2; |
|
|
|
} else if (left > screenWidth / 2) { |
|
|
|
this.scrollLeft = left - screenWidth / 2; |
|
|
|
} else { |
|
|
|
} else if (left < screenWidth / 2) { |
|
|
|
this.scrollLeft = 0; |
|
|
|
} |
|
|
|
}, |
|
|
|