AIDevelop.vue 35 KB

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