|
|
|
|
@ -294,7 +294,6 @@ export default {
|
|
|
|
|
courseSystemTimer: null, // 定时器
|
|
|
|
|
yearConfigs: [], // 年份配置数组
|
|
|
|
|
currentYearIndex: 0, // 当前选中的年份索引
|
|
|
|
|
yearConfigTimer: null, // 年份切换定时器
|
|
|
|
|
|
|
|
|
|
// 地图相关
|
|
|
|
|
mapType: 'suzhou',
|
|
|
|
|
@ -501,17 +500,6 @@ export default {
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
},
|
|
|
|
|
yearConfigs: {
|
|
|
|
|
handler(newVal) {
|
|
|
|
|
if (newVal && newVal.length > 0) {
|
|
|
|
|
this.currentYearIndex = 0
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.startYearConfigRotation()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
deep: true
|
|
|
|
|
},
|
|
|
|
|
rankingData: {
|
|
|
|
|
handler() {
|
|
|
|
|
// 当排行数据变化时,重置页码并重新启动轮播
|
|
|
|
|
@ -547,9 +535,6 @@ export default {
|
|
|
|
|
if (this.courseSystemTimer) {
|
|
|
|
|
clearInterval(this.courseSystemTimer)
|
|
|
|
|
}
|
|
|
|
|
if (this.yearConfigTimer) {
|
|
|
|
|
clearInterval(this.yearConfigTimer)
|
|
|
|
|
}
|
|
|
|
|
if (this.rankingTimer) {
|
|
|
|
|
clearInterval(this.rankingTimer)
|
|
|
|
|
}
|
|
|
|
|
@ -689,11 +674,7 @@ export default {
|
|
|
|
|
this.yearConfigs = res.yearConfigs
|
|
|
|
|
// 重置当前年份索引
|
|
|
|
|
this.currentYearIndex = 0
|
|
|
|
|
// 启动年份自动切换
|
|
|
|
|
this.$nextTick(() => {
|
|
|
|
|
this.scrollToActiveButton()
|
|
|
|
|
this.startYearConfigRotation()
|
|
|
|
|
})
|
|
|
|
|
this.scrollToActiveButton()
|
|
|
|
|
}
|
|
|
|
|
// 保留原有的 courseTypes 处理逻辑(兼容性)
|
|
|
|
|
if (res && res.courseTypes && Array.isArray(res.courseTypes)) {
|
|
|
|
|
@ -997,8 +978,6 @@ export default {
|
|
|
|
|
this.currentYearIndex = index
|
|
|
|
|
// 手动切换时,滚动到对应按钮位置
|
|
|
|
|
this.scrollToActiveButton()
|
|
|
|
|
// 重新启动自动切换定时器
|
|
|
|
|
this.startYearConfigRotation()
|
|
|
|
|
},
|
|
|
|
|
// 滚动到激活的按钮位置
|
|
|
|
|
scrollToActiveButton() {
|
|
|
|
|
@ -1033,22 +1012,6 @@ export default {
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
},
|
|
|
|
|
// 启动年份配置自动切换
|
|
|
|
|
startYearConfigRotation() {
|
|
|
|
|
// 清除旧的定时器
|
|
|
|
|
if (this.yearConfigTimer) {
|
|
|
|
|
clearInterval(this.yearConfigTimer)
|
|
|
|
|
this.yearConfigTimer = null
|
|
|
|
|
}
|
|
|
|
|
// 只有当有数据且数据长度大于1时才启动自动切换
|
|
|
|
|
if (!this.yearConfigs || this.yearConfigs.length <= 1) return
|
|
|
|
|
// 启动自动切换,每5秒切换一次
|
|
|
|
|
this.yearConfigTimer = setInterval(() => {
|
|
|
|
|
this.currentYearIndex = (this.currentYearIndex + 1) % this.yearConfigs.length
|
|
|
|
|
// 切换后滚动到对应按钮位置
|
|
|
|
|
this.scrollToActiveButton()
|
|
|
|
|
}, 5000)
|
|
|
|
|
},
|
|
|
|
|
getTooltipOffset(percent) {
|
|
|
|
|
const value = Math.max(8, Math.min(parseFloat(percent) || 0, 92))
|
|
|
|
|
return `calc(${value}% - 40px)`
|
|
|
|
|
|