AIDevelop.vue 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419
  1. <template>
  2. <!-- AI发展历程 -->
  3. <div class="home-container">
  4. <!-- 展开收起侧边栏 -->
  5. <div
  6. class="icon-expand"
  7. :style="{
  8. backgroundColor: drawerVisible ? '#44449c' : '#7F70C840',
  9. left: drawerVisible ? '18%' : '0',
  10. }"
  11. @click="toggleDrawer"
  12. >
  13. <span
  14. class="vertical-lines"
  15. :style="{
  16. color: drawerVisible ? '#8a78d0' : 'white'
  17. }"
  18. >||</span
  19. >
  20. </div>
  21. <el-drawer
  22. v-model="drawerVisible"
  23. direction="ltr"
  24. size="18%"
  25. :with-header="false"
  26. >
  27. <!-- 添加抽屉 -->
  28. <div class="drawer-box">
  29. <el-row class="tac">
  30. <el-col :span="12">
  31. <span class="mb-2">
  32. <img :src="classImages" alt="课程小节图标" />
  33. 课程小节
  34. </span>
  35. <el-menu
  36. :default-active="course.key"
  37. @open="handleOpen"
  38. @close="handleClose"
  39. @select="handleSelect"
  40. :default-openeds="['3','5']"
  41. >
  42. <template v-for="item in menuItems" :key="item.key">
  43. <el-menu-item v-if="!item.children" :index="item.key">{{
  44. item.title
  45. }}</el-menu-item>
  46. <el-sub-menu v-else :index="item.key">
  47. <template #title>
  48. <span>{{ item.title }}</span>
  49. </template>
  50. <el-menu-item-group v-if="item.children">
  51. <template v-for="child in item.children" :key="child.key">
  52. <el-menu-item :index="child.key"
  53. >•{{ child.title }}</el-menu-item
  54. >
  55. </template>
  56. </el-menu-item-group>
  57. </el-sub-menu>
  58. </template>
  59. </el-menu>
  60. </el-col>
  61. </el-row>
  62. </div>
  63. </el-drawer>
  64. <div class="content-box">
  65. <div class="box-1">
  66. <div class="inner-box left-box">
  67. <div class="box-icon" @click="goBack">
  68. <el-icon class="left-icon"><ArrowLeftBold /></el-icon>
  69. {{ boxIconTitle }}
  70. </div>
  71. </div>
  72. <div class="inner-box right-box">
  73. <div class="top-right-box">
  74. <el-autocomplete
  75. v-model="SearchInput"
  76. :fetch-suggestions="querySearch"
  77. placeholder="搜索"
  78. @select="handleSearchSelect"
  79. class="search-input"
  80. value-key="title"
  81. :trigger-on-focus="false"
  82. >
  83. <template #prefix>
  84. <el-icon class="el-input__icon"><search /></el-icon>
  85. </template>
  86. <template #popper-append-to-body>
  87. <el-option
  88. class="scrollbar"
  89. v-for="item in filteredTitles"
  90. :key="item.key"
  91. :label="item.title"
  92. :value="item"
  93. ></el-option>
  94. </template>
  95. </el-autocomplete>
  96. </div>
  97. </div>
  98. </div>
  99. <div class="box-2">
  100. <!-- 课程标题 -->
  101. <div class="small-title">
  102. <span>{{ course.courseName }}</span>
  103. </div>
  104. <!-- 视频组件 -->
  105. <VideoPlayer v-if="course.courseContentType === 'video'"
  106. :contentType="course.courseContentType"
  107. :videoPath="course.courseVideoPath"
  108. :courseId="course.id || ''"
  109. :typeId="typeId"
  110. :courseConfigList="course.courseConfigList || []"
  111. :allIndices="flattenMenuItems()"
  112. :currentIndex="course.key || ''"
  113. @timeUpdate="handleVideoTimeUpdate"
  114. @videoEnded="handleVideoEnded"
  115. @switchVideo="handleSelect"
  116. />
  117. <!-- 图片 -->
  118. <ImageView v-if="course.courseContentType === 'image'" :imagePath="course.courseImagePath" altText="课程图片"></ImageView>
  119. <!-- PPT -->
  120. <PptView v-if="course.courseContentType === 'ppt'" :pptPath="course.pptPath" ref="pptRef"></PptView>
  121. <!-- 视频切换按钮 - 始终显示 -->
  122. <div class="video-switch">
  123. <div class="caret-left" @click="playPreviousVideo">
  124. <el-button type="warning" round>
  125. <img :src="leftImg" alt="Left" />上一节</el-button
  126. >
  127. </div>
  128. <div class="caret-right" @click="playNextVideo">
  129. <el-button type="warning" round
  130. >下一节<img :src="rightImg" alt="Right" />
  131. </el-button>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. <!-- 弹框组件 -->
  137. <DialogComponents
  138. :questionDialogVisible="questionDialogVisible"
  139. :currentQuestion="courseConfig"
  140. :gradeId="gradeId"
  141. :typeId="typeId"
  142. :courseId="course.id || ''"
  143. @closeQuestionDialog="closeQuestionDialog"
  144. @submitAnswer="handleSubmitAnswer"
  145. />
  146. </div>
  147. </template>
  148. <script setup>
  149. import { ref, onMounted, onBeforeUnmount, computed } from 'vue'
  150. import { useRoute, useRouter } from 'vue-router'
  151. import { Expand, Fold, Memo } from '@element-plus/icons-vue'
  152. import { Search, ArrowLeftBold } from '@element-plus/icons-vue'
  153. import { ElMessage, ElMessageBox, ElNotification, valueEquals } from 'element-plus'
  154. import classImages from '@/assets/icon/class.png'
  155. import { ClassType } from '@/api/class.js'
  156. import { Message } from '@/utils/message/Message.js'
  157. import { saveRecord } from '@/api/personalized/index.js'
  158. // 导入全局状态
  159. import { globalState } from '@/utils/globalState.js'
  160. // 导入图标
  161. import leftImg from '@/assets/icon/backward.png'
  162. import rightImg from '@/assets/icon/f-backward.png'
  163. // 导入新创建的组件
  164. import VideoPlayer from '@/components/videopage/VideoPlayer.vue'
  165. import DialogComponents from '@/components/videopage/DialogComponents.vue'
  166. import PptView from "@/components/PPT/PptView.vue";
  167. import ImageView from '@/components/Image/ImageView.vue'
  168. const router = useRouter() // 获取当前路由对象
  169. const route = useRoute()
  170. // 添加按钮显示状态
  171. const buttonVisible = ref(false)
  172. // 添加抽屉显示状态
  173. const drawerVisible = ref(false)
  174. // 渲染页面标题
  175. const boxIconTitle = ref('')
  176. // 课程集合数据
  177. const courseList = ref([])
  178. //当前课程
  179. const course = ref({})
  180. // 菜单数据
  181. const menuItems = ref([])
  182. // 课程集合数据
  183. const videoPathMap = ref({})
  184. // 已观看课程ID列表
  185. const watchedCourseIds = ref([])
  186. // 试题弹框显示状态
  187. const questionDialogVisible = ref(false)
  188. // 当前显示的试题
  189. const courseConfig = ref({})
  190. // 搜索框
  191. const SearchInput = ref('')
  192. // 年级id
  193. const gradeId = ref('')
  194. // 课程大纲id
  195. const typeId = ref('')
  196. // 课程小节id
  197. const courseId = ref('')
  198. //课程小节字典
  199. const menuDict = ref({
  200. 1: '课前回顾',
  201. 2: '课程引入',
  202. 3: '知识讲解',
  203. 4: '趣味实操',
  204. 5: '课程总结'
  205. })
  206. // 切换抽屉显示状态的函数
  207. const toggleDrawer = () => {
  208. drawerVisible.value = !drawerVisible.value
  209. }
  210. // 返回上一页
  211. const goBack = () => {
  212. router.go(-1)
  213. }
  214. // 菜单打开和关闭的处理函数
  215. const handleOpen = () => {}
  216. const handleClose = () => {}
  217. // 菜单选择的处理函数
  218. const handleSelect = index => {
  219. //测试账号禁用视频
  220. if (disableVideo(index)) return
  221. // 根据索引切换视频
  222. if (videoPathMap.value[index]) {
  223. course.value = videoPathMap.value[index]
  224. courseId.value = course.value.id
  225. // 切换标题后,关闭抽屉
  226. drawerVisible.value = false
  227. } else {
  228. //视频不存在
  229. Message().notifyWarning('视频不存在!', true)
  230. }
  231. }
  232. // 展平所有菜单项索引
  233. const flattenMenuItems = () => {
  234. const indices = []
  235. const traverse = items => {
  236. for (const item of items) {
  237. if (!item.children) {
  238. indices.push(item.key)
  239. } else {
  240. traverse(item.children)
  241. }
  242. }
  243. }
  244. traverse(menuItems.value)
  245. return indices
  246. }
  247. // 播放上一个视频
  248. const playPreviousVideo = () => {
  249. const allIndices = flattenMenuItems()
  250. const currentIndexInList = allIndices.indexOf(course.value.key)
  251. if (currentIndexInList > 0) {
  252. const previousIndex = allIndices[currentIndexInList - 1]
  253. handleSelect(previousIndex)
  254. }
  255. }
  256. // 播放下一个视频
  257. const playNextVideo = () => {
  258. const allIndices = flattenMenuItems()
  259. const currentIndexInList = allIndices.indexOf(course.value.key)
  260. if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
  261. const nextIndex = allIndices[currentIndexInList + 1]
  262. handleSelect(nextIndex)
  263. }
  264. }
  265. // 播放下一个视频
  266. const handleVideoEnded = () => {
  267. // 记录当前视频ID为已观看
  268. if (
  269. course.value &&
  270. course.value.id &&
  271. !watchedCourseIds.value.includes(course.value.id)
  272. ) {
  273. watchedCourseIds.value.push(course.value.id)
  274. localStorage.setItem(
  275. 'watchedCourseIds',
  276. JSON.stringify(watchedCourseIds.value)
  277. )
  278. }
  279. // 如果是图片类型,不需要自动播放下一个
  280. if (course.value.courseContentType === 'video') {
  281. const allIndices = flattenMenuItems()
  282. const currentIndexInList = allIndices.indexOf(course.value.key)
  283. if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
  284. const nextIndex = allIndices[currentIndexInList + 1]
  285. handleSelect(nextIndex)
  286. }
  287. }
  288. const allIndices = flattenMenuItems()
  289. const currentIndexInList = allIndices.indexOf(course.value.key)
  290. if (currentIndexInList !== -1 && currentIndexInList < allIndices.length - 1) {
  291. const nextIndex = allIndices[currentIndexInList + 1]
  292. handleSelect(nextIndex)
  293. }
  294. }
  295. // 禁用视频
  296. const disableVideo = (index = course.value.key) => {
  297. if (localStorage.getItem('userName') === 'aiTest' && gradeId.value === "1") {
  298. let dis = Number(index.substring(index.indexOf("-") + 1));
  299. if (dis > 5) {
  300. //提示禁用
  301. Message().notifyWarning('您的账号并未开放此课程!', true)
  302. return true
  303. }
  304. }
  305. // if (localStorage.getItem('userName') === 'aiDemo') {
  306. // let dis = Number(index.substring(index.indexOf("-") + 1));
  307. // if (dis > 4) {
  308. // //提示禁用
  309. // Message().notifyWarning('您的账号并未开放此课程!', true)
  310. // return true
  311. // }
  312. // }
  313. return false
  314. }
  315. // 处理视频时间更新事件
  316. const handleVideoTimeUpdate = ({ currentTime, progressPercentage, courseConfig: config }) => {
  317. if (config) {
  318. questionDialogVisible.value = true
  319. courseConfig.value = config
  320. // 保存试题进度
  321. const saveQuestProgress = async () =>{
  322. try {
  323. // 确保courseId已经设置
  324. if (!courseId.value && typeId.value) {
  325. const courseRes = await ClassType(typeId.value)
  326. if (courseRes.data && courseRes.data.length > 0) {
  327. courseId.value = course.value && course.value.id ? course.value.id : courseRes.data[0].id
  328. }
  329. }
  330. if (config.id) {
  331. // 保存弹窗问题进度
  332. await saveRecord({
  333. brpNjId: gradeId.value,
  334. brpCtId: typeId.value,
  335. brpCourseConfigId: config.id,
  336. brpCourseId: courseId.value,
  337. brpType: 'courseQuest',
  338. brpProgress: progressPercentage
  339. })
  340. } else {
  341. console.error('无法保存试题进度: 试题id不存在')
  342. }
  343. }catch(error){
  344. console.error(`保存试题进度失败:`, error)
  345. }
  346. }
  347. // 调用异步函数
  348. saveQuestProgress()
  349. }
  350. }
  351. // 关闭试题弹框
  352. const closeQuestionDialog = () => {
  353. questionDialogVisible.value = false
  354. }
  355. // 提交答案
  356. const handleSubmitAnswer = ({ selectedOption }) => {
  357. questionDialogVisible.value = false
  358. }
  359. // 搜索
  360. const querySearch = (queryString, cb) => {
  361. const sections = getAllCourseSections()
  362. const results = queryString
  363. ? sections.filter(section =>
  364. section.title.toLowerCase().includes(queryString.toLowerCase())
  365. )
  366. : sections
  367. cb(results)
  368. }
  369. const filteredTitles = computed(() => {
  370. const sections = getAllCourseSections()
  371. if (!SearchInput.value) {
  372. return sections
  373. }
  374. return sections.filter(section =>
  375. section.title.toLowerCase().includes(SearchInput.value.toLowerCase())
  376. )
  377. })
  378. const handleSearchSelect = item => {
  379. handleSelect(item.key)
  380. // 清空输入框
  381. SearchInput.value = ''
  382. }
  383. // 课程小节数据提取
  384. const getAllCourseSections = () => {
  385. let sections = []
  386. const traverse = items => {
  387. items.forEach(item => {
  388. if (item.children) {
  389. traverse(item.children)
  390. } else {
  391. sections.push({ title: item.title, key: item.key })
  392. }
  393. })
  394. }
  395. traverse(menuItems.value)
  396. return sections
  397. }
  398. // 渲染 课程数据结构 以及 视频
  399. onMounted(async () => {
  400. const typeIdParam = router.currentRoute.value.query.typeId
  401. if (typeIdParam) {
  402. typeId.value = typeIdParam
  403. try {
  404. // 取接口课程数据
  405. const res = await ClassType(typeIdParam)
  406. console.log(res);
  407. // 对返回的课程数据进行处理,确保ccTime为有效秒数
  408. const processedData = res.data.map(course => {
  409. // 检查并处理courseConfigList
  410. if (course.courseConfigList && Array.isArray(course.courseConfigList)) {
  411. // 过滤掉ccTime为0的配置项
  412. const validConfigList = course.courseConfigList.filter(config =>
  413. config.ccTime !== undefined && config.ccTime !== null && config.ccTime > 0
  414. )
  415. return {
  416. ...course,
  417. courseConfigList: validConfigList
  418. }
  419. }
  420. return course
  421. })
  422. courseList.value = processedData
  423. // 初始化已观看课程ID
  424. const savedWatchedIds = localStorage.getItem('watchedCourseIds')
  425. if (savedWatchedIds) {
  426. watchedCourseIds.value = JSON.parse(savedWatchedIds)
  427. }
  428. //课程数据
  429. let topName = '';
  430. courseList.value.forEach((courseTemp, index) => {
  431. let menuIndex = courseTemp.courseLabel + '-' + (index + 1)
  432. //大节
  433. let menu = {
  434. key: menuIndex,
  435. index: menuIndex,
  436. title: courseTemp.courseName
  437. }
  438. // 手动修改第一个课程为image类型用于测试
  439. // if (index === 0) {
  440. // // courseTemp.courseContentType = 'ppt';
  441. // // courseTemp.pptPath = 'http://59.110.91.129:8088/admin-api/infra/file/29/get/20250820/ppt_1755654972861.pptx';
  442. // courseTemp.courseContentType = 'image';
  443. // courseTemp.courseImagePath = 'http://59.110.91.129:8088/admin-api/infra/file/4/get/20250715/one_1752549934393.png,http://59.110.91.129:8088/admin-api/infra/file/29/get/20250722/666_1753151547130.png';
  444. // // 可选:修改课程名称以便识别
  445. // courseTemp.courseName = '测试';
  446. // }
  447. if (topName === courseTemp.courseLabel) {
  448. let topMenu = menuItems.value[menuItems.value.length - 1]
  449. let topMenuChildren = topMenu.children;
  450. if (topMenuChildren) {
  451. topMenuChildren.push(menu)
  452. } else {
  453. menu = {
  454. key: menuIndex,
  455. index: menuIndex,
  456. title: menuDict.value[courseTemp.courseLabel],
  457. children: [
  458. {
  459. key: topMenu.key,
  460. index: topMenu.index,
  461. title: topMenu.title,
  462. },
  463. {
  464. key: menuIndex,
  465. index: menuIndex,
  466. title: courseTemp.courseName
  467. }
  468. ]
  469. }
  470. menuItems.value[menuItems.value.length-1] = menu
  471. }
  472. }else{
  473. menuItems.value.push(menu)
  474. }
  475. topName = courseTemp.courseLabel
  476. courseTemp['key'] = menuIndex
  477. videoPathMap.value[menuIndex] = courseTemp
  478. //确定默认课程
  479. if (index === 0) {
  480. course.value = courseTemp
  481. courseId.value = courseTemp.id
  482. }
  483. })
  484. } catch (error) {
  485. console.error('获取课程数据失败:', error)
  486. }
  487. }
  488. const title = router.currentRoute.value.query.typeName
  489. if (title) {
  490. boxIconTitle.value = String(title)
  491. }
  492. // 初始化年级ID
  493. gradeId.value = globalState.initGradeId()
  494. })
  495. onBeforeUnmount(() => {
  496. // 组件卸载时的清理
  497. })
  498. </script>
  499. <style scoped lang="scss">
  500. @use 'sass:math';
  501. @use 'sass:color'; // 引入 color 模块
  502. // 定义rpx转换函数
  503. @function rpx($px) {
  504. @return math.div($px, 750) * 100vw;
  505. }
  506. // 定义儿童风格的蓝紫色调
  507. $primary-color: rgba(106, 90, 205, 0.52); // 主色调:蓝紫色
  508. $secondary-color: rgba(147, 112, 219, 0.66); // 辅助色:亮蓝紫色
  509. $accent-color: rgb(133, 89, 220); // 强调色:暗蓝紫色
  510. $light-color: #ffffff; // 浅色背景:淡紫色
  511. $text-color: #483d8b; // 文本颜色:靛蓝色
  512. // 视频切换按钮样式
  513. .video-switch {
  514. width: 100%;
  515. display: flex;
  516. margin-top: rpx(5);
  517. margin-bottom: rpx(15);
  518. justify-content: center;
  519. }
  520. .caret-right,
  521. .caret-left {
  522. width: rpx(50);
  523. margin: 0 rpx(20);
  524. margin: auto;
  525. display: flex;
  526. justify-content: center;
  527. }
  528. .caret-left ::v-deep(.el-button.is-round),
  529. .caret-right ::v-deep(.el-button.is-round) {
  530. width: rpx(50);
  531. height: rpx(15);
  532. color: white;
  533. font-size: rpx(7);
  534. border-radius: none;
  535. border: 1px white solid;
  536. background-color: rgb(255, 255, 255, 0.5);
  537. box-shadow: 0 4px 8px rgba(202, 52, 52, 0.1);
  538. }
  539. .caret-right img,
  540. .caret-left img {
  541. width: rpx(12);
  542. }
  543. .default-messages {
  544. margin-top: rpx(-10);
  545. margin-bottom: rpx(5);
  546. }
  547. /* 添加过渡样式 */
  548. .drawer-slide-enter-active,
  549. .drawer-slide-leave-active {
  550. transition: all 0.3s ease;
  551. }
  552. .drawer-slide-enter-from,
  553. .drawer-slide-leave-to {
  554. transform: translateX(-100%);
  555. opacity: 0;
  556. }
  557. .home-container ::v-deep(.el-drawer__body) {
  558. width: rpx(135);
  559. height: 100%;
  560. position: relative;
  561. background: linear-gradient(to bottom, #001169, #8a78d0);
  562. }
  563. .content-box {
  564. flex: 1;
  565. height: 100%;
  566. display: flex;
  567. flex-direction: column; /* 子元素上下排列 */
  568. background: linear-gradient(to bottom, #001169, #8a78d0);
  569. }
  570. .icon-expand {
  571. width: rpx(8);
  572. height: rpx(35);
  573. border-top-right-radius: rpx(5);
  574. border-bottom-right-radius: rpx(5);
  575. z-index: 9999;
  576. position: absolute;
  577. top: 50%;
  578. transform: translateY(-50%);
  579. cursor: pointer; // 添加鼠标指针样式
  580. clip-path: polygon(0 0, 100% 15%, 100% 85%, 0 100%);
  581. display: flex;
  582. justify-content: center;
  583. align-items: center;
  584. transition: all 0.3s ease;
  585. }
  586. .icon-expand .vertical-lines {
  587. color: #8a78d0;
  588. font-size: rpx(10);
  589. }
  590. .home-container {
  591. position: fixed;
  592. top: 0;
  593. left: 0;
  594. right: 0;
  595. bottom: 0;
  596. background: linear-gradient(to bottom, #001169, #b4a8e1);
  597. display: flex;
  598. }
  599. .el-row {
  600. margin: auto;
  601. margin-top: rpx(20);
  602. }
  603. .tac ::v-deep(.el-menu) {
  604. background-color: transparent;
  605. border: none;
  606. width: 100%;
  607. margin-top: rpx(8);
  608. }
  609. /* 取消点击后的蓝色字体 el-sub-menu__title*/
  610. .tac ::v-deep(.el-menu-item.is-active),
  611. .tac ::v-deep(.el-sub-menu__title.is-active) {
  612. color: white;
  613. }
  614. // 取消鼠标悬浮颜色
  615. .tac ::v-deep(.el-sub-menu__title) {
  616. width: rpx(130);
  617. height: rpx(20);
  618. margin-bottom: rpx(5);
  619. border-radius: rpx(6);
  620. // 添加flex布局使标题和图标两端对齐
  621. display: flex;
  622. justify-content: space-between;
  623. align-items: center;
  624. }
  625. .el-menu ::v-deep(.el-sub-menu__title:hover),
  626. .el-menu ::v-deep(.el-sub-menu__title:focus),
  627. .el-menu ::v-deep(.el-sub-menu__title:active) {
  628. background: linear-gradient(to bottom, #fee78a, #ffce1b);
  629. background-color: transparent;
  630. }
  631. // 添加二级标题折叠图标样式
  632. ::v-deep(.el-sub-menu__icon-arrow) {
  633. color: white;
  634. font-size: rpx(10); // 增大图标尺寸
  635. margin-left: auto; // 将图标推到右侧
  636. margin-top: rpx(-5);
  637. display: block;
  638. width: rpx(16); // 确保有明确宽度
  639. }
  640. // 鼠标悬停时的图标样式
  641. .el-menu ::v-deep(.el-sub-menu__title:hover .el-sub-menu__icon-arrow) {
  642. color: black; // 与悬停状态的文字颜色保持一致
  643. }
  644. .el-menu ::v-deep(.el-icon svg) {
  645. font-size: rpx(9);
  646. }
  647. .mb-2 {
  648. color: white;
  649. font-size: rpx(9);
  650. }
  651. .mb-2 img {
  652. width: rpx(10);
  653. height: rpx(10);
  654. vertical-align: middle;
  655. margin-top: rpx(-2);
  656. }
  657. .el-menu-item {
  658. width: rpx(100);
  659. height: rpx(20);
  660. margin-bottom: rpx(5);
  661. border-radius: rpx(6);
  662. color: white;
  663. font-size: rpx(8);
  664. }
  665. .el-menu ::v-deep(.el-sub-menu__title) {
  666. color: white;
  667. width: rpx(100);
  668. height: rpx(20);
  669. margin-bottom: rpx(5);
  670. font-size: rpx(8);
  671. }
  672. .el-menu ::v-deep(.el-sub-menu__title:hover),
  673. .el-menu ::v-deep(.el-sub-menu__title:focus),
  674. .el-menu ::v-deep(.el-sub-menu__title:active) {
  675. background: linear-gradient(to bottom, #fee78a, #ffce1b);
  676. color: black;
  677. }
  678. .el-menu ::v-deep(.el-menu-item:hover),
  679. .el-menu ::v-deep(.el-menu-item:focus),
  680. .el-menu ::v-deep(.el-menu-item:active) {
  681. background: linear-gradient(to bottom, #fee78a, #ffce1b);
  682. color: black;
  683. font-size: rpx(8);
  684. box-shadow: 0 4px 8px rgba(3, 3, 3, 0.3);
  685. }
  686. .el-menu .el-menu-item.is-active {
  687. background: linear-gradient(to bottom, #fee78a, #ffce1b);
  688. color: black;
  689. font-size: rpx(8);
  690. box-shadow: 0 4px 8px rgba(3, 3, 3, 0.3);
  691. }
  692. .drawer-box {
  693. position: absolute;
  694. display: flex;
  695. align-items: center;
  696. height: 100%;
  697. width: 80%;
  698. }
  699. .drawer-box .toggle-button {
  700. width: rpx(10);
  701. height: rpx(50);
  702. font-size: rpx(7);
  703. background-color: rgba(17, 23, 29, 0.2);
  704. border: none;
  705. position: relative;
  706. writing-mode: vertical-lr; // 文字垂直排列,从左到右
  707. text-orientation: upright; // 文字保持正立
  708. }
  709. .toggle-button:hover {
  710. left: 0;
  711. }
  712. .toggle-button.is-active,
  713. .toggle-button:active,
  714. .toggle-button:focus {
  715. background-color: rgba(165, 209, 247, 0.8);
  716. color: white;
  717. border: none; // 移除点击时的边框
  718. outline: none; // 移除点击时的外边框
  719. }
  720. .box-1 {
  721. width: 100%;
  722. // height: rpx(50);
  723. margin-top: rpx(10);
  724. display: flex;
  725. justify-content: center;
  726. align-items: center;
  727. box-sizing: border-box;
  728. font-size: rpx(15); // 默认字体大小
  729. }
  730. .inner-box {
  731. height: 100%;
  732. display: flex;
  733. justify-content: center;
  734. align-items: center;
  735. font-size: rpx(16); // 默认字体大小
  736. }
  737. .left-box {
  738. position: relative;
  739. justify-content: flex-start;
  740. align-items: flex-start;
  741. flex: 1; // 设置左侧盒子占比为 2
  742. cursor: pointer; // 添加鼠标指针样式
  743. }
  744. .box-icon {
  745. width: 100%;
  746. height: 100%;
  747. flex: 1;
  748. display: flex; // 添加 flex 布局
  749. align-items: center; // 垂直居中
  750. color: white; // 设置图标颜色为白色
  751. padding-left: rpx(15);
  752. font-size: rpx(10); // 设置图标大小,可按需调整
  753. }
  754. .box-icon .left-icon {
  755. margin-left: rpx(10);
  756. margin-right: rpx(5); // 设置图标和文字之间的间距 ;
  757. }
  758. .left-box span {
  759. position: absolute;
  760. font-size: rpx(11); // 默认字体大小
  761. color: white;
  762. }
  763. .right-box {
  764. flex: 1;
  765. position: relative; // 添加相对定位;
  766. }
  767. .top-right-box {
  768. position: absolute; // 添加绝对定位
  769. // margin-top: rpx(9); // 调整上边距离
  770. margin-left: rpx(260); // 调整右边距离
  771. width: rpx(100); // 设置盒子宽度,可按需调整
  772. // height: 60px; // 设置盒子高度,可按需调整
  773. margin-right: rpx(20);
  774. display: flex;
  775. justify-content: flex-end;
  776. }
  777. .top-right-box {
  778. ::v-deep(.el-input__wrapper) {
  779. height: rpx(15);
  780. font-size: rpx(6);
  781. background-color: rgb(255, 255, 255, 0.5);
  782. border-radius: rpx(12);
  783. border: white 1px solid;
  784. color: white;
  785. }
  786. ::v-deep(.el-input__icon) {
  787. color: white; // 设置输入框图标颜色为白色
  788. }
  789. // 添加占位符样式
  790. ::v-deep(.el-input__inner::placeholder) {
  791. color: white;
  792. }
  793. // 添加输入框文字颜色样式
  794. ::v-deep(.el-input__inner) {
  795. color: black;
  796. }
  797. }
  798. // 搜索框
  799. .search-input {
  800. width: rpx(100);
  801. height: rpx(15);
  802. font-size: rpx(7);
  803. }
  804. .box-2 {
  805. width: 100%;
  806. flex: 1;
  807. box-shadow: 0 4px 8px rgba(202, 52, 52, 0.1);
  808. box-sizing: border-box;
  809. // display: flex; // 确保子元素水平排列
  810. flex-wrap: wrap; // 允许子元素换行;
  811. align-content: center; // 顶部对齐;
  812. cursor: pointer; // 添加鼠标指针样式
  813. }
  814. .small-title {
  815. width: 100%;
  816. // margin-top: rpx(-20);
  817. height: rpx(20);
  818. color: white;
  819. font-size: rpx(10);
  820. justify-content: center; //使子元素水平居中
  821. }
  822. // 图片容器样式
  823. .image-container {
  824. width: 100%;
  825. display: flex;
  826. justify-content: center;
  827. align-items: center;
  828. // padding: rpx(20) 0;
  829. }
  830. // 图片样式
  831. .course-image {
  832. max-width: 70%;
  833. max-height: rpx(400);
  834. object-fit: contain;
  835. border-radius: rpx(12);
  836. box-shadow: 0 rpx(10) rpx(20) rgba(0, 0, 0, 0.1);
  837. }
  838. // 儿童风格试题弹框样式
  839. .child-dialog {
  840. .el-dialog__header {
  841. display: none; // 隐藏原有的标题栏
  842. }
  843. .el-dialog__body {
  844. padding: rpx(20);
  845. position: relative;
  846. }
  847. .el-dialog__footer {
  848. border-top: none;
  849. padding: rpx(10) rpx(20);
  850. text-align: center;
  851. margin-top: auto; // 使底部按钮位于底部
  852. }
  853. .el-dialog__wrapper {
  854. // 修改半透明背景色
  855. background-color: rgba(0, 0, 0, 0.6);
  856. }
  857. .el-dialog {
  858. border: none;
  859. border-radius: rpx(20);
  860. background: linear-gradient(
  861. 135deg,
  862. $light-color,
  863. #d8bfd8
  864. ); // 柔和的蓝紫色渐变
  865. overflow: hidden;
  866. display: flex; // 添加 flex 布局
  867. flex-direction: column; // 设置垂直布局
  868. min-height: 0; // 防止子元素溢出
  869. // 添加装饰元素
  870. &::before {
  871. content: '';
  872. position: absolute;
  873. top: 0;
  874. left: 0;
  875. width: 100%;
  876. height: rpx(10);
  877. background: linear-gradient(90deg, $secondary-color, $accent-color);
  878. }
  879. }
  880. }
  881. // 问题标题样式
  882. .question-title {
  883. padding: rpx(15);
  884. border-radius: rpx(12);
  885. margin-bottom: rpx(20);
  886. color: #483d8b;
  887. font-weight: bold;
  888. font-size: rpx(12);
  889. position: relative;
  890. display: flex;
  891. // align-items: center;
  892. .question-icon {
  893. background-color: $accent-color;
  894. color: white;
  895. width: rpx(24);
  896. height: rpx(24);
  897. border-radius: 50%;
  898. display: flex;
  899. align-items: center;
  900. justify-content: center;
  901. margin-right: rpx(10);
  902. font-weight: bold;
  903. box-shadow: 0 rpx(2) rpx(5) rgba($accent-color, 0.3);
  904. }
  905. }
  906. // 选项容器样式
  907. .options-container {
  908. margin-bottom: rpx(20);
  909. }
  910. // 问题选项样式
  911. .question-option {
  912. margin: rpx(8) 0;
  913. padding: rpx(10) rpx(15);
  914. border-radius: rpx(12);
  915. border: rpx(1) solid rgba($primary-color, 0.3);
  916. transition: all 0.3s ease;
  917. display: flex;
  918. align-items: center;
  919. background-color: white;
  920. box-shadow: 0 rpx(2) rpx(5) rgba($primary-color, 0.05);
  921. ::v-deep(.el-radio__label) {
  922. color: $text-color;
  923. margin-left: rpx(8);
  924. flex: 1;
  925. text-align: left;
  926. // 增大字体大小
  927. font-size: rpx(12);
  928. }
  929. // 选中时的样式变化
  930. .el-radio__input.is-checked + .el-radio__label {
  931. font-weight: bold;
  932. color: $accent-color;
  933. }
  934. &:hover {
  935. background-color: rgba($primary-color, 0.05);
  936. border-color: rgba($primary-color, 0.5);
  937. transform: translateY(-rpx(1));
  938. }
  939. }
  940. // 暂无选项样式
  941. .no-options {
  942. color: rgba($text-color, 0.7);
  943. text-align: center;
  944. padding: rpx(20);
  945. font-size: rpx(12);
  946. }
  947. // 底部按钮样式
  948. .child-button {
  949. min-width: rpx(80);
  950. height: rpx(30);
  951. border-radius: rpx(8);
  952. font-size: rpx(12);
  953. font-weight: 500;
  954. transition: all 0.3s ease;
  955. box-shadow: 0 rpx(2) rpx(8) rgba(0, 0, 0, 0.1);
  956. &.confirm {
  957. background: linear-gradient(to bottom, #ab81ff, #8559dc);
  958. border: none;
  959. border-right: 15px;
  960. color: white;
  961. &:hover {
  962. background: linear-gradient(
  963. to bottom,
  964. color.adjust(#ab81ff, $lightness: -5%),
  965. color.adjust(#8559dc, $lightness: -5%)
  966. );
  967. transform: translateY(-rpx(1));
  968. color: white;
  969. }
  970. }
  971. &.cancel {
  972. background: white;
  973. border: rpx(1) solid rgba($primary-color, 0.3);
  974. color: $text-color;
  975. &:hover {
  976. background: rgba($primary-color, 0.05);
  977. border-color: rgba($primary-color, 0.5);
  978. transform: translateY(-rpx(1));
  979. }
  980. }
  981. }
  982. // AI对话图标样式
  983. .ai-icon-container {
  984. position: absolute;
  985. bottom: rpx(20);
  986. right: rpx(20);
  987. display: flex;
  988. flex-direction: column;
  989. align-items: center;
  990. cursor: pointer;
  991. transition: all 0.3s ease;
  992. &:hover {
  993. transform: translateY(-rpx(2));
  994. }
  995. .ai-icon {
  996. width: rpx(30);
  997. height: rpx(30);
  998. margin-bottom: rpx(0);
  999. filter: drop-shadow(0 rpx(2) rpx(4) rgba($primary-color, 0.3));
  1000. // 添加过渡动画
  1001. transition: transform 0.3s ease;
  1002. }
  1003. // 悬浮时放大效果
  1004. .ai-icon:hover {
  1005. transform: scale(1.5);
  1006. }
  1007. .ai-text {
  1008. color: $text-color;
  1009. font-size: rpx(8);
  1010. background-color: rgba(255, 255, 255, 0.7);
  1011. padding: rpx(2) rpx(5);
  1012. border-radius: rpx(5);
  1013. }
  1014. }
  1015. // AI消息样式
  1016. .ai-message {
  1017. display: flex;
  1018. align-items: flex-start;
  1019. margin-bottom: rpx(15);
  1020. .ai-avatar {
  1021. width: rpx(30);
  1022. height: rpx(30);
  1023. border-radius: 50%;
  1024. margin-right: rpx(10);
  1025. background-color: $primary-color;
  1026. padding: rpx(5);
  1027. // box-shadow: 0 rpx(2) rpx(5) rgba($primary-color, 0.2);
  1028. }
  1029. .ai-text-content {
  1030. background-color: $light-color;
  1031. padding: rpx(8) rpx(12);
  1032. border-radius: rpx(10);
  1033. font-size: rpx(10);
  1034. color: $text-color;
  1035. max-width: 80%;
  1036. // box-shadow: 0 rpx(1) rpx(3) rgba(0, 0, 0, 0.05);
  1037. }
  1038. }
  1039. // 用户输入框样式
  1040. .user-input {
  1041. ::v-deep(.el-input__wrapper) {
  1042. height: rpx(23);
  1043. border-top-left-radius: rpx(5);
  1044. border-bottom-left-radius: rpx(5);
  1045. border-color: rgba($primary-color, 0.3);
  1046. &:focus-within {
  1047. box-shadow: 0 0 0 rpx(1) rgba($primary-color, 0.5);
  1048. }
  1049. }
  1050. ::v-deep(.el-input__inner) {
  1051. font-size: rpx(10);
  1052. // color: $text-color;
  1053. text-indent: 1em;
  1054. }
  1055. ::v-deep(.el-input-group__append, .el-input-group__prepend) {
  1056. background: linear-gradient(to bottom, #ab81ff, #8559dc);
  1057. border-top-right-radius: rpx(5);
  1058. border-bottom-right-radius: rpx(5);
  1059. color: white;
  1060. font-size: rpx(9);
  1061. }
  1062. }
  1063. /* 定义淡入和缩放动画 */
  1064. .fade-scale-enter-active,
  1065. .fade-scale-leave-active {
  1066. transition: all 0.5s ease;
  1067. }
  1068. .fade-scale-enter-from,
  1069. .fade-scale-leave-to {
  1070. opacity: 0.1;
  1071. transform: scale(0.9);
  1072. }
  1073. // 自定义试题弹框背景
  1074. .child-dialog-wrapper {
  1075. position: fixed;
  1076. top: 0;
  1077. left: 0;
  1078. right: 0;
  1079. bottom: 0;
  1080. background-color: rgba(0, 0, 0, 0.6); // 半透明背景
  1081. display: flex;
  1082. justify-content: center;
  1083. align-items: center;
  1084. z-index: 1000;
  1085. }
  1086. .child-dialog {
  1087. border: none;
  1088. border-radius: rpx(15);
  1089. background: rgb(255, 255, 255, 0.8); // 柔和的蓝紫色渐变
  1090. overflow: hidden;
  1091. padding: rpx(5);
  1092. // width: 40%;
  1093. // height: 60%;
  1094. position: relative;
  1095. }
  1096. // AI对话弹框样式
  1097. .ai-dialog-wrapper {
  1098. position: fixed;
  1099. top: 0;
  1100. left: 0;
  1101. right: 0;
  1102. bottom: 0;
  1103. display: flex;
  1104. justify-content: flex-end;
  1105. align-items: center;
  1106. z-index: 1001;
  1107. pointer-events: none;
  1108. }
  1109. .ai-dialog {
  1110. border: none;
  1111. border-radius: rpx(15);
  1112. background: rgb(255, 255, 255, 0.8);
  1113. overflow: hidden;
  1114. padding: rpx(20);
  1115. width: 30%;
  1116. // 增加高度
  1117. height: 80%;
  1118. margin-right: rpx(50);
  1119. pointer-events: auto;
  1120. position: relative;
  1121. display: flex;
  1122. flex-direction: column;
  1123. &::before {
  1124. content: '';
  1125. position: absolute;
  1126. top: 0;
  1127. left: 0;
  1128. width: 100%;
  1129. height: rpx(10);
  1130. }
  1131. }
  1132. .ai-dialog-header {
  1133. position: relative;
  1134. display: flex;
  1135. justify-content: center;
  1136. align-items: center;
  1137. margin-bottom: rpx(15);
  1138. margin-top: rpx(-10);
  1139. img {
  1140. width: rpx(15);
  1141. }
  1142. h3 {
  1143. color: black;
  1144. font-size: rpx(12);
  1145. }
  1146. .close-btn {
  1147. padding: 0;
  1148. width: rpx(20);
  1149. height: rpx(20);
  1150. font-size: rpx(16);
  1151. line-height: 1;
  1152. position: absolute;
  1153. background-color: transparent;
  1154. border: none;
  1155. margin-left: rpx(200);
  1156. }
  1157. }
  1158. .ai-dialog-content {
  1159. flex: 1;
  1160. display: flex;
  1161. flex-direction: column;
  1162. }
  1163. .ai-message-history {
  1164. flex: 1;
  1165. // 当内容超出容器高度时,显示垂直滚动条
  1166. overflow-y: auto;
  1167. margin-bottom: rpx(15);
  1168. // 可以根据实际情况调整最大高度
  1169. font-size: rpx(5);
  1170. max-height: 50vh;
  1171. // padding: 5px 10px;
  1172. .message {
  1173. display: flex;
  1174. align-items: flex-start;
  1175. margin-bottom: rpx(10);
  1176. &.user {
  1177. flex-direction: row-reverse;
  1178. }
  1179. .avatar {
  1180. width: rpx(30);
  1181. height: rpx(30);
  1182. border-radius: 50%;
  1183. margin: 0 rpx(10);
  1184. }
  1185. .user {
  1186. width: 15px;
  1187. height: 15px;
  1188. }
  1189. .message-content {
  1190. background-color: #ffffff;
  1191. font-size: rpx(5);
  1192. max-width: 80%;
  1193. color: black;
  1194. box-shadow: 0 rpx(1) rpx(3) rgba(0, 0, 0, 0.05);
  1195. }
  1196. }
  1197. // 滚动条整体样式
  1198. &::-webkit-scrollbar {
  1199. width: rpx(4); // 滚动条宽度
  1200. }
  1201. // 滚动条滑块样式
  1202. &::-webkit-scrollbar-thumb {
  1203. background-color: $primary-color; // 滑块颜色
  1204. border-radius: rpx(4); // 滑块圆角
  1205. transition: background-color 0.3s ease; // 颜色过渡效果
  1206. &:hover {
  1207. //background-color: darken($primary-color, 10%); // 悬停时滑块颜色加深
  1208. }
  1209. }
  1210. // 滚动条轨道样式
  1211. &::-webkit-scrollbar-track {
  1212. background-color: rgba($primary-color, 0.2); // 轨道颜色
  1213. border-radius: rpx(4); // 轨道圆角
  1214. }
  1215. .message {
  1216. display: flex;
  1217. align-items: flex-start;
  1218. margin-bottom: rpx(10);
  1219. &.user {
  1220. flex-direction: row-reverse;
  1221. }
  1222. .avatar {
  1223. width: rpx(30);
  1224. height: rpx(30);
  1225. border-radius: 50%;
  1226. margin: 0 rpx(10);
  1227. }
  1228. .message-content {
  1229. background-color: white;
  1230. padding: rpx(8) rpx(12);
  1231. border-radius: rpx(5);
  1232. font-size: rpx(8);
  1233. color: black;
  1234. max-width: 80%;
  1235. box-shadow: 0 rpx(1) rpx(3) rgba(0, 0, 0, 0.05);
  1236. }
  1237. }
  1238. }
  1239. // 优化发送按钮样式
  1240. .send-button {
  1241. //background: linear-gradient(90deg, $primary-color, $secondary-color);
  1242. border: none;
  1243. color: white;
  1244. &:hover {
  1245. //background: linear-gradient(90deg, darken($primary-color, 5%), darken($secondary-color, 5%));
  1246. }
  1247. }
  1248. </style>
  1249. <style lang="scss">
  1250. // 搜索下拉框样式
  1251. @use 'sass:math';
  1252. // 定义rpx转换函数
  1253. @function rpx($px) {
  1254. @return math.div($px, 750) * 100vw;
  1255. }
  1256. /* 消除小三角 */
  1257. .el-popper__arrow {
  1258. display: none;
  1259. }
  1260. .el-popper.is-light,
  1261. .el-dropdown__popper.el-popper {
  1262. background: transparent;
  1263. border: none;
  1264. box-shadow: none;
  1265. }
  1266. .el-dropdown__popper {
  1267. --el-dropdown-menuItem-hover-color: none;
  1268. }
  1269. .el-autocomplete-suggestion .el-scrollbar__wrap {
  1270. margin: 0 auto;
  1271. background-color: rgba(255, 255, 255, 0.7);
  1272. border: 2px solid white;
  1273. border-radius: rpx(5);
  1274. backdrop-filter: blur(rpx(5));
  1275. }
  1276. .el-autocomplete-suggestion li {
  1277. color: black;
  1278. font-size: rpx(7);
  1279. padding: rpx(5) rpx(8); // 调整下拉项内边距
  1280. }
  1281. .el-autocomplete-suggestion li:hover {
  1282. background: linear-gradient(to bottom, #ffefb0, #ffcc00);
  1283. }
  1284. </style>
  1285. <style scoped lang="scss">
  1286. @use 'sass:math';
  1287. // 定义rpx转换函数
  1288. @function rpx($px) {
  1289. @return math.div($px, 750) * 100vw;
  1290. }
  1291. .default-messages {
  1292. margin-top: rpx(-10);
  1293. margin-bottom: rpx(5);
  1294. }
  1295. </style>