|
@@ -150,34 +150,19 @@ const groupList = ref([
|
|
|
const updateActiveIndex = () => {
|
|
const updateActiveIndex = () => {
|
|
|
const path = route.path
|
|
const path = route.path
|
|
|
const from = window.history.state?.from // 从history.state获取来源信息
|
|
const from = window.history.state?.from // 从history.state获取来源信息
|
|
|
-
|
|
|
|
|
- // 从数字人老师页面进入智能问答页面
|
|
|
|
|
- if (path.includes('ai-questions') && from === 'ai-laboratory') {
|
|
|
|
|
- currentActiveIndex.value = '2' // 保持选中数字人老师
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 从英文数字人老师页面进入智能问答页面
|
|
|
|
|
- if (path.includes('ai-questions') && from === 'ai-ennumerals') {
|
|
|
|
|
- currentActiveIndex.value = '4' // 保持选中英文数字人老师
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // 从大运河页面进入智能问答页面
|
|
|
|
|
- if (path.includes('ai-questions') && from === 'ai-grandcanal') {
|
|
|
|
|
- currentActiveIndex.value = '7' // 保持选中大运河
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- // 从AI+古诗页面进入智能问答页面
|
|
|
|
|
- if (path.includes('ai-questions') && from === 'ai-poetry') {
|
|
|
|
|
- currentActiveIndex.value = '3' // 保持选中AI+古诗
|
|
|
|
|
- return
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let menuItem = null
|
|
|
|
|
+ // 从其他问答页面进入智能问答页面
|
|
|
|
|
+ if (path.includes('ai-questions') && from){
|
|
|
|
|
+ menuItem = groupList.value.find(item => from === item.path.replace('/', ''))
|
|
|
|
|
+ }else{
|
|
|
|
|
+ // 查找路径对应的索引
|
|
|
|
|
+ menuItem = groupList.value.find(item => path.includes(item.path.replace('/', '')))
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 查找路径对应的索引
|
|
|
|
|
- const menuItem = groupList.value.find(item => path.includes(item.path.replace('/', '')))
|
|
|
|
|
|
|
+
|
|
|
|
|
+ //保持选中当前页面
|
|
|
if (menuItem) {
|
|
if (menuItem) {
|
|
|
currentActiveIndex.value = menuItem.index
|
|
currentActiveIndex.value = menuItem.index
|
|
|
- return
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|