|
@@ -1,11 +1,11 @@
|
|
|
<template>
|
|
<template>
|
|
|
<!-- 左侧折叠面板 -->
|
|
<!-- 左侧折叠面板 -->
|
|
|
<transition name="drawer-slide">
|
|
<transition name="drawer-slide">
|
|
|
- <div class="left-group" >
|
|
|
|
|
|
|
+ <div class="left-group">
|
|
|
<el-row class="tac">
|
|
<el-row class="tac">
|
|
|
<el-col :span="12">
|
|
<el-col :span="12">
|
|
|
<el-menu
|
|
<el-menu
|
|
|
- default-active="2"
|
|
|
|
|
|
|
+ default-active="3"
|
|
|
class="el-menu-vertical-demo"
|
|
class="el-menu-vertical-demo"
|
|
|
@open="handleOpen"
|
|
@open="handleOpen"
|
|
|
@close="handleClose"
|
|
@close="handleClose"
|
|
@@ -13,9 +13,18 @@
|
|
|
<el-menu-item
|
|
<el-menu-item
|
|
|
v-for="(item, index) in groupList"
|
|
v-for="(item, index) in groupList"
|
|
|
:key="index"
|
|
:key="index"
|
|
|
|
|
+ :index="index.toString()"
|
|
|
@click="navigateToAI(item)"
|
|
@click="navigateToAI(item)"
|
|
|
|
|
+ v-model="currentActiveIndex"
|
|
|
|
|
+ @mouseover="item.isHover = true"
|
|
|
|
|
+ @mouseout="item.isHover = false"
|
|
|
>
|
|
>
|
|
|
- <img :src="item.icon" alt="" class="menu-icon" />
|
|
|
|
|
|
|
+ <!-- 根据状态切换图片currentActiveIndex === index.toString() || item.isHover ? item.hoverIcon : -->
|
|
|
|
|
+ <img
|
|
|
|
|
+ :src="item.icon"
|
|
|
|
|
+ alt=""
|
|
|
|
|
+ class="menu-icon"
|
|
|
|
|
+ />
|
|
|
{{ item.title }}
|
|
{{ item.title }}
|
|
|
</el-menu-item>
|
|
</el-menu-item>
|
|
|
</el-menu>
|
|
</el-menu>
|
|
@@ -26,37 +35,57 @@
|
|
|
</template>
|
|
</template>
|
|
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
|
-import { ref,onMounted } from 'vue'
|
|
|
|
|
-import { useRouter,useRoute } from 'vue-router'
|
|
|
|
|
|
|
+import { ref, onMounted } from 'vue'
|
|
|
|
|
+import { useRouter, useRoute } from 'vue-router'
|
|
|
|
|
|
|
|
-// 导入图片
|
|
|
|
|
|
|
+// 导入图片 白色
|
|
|
import question from '@/assets/icon/question.png'
|
|
import question from '@/assets/icon/question.png'
|
|
|
import painting from '@/assets/icon/painting.png'
|
|
import painting from '@/assets/icon/painting.png'
|
|
|
-import human from '@/assets/icon/human.png'
|
|
|
|
|
|
|
+import Human from '@/assets/icon/human.png'
|
|
|
|
|
+// 黑色
|
|
|
|
|
+import question02 from '@/assets/icon/question02.png'
|
|
|
|
|
+import painting02 from '@/assets/icon/painting02.png'
|
|
|
|
|
+import Human02 from '@/assets/icon/Human02.png'
|
|
|
|
|
|
|
|
import { teacherList } from '@/api/teachers.js'
|
|
import { teacherList } from '@/api/teachers.js'
|
|
|
|
|
|
|
|
-
|
|
|
|
|
const router = useRouter()
|
|
const router = useRouter()
|
|
|
const route = useRoute()
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
// 添加抽屉显示状态
|
|
// 添加抽屉显示状态
|
|
|
const drawerVisible = ref(true)
|
|
const drawerVisible = ref(true)
|
|
|
|
|
+// 添加当前选中索引状态
|
|
|
|
|
+const currentActiveIndex = ref('2')
|
|
|
// 渲染侧边栏
|
|
// 渲染侧边栏
|
|
|
const groupList = ref([
|
|
const groupList = ref([
|
|
|
{
|
|
{
|
|
|
- icon: question,
|
|
|
|
|
|
|
+ icon: question, // 默认图片
|
|
|
|
|
+ hoverIcon: question02, // 交互图片
|
|
|
title: '智能问答'
|
|
title: '智能问答'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- icon: painting,
|
|
|
|
|
|
|
+ icon: painting, // 默认图片
|
|
|
|
|
+ hoverIcon: painting02, // 交互图片
|
|
|
title: '智能绘画'
|
|
title: '智能绘画'
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
- icon: human,
|
|
|
|
|
|
|
+ icon: Human, // 默认图片
|
|
|
|
|
+ hoverIcon: Human02, // 交互图片
|
|
|
title: '数字人老师'
|
|
title: '数字人老师'
|
|
|
}
|
|
}
|
|
|
])
|
|
])
|
|
|
|
|
+// 组件挂载时确保默认选中状态
|
|
|
|
|
+onMounted(() => {
|
|
|
|
|
+ // 从路由判断当前应该选中的菜单项
|
|
|
|
|
+ const path = route.path
|
|
|
|
|
+ if (path.includes('ai-questions')) {
|
|
|
|
|
+ currentActiveIndex.value = '0'
|
|
|
|
|
+ } else if (path.includes('ai-painting')) {
|
|
|
|
|
+ currentActiveIndex.value = '1'
|
|
|
|
|
+ } else if (path.includes('ai-laboratory')) {
|
|
|
|
|
+ currentActiveIndex.value = '2'
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
|
|
|
|
|
// 存储小智数据
|
|
// 存储小智数据
|
|
|
const personData = ref([])
|
|
const personData = ref([])
|
|
@@ -64,10 +93,12 @@ const personData = ref([])
|
|
|
const navigateToAI = async (group) => {
|
|
const navigateToAI = async (group) => {
|
|
|
if (group.title === '智能问答') {
|
|
if (group.title === '智能问答') {
|
|
|
try {
|
|
try {
|
|
|
- const grade = route.query.grade || localStorage.getItem('selectedGrade')
|
|
|
|
|
|
|
+ const grade = route.query.grade || localStorage.getItem('selectedGrade')
|
|
|
// 获取小学低年级AI数据
|
|
// 获取小学低年级AI数据
|
|
|
const juniorAIRes = await teacherList({ category: grade + 'AI' })
|
|
const juniorAIRes = await teacherList({ category: grade + 'AI' })
|
|
|
- const aiPerson = juniorAIRes.data.list.find(person => person.name === '小智')
|
|
|
|
|
|
|
+ const aiPerson = juniorAIRes.data.list.find(
|
|
|
|
|
+ person => person.name === '小智'
|
|
|
|
|
+ )
|
|
|
if (aiPerson) {
|
|
if (aiPerson) {
|
|
|
personData.value = {
|
|
personData.value = {
|
|
|
id: aiPerson.id,
|
|
id: aiPerson.id,
|
|
@@ -75,13 +106,14 @@ const navigateToAI = async (group) => {
|
|
|
image: aiPerson.model2dPath,
|
|
image: aiPerson.model2dPath,
|
|
|
message: aiPerson.systemMessage
|
|
message: aiPerson.systemMessage
|
|
|
}
|
|
}
|
|
|
- console.log(personData.value);
|
|
|
|
|
- router.push({
|
|
|
|
|
- path: '/ai-questions',
|
|
|
|
|
- query: personData.value
|
|
|
|
|
- })
|
|
|
|
|
|
|
+ console.log(personData.value)
|
|
|
|
|
+ router
|
|
|
|
|
+ .push({
|
|
|
|
|
+ path: '/ai-questions',
|
|
|
|
|
+ query: personData.value
|
|
|
|
|
+ })
|
|
|
} else {
|
|
} else {
|
|
|
- console.warn('未找到名为小智的数据');
|
|
|
|
|
|
|
+ console.warn('未找到名为小智的数据')
|
|
|
}
|
|
}
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
console.error('获取小学低年级AI数据失败:', error)
|
|
console.error('获取小学低年级AI数据失败:', error)
|
|
@@ -95,7 +127,6 @@ const navigateToAI = async (group) => {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
// 处理菜单展开和关闭
|
|
// 处理菜单展开和关闭
|
|
|
const handleOpen = () => {}
|
|
const handleOpen = () => {}
|
|
|
const handleClose = () => {}
|
|
const handleClose = () => {}
|
|
@@ -116,13 +147,14 @@ defineExpose({
|
|
|
@return math.div($px, 750) * 100vw;
|
|
@return math.div($px, 750) * 100vw;
|
|
|
}
|
|
}
|
|
|
/* 添加过渡样式 */
|
|
/* 添加过渡样式 */
|
|
|
-.drawer-slide-enter-active,
|
|
|
|
|
-.drawer-slide-leave-active {
|
|
|
|
|
|
|
+::v-deep .drawer-slide-enter-active,
|
|
|
|
|
+::v-deep .drawer-slide-leave-active {
|
|
|
transition: all 0.3s ease;
|
|
transition: all 0.3s ease;
|
|
|
}
|
|
}
|
|
|
-.drawer-slide-enter-from,
|
|
|
|
|
-.drawer-slide-leave-to {
|
|
|
|
|
|
|
+::v-deep .drawer-slide-enter-from,
|
|
|
|
|
+::v-deep .drawer-slide-leave-to {
|
|
|
transform: translateX(-100%);
|
|
transform: translateX(-100%);
|
|
|
|
|
+ opacity: 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 侧边栏
|
|
// 侧边栏
|
|
@@ -154,19 +186,13 @@ defineExpose({
|
|
|
font-size: rpx(15);
|
|
font-size: rpx(15);
|
|
|
color: white;
|
|
color: white;
|
|
|
}
|
|
}
|
|
|
-.el-menu ::v-deep(.el-menu-item:hover) {
|
|
|
|
|
- background: linear-gradient(to bottom, #ffefb0, #ffcc00);
|
|
|
|
|
- box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
|
|
|
|
|
- color: black;
|
|
|
|
|
- font-size: rpx(8);
|
|
|
|
|
-}
|
|
|
|
|
-.el-menu-vertical-demo .el-menu-item.is-active {
|
|
|
|
|
|
|
+.el-menu .el-menu-item:hover {
|
|
|
background: linear-gradient(to bottom, #ffefb0, #ffcc00);
|
|
background: linear-gradient(to bottom, #ffefb0, #ffcc00);
|
|
|
box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
|
|
box-shadow: 0 8px 8px rgb(0, 0, 0, 0.3);
|
|
|
color: black;
|
|
color: black;
|
|
|
font-size: rpx(8);
|
|
font-size: rpx(8);
|
|
|
}
|
|
}
|
|
|
-.el-menu .el-menu-item.is-active {
|
|
|
|
|
|
|
+:deep(.el-menu .el-menu-item.is-active) {
|
|
|
background: linear-gradient(to bottom, #fee78a, #ffce1b);
|
|
background: linear-gradient(to bottom, #fee78a, #ffce1b);
|
|
|
color: black;
|
|
color: black;
|
|
|
font-size: rpx(8);
|
|
font-size: rpx(8);
|
|
@@ -177,5 +203,4 @@ defineExpose({
|
|
|
height: rpx(11);
|
|
height: rpx(11);
|
|
|
margin-right: rpx(2);
|
|
margin-right: rpx(2);
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-</style>
|
|
|
|
|
|
|
+</style>
|