AIGeneralCourse.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950
  1. <template>
  2. <!-- AI智能课 -->
  3. <div class="home-container">
  4. <!-- 展开收起侧边栏 -->
  5. <div class="sidebar-container">
  6. <div class="sidebar-layout">
  7. <div
  8. class="icon-expand"
  9. :style="{
  10. backgroundColor: drawerVisible ? '#44449c' : '#7F70C840',
  11. left: drawerVisible ? '20%' : '0'
  12. }"
  13. @click="toggleDrawer"
  14. >
  15. <span
  16. class="vertical-lines"
  17. :style="{
  18. color: drawerVisible ? '#8a78d0' : 'white'
  19. }"
  20. >||</span
  21. >
  22. </div>
  23. </div>
  24. <transition name="drawer-slide">
  25. <div class="main-content" v-if="drawerVisible">
  26. <!-- 菜单栏 -->
  27. <div class="drawer-box">
  28. <el-row class="tac">
  29. <el-col :span="12">
  30. <el-menu
  31. v-if="menuInitialized"
  32. :default-active="currentActiveIndex"
  33. :default-openeds="[currentOpenedMenu]"
  34. :class="{ 'el-menu-vertical-demo': true }"
  35. unique-opened
  36. >
  37. <!-- 课程菜单 -->
  38. <el-sub-menu
  39. v-for="menu in menuList"
  40. :key="menu.id"
  41. :index="menu.id"
  42. @click="handleMenuClick(menu)"
  43. >
  44. <template #title>
  45. <span>{{ menu.title }}</span>
  46. </template>
  47. <el-menu-item
  48. v-for="(item, index) in menu.data"
  49. :key="menu.id + '-' + index"
  50. :index="menu.id + '-' + (index + 1).toString()"
  51. @click="goToAIExperience(item)"
  52. >
  53. {{ item.ctTypeSort }} {{ item.ctType }}
  54. </el-menu-item>
  55. </el-sub-menu>
  56. </el-menu>
  57. </el-col>
  58. </el-row>
  59. </div>
  60. </div>
  61. </transition>
  62. </div>
  63. <div class="content-box">
  64. <div class="box-1">
  65. <div class="inner-box left-box">
  66. <div class="box-icon" @click="goBack">
  67. <el-icon class="left-icon"><ArrowLeftBold /></el-icon>
  68. {{ pageTitle }}
  69. </div>
  70. <div class="dropdown-box">
  71. <!-- 下拉菜单 -->
  72. <el-dropdown v-model="selectedGrade" @command="handleGradeSelect" @visible-change="handleVisibleChange">
  73. <el-button type="primary">
  74. {{ selectedGrade }}
  75. <!-- 根据下拉框状态显示不同的箭头图标 -->
  76. <el-icon class="el-icon--right" v-if="!dropdownVisible"><ArrowDownBold /></el-icon>
  77. <el-icon class="el-icon--right" v-else><ArrowUpBold /></el-icon>
  78. </el-button>
  79. <template #dropdown>
  80. <el-dropdown-menu class="dropdown-menu">
  81. <el-dropdown-item
  82. v-for="item in classData"
  83. :key="item.id"
  84. :command="item.ctType"
  85. >{{ item.ctType }}</el-dropdown-item
  86. >
  87. </el-dropdown-menu>
  88. </template>
  89. </el-dropdown>
  90. </div>
  91. </div>
  92. <div class="inner-box right-box">
  93. <div class="top-right-box">
  94. <el-autocomplete
  95. v-model="SearchInput"
  96. :fetch-suggestions="querySearch"
  97. placeholder="搜索"
  98. @select="handleSearchSelect"
  99. class="search-input"
  100. value-key="ctType"
  101. :trigger-on-focus="false"
  102. :key="searchKey"
  103. >
  104. <template #prefix>
  105. <el-icon class="el-input__icon"><search /></el-icon>
  106. </template>
  107. <!-- 下拉项模板 -->
  108. <template #default="{ item }">
  109. <div class="scrollbar">
  110. <!-- 序号和标题 -->
  111. {{ item.ctTypeSort }} {{ item.ctType }}
  112. </div>
  113. </template>
  114. </el-autocomplete>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="box-2">
  119. <SpeechRecognition />
  120. <br/>
  121. <!-- 自主学习组件,只在AI自主学习时显示 -->
  122. <SelfDirectedLearning v-if="currentOpenedMenu === menuConfigTemp[3].id"
  123. @refreshData="refreshData" />
  124. <div
  125. class="small-box"
  126. v-for="(outlineData, index) in currentCourseData"
  127. :key="index"
  128. >
  129. <div
  130. class="nested-box"
  131. :style="{
  132. backgroundImage: `url(${outlineData.ctTypeImage})`,
  133. backgroundSize: 'cover'
  134. }"
  135. @click="goToAIExperience(outlineData)"
  136. ></div>
  137. <div class="additional-text">
  138. {{ outlineData.ctTypeSort }} {{ outlineData.ctType }}
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. </template>
  145. <script setup>
  146. import { ref, onMounted, computed, watch, onBeforeUnmount } from 'vue'
  147. import { ClassList, ClassOutline } from '@/api/class.js'
  148. // Element Plus 组件引入
  149. import {
  150. ArrowUpBold,
  151. ArrowDownBold,
  152. ArrowRightBold,
  153. Expand,
  154. Reading,
  155. Fold,
  156. Tickets
  157. } from '@element-plus/icons-vue'
  158. import { Search, ArrowLeftBold } from '@element-plus/icons-vue'
  159. import { ElAutocomplete } from 'element-plus' // 导入ElAutocomplete组件
  160. import { Message } from '@/utils/message/Message.js'
  161. import { useRouter } from 'vue-router'
  162. import teachingImg from '@/assets/icon/teaching.png'
  163. // 导入自主学习组件
  164. import SelfDirectedLearning from '@/components/study/SelfDirectedLearning.vue'
  165. import DialogContent from "@/views/AIPage/aiGenerate/DialogContent.vue";
  166. import {teacherList} from "@/api/teachers.js";
  167. import { CONFIG } from '@/utils/roleUtils.js'
  168. const router = useRouter() // 获取当前路由对象
  169. // 下拉菜单选中项
  170. const selectedGrade = ref('')
  171. // 抽屉显示状态
  172. const drawerVisible = ref(true)
  173. // 下拉框可见性状态
  174. const dropdownVisible = ref(false)
  175. // 处理下拉框显示/隐藏事件
  176. const handleVisibleChange = (visible) => {
  177. dropdownVisible.value = visible
  178. }
  179. // 课程数据管理 - 拆分成独立的数组
  180. const generalCourseData = ref([])
  181. const practicalCourseData = ref([])
  182. const aiCourseData = ref([])
  183. const selfStudyCourseData = ref([])
  184. // 菜单配置
  185. const menuConfigTemp = [
  186. { id: '/general', title: 'AI通识课', type: '1', data: generalCourseData },
  187. { id: '/practical', title: 'AI实操课', type: '2', data: practicalCourseData },
  188. { id: '/poetry', title: 'AI古诗词', type: '3', data: aiCourseData },
  189. { id: '/selfstudy', title: 'AI自主学习', type: '4', data: selfStudyCourseData }
  190. ]
  191. const menuConfig = computed(() => {
  192. return menuConfigTemp.filter(item=> {
  193. return roleRouteMenuSet.value.includes(item.id)
  194. })
  195. })
  196. // 菜单列表计算属性
  197. const menuList = computed(() => {
  198. return menuConfig.value.map(menu => ({
  199. ...menu,
  200. data: menu.data.value
  201. }))
  202. })
  203. // 获取角色路由菜单集合
  204. const roleRouteMenuSet = computed(() => {
  205. try {
  206. const roleRouteMenuStr = localStorage.getItem(CONFIG.USER_ROLE_ROUTE_MENU_KEY)
  207. return roleRouteMenuStr ? JSON.parse(roleRouteMenuStr) : []
  208. } catch (error) {
  209. console.error('Error parsing roleRouteMenuSet:', error)
  210. return []
  211. }
  212. })
  213. // 当前选中的菜单索引
  214. const currentActiveIndex = ref('/general-1')
  215. // 当前打开的菜单
  216. const currentOpenedMenu = ref('/general')
  217. // 菜单初始化状态
  218. const menuInitialized = ref(false)
  219. // 存储选中状态的键名
  220. const activeMenuKey = 'aiGeneralCourseActiveMenu'
  221. const activeIndexKey = 'aiGeneralCourseActiveIndex'
  222. // 处理课程数据,添加序号
  223. const processCourseData = (data) => {
  224. return data.map((item, index) => {
  225. item.ctTypeSort = index + 1
  226. item.ctTypeSort = item.ctTypeSort > 9 ? item.ctTypeSort : "0" + item.ctTypeSort
  227. return item
  228. })
  229. }
  230. // 保存当前选中状态
  231. const saveActiveState = (menuId, index) => {
  232. localStorage.setItem(activeMenuKey, menuId)
  233. localStorage.setItem(activeIndexKey, index)
  234. }
  235. // 刷新AI生成课数据
  236. const refreshData = async () => {
  237. const res = await ClassOutline(localStorage.getItem('selectedGradeId'), menuConfigTemp[3].type)
  238. if (res.code === 0) {
  239. selfStudyCourseData.value = processCourseData(res.data)
  240. }
  241. }
  242. // 统一函数来获取课程大纲数据 通识课/实操课/AI生成课
  243. const fetchClassOutline = async (classId) => {
  244. try {
  245. // 并行获取所有课程类型数据
  246. await Promise.all(menuConfig.value.map(async (menu) => {
  247. const res = await ClassOutline(classId, menu.type)
  248. if (res.code === 0) {
  249. menu.data.value = processCourseData(res.data)
  250. }
  251. }))
  252. } catch (error) {
  253. console.error('获取课程大纲数据失败:', error)
  254. }
  255. }
  256. // 处理菜单点击
  257. const handleMenuClick = (menu) => {
  258. currentOpenedMenu.value = menu.id
  259. saveActiveState(menu.id, menu.id)
  260. // 清空搜索框内容
  261. SearchInput.value = ''
  262. // 如果该菜单下有课程数据,设置默认选中第一项
  263. if (menu.data.value && menu.data.value.length > 0) {
  264. currentActiveIndex.value = menu.id + '-1'
  265. }
  266. }
  267. // 处理下拉菜单选择
  268. const handleGradeSelect = command => {
  269. selectedGrade.value = command
  270. // 保存选中值到localStorage
  271. localStorage.setItem('selectedGrade', command)
  272. // 年级切换时重新加载数据的逻辑
  273. const selectedItem = classData.value.find(item => item.ctType === command)
  274. // 清空搜索框内容
  275. SearchInput.value = ''
  276. // 存储年级id
  277. if (selectedItem) {
  278. localStorage.setItem('selectedGradeId', selectedItem.id)
  279. // 获取课程大纲
  280. fetchClassOutline(selectedItem.id).then(() => {
  281. // 数据加载完成后,恢复之前的菜单选中状态
  282. const savedMenu = localStorage.getItem(activeMenuKey)
  283. const savedIndex = localStorage.getItem(activeIndexKey)
  284. if (savedMenu && savedIndex) {
  285. currentOpenedMenu.value = savedMenu
  286. currentActiveIndex.value = savedIndex
  287. }
  288. })
  289. }
  290. }
  291. // 切换抽屉显示状态的函数
  292. const toggleDrawer = () => {
  293. drawerVisible.value = !drawerVisible.value
  294. }
  295. // 获取年级
  296. const classData = ref([])
  297. const fetchCtTypes = async () => {
  298. try {
  299. const response = await ClassList()
  300. if (response.code === 0) {
  301. classData.value = response.data
  302. // 获取到数据,优先从localStorage读取选中值
  303. const savedGrade = localStorage.getItem('selectedGrade')
  304. selectedGrade.value = savedGrade || (classData.value.length > 0 ? classData.value[0].ctType : '')
  305. // 初始化时获取课程大纲数据
  306. const selectedItem = classData.value.find(item => item.ctType === selectedGrade.value) || classData.value[0]
  307. if (selectedItem) {
  308. // 使用新函数获取课程大纲
  309. fetchClassOutline(selectedItem.id)
  310. }
  311. }
  312. } catch (error) {
  313. console.error('获取 ctType 数据失败:', error)
  314. }
  315. }
  316. // 获取课程标题
  317. const getCourseTitle = index => {
  318. if (
  319. classOutlineData.value.length > 0 &&
  320. index > 0 &&
  321. index <= classOutlineData.value.length
  322. ) {
  323. return classOutlineData.value[index - 1].ctType
  324. }
  325. return ''
  326. }
  327. // 首页点击渲染后的页面title
  328. const pageTitle = ref('返回首页')
  329. onMounted(() => {
  330. //加载所有数据
  331. fetchCtTypes()
  332. // 读取之前保存的选中状态
  333. const savedMenu = localStorage.getItem(activeMenuKey)
  334. const savedIndex = localStorage.getItem(activeIndexKey)
  335. if (savedMenu && savedIndex) {
  336. currentOpenedMenu.value = savedMenu
  337. currentActiveIndex.value = savedIndex
  338. }
  339. // 标记菜单已初始化,触发el-menu重新渲染
  340. menuInitialized.value = true
  341. // const title = history.state?.title
  342. // if (title) {
  343. // pageTitle.value = title
  344. // }
  345. })
  346. // 搜索框
  347. const SearchInput = ref('')
  348. // 用于强制重新渲染搜索组件的key
  349. const searchKey = ref(Date.now())
  350. // 当前显示的课程数据
  351. const currentCourseData = computed(() => {
  352. const menu = menuConfig.value.find(m => m.id == currentOpenedMenu.value)
  353. return (menu && menu.data.value) || generalCourseData.value
  354. })
  355. // 搜索建议查询方法
  356. const querySearch = (queryString, cb) => {
  357. const data = currentCourseData.value
  358. const results = queryString
  359. ? data.filter(item => {
  360. // 课程标题和序号查询
  361. return item.ctType.toLowerCase().includes(queryString.toLowerCase()) ||
  362. // 类型检查,确保ctTypeSort是字符串类型
  363. (item.ctTypeSort && item.ctTypeSort.toString().includes(queryString))
  364. })
  365. : data
  366. cb(results)
  367. }
  368. // 搜索选择处理方法
  369. const handleSearchSelect = item => {
  370. goToAIExperience(item)
  371. // 清空输入框
  372. SearchInput.value = '';
  373. }
  374. // 修改过滤逻辑,直接使用currentCourseData
  375. const filteredTitles = computed(() => {
  376. const data = currentCourseData.value
  377. if (!SearchInput.value) {
  378. return data
  379. }
  380. return data.filter(title =>
  381. title.ctType.toLowerCase().includes(SearchInput.value.toLowerCase()) ||
  382. // 类型检查,确保ctTypeSort是字符串类型
  383. (title.ctTypeSort && title.ctTypeSort.toString().includes(SearchInput.value))
  384. )
  385. })
  386. // 添加按钮显示状态
  387. const buttonVisible = ref(false)
  388. const goBack = () => {
  389. router.push('/home') // 跳转到HomePage
  390. }
  391. const goToAIExperience = outlineData => {
  392. // 确定当前课程所属的菜单类型
  393. const menuId = currentOpenedMenu.value
  394. // 找到当前课程在对应菜单中的索引
  395. const menu = menuConfig.value.find(m => m.id === menuId)
  396. const currentData = menu ? menu.data.value : []
  397. const index = currentData.findIndex(item => item.id === outlineData.id)
  398. if (index !== -1) {
  399. const menuIndex = menuId + '-' + (index + 1)
  400. // 保存选中状态
  401. saveActiveState(menuId, menuIndex)
  402. }
  403. // 课程跳转逻辑
  404. router.push({
  405. path: '/ai-develop', // 跳转视频页面
  406. state: { typeId: outlineData.id, typeName: outlineData.ctType, typeSort: outlineData.ctTypeSort }
  407. })
  408. }
  409. </script>
  410. <style scoped lang="scss">
  411. @use 'sass:math';
  412. // 定义rpx转换函数
  413. @function rpx($px) {
  414. @return math.div($px, 750) * 100vw;
  415. }
  416. /* 添加过渡样式 */
  417. .drawer-slide-enter-active,
  418. .drawer-slide-leave-active {
  419. transition: all 0.3s ease;
  420. }
  421. .drawer-slide-enter-from,
  422. .drawer-slide-leave-to {
  423. transform: translateX(-100%);
  424. opacity: 0;
  425. transition: all 0.3s ease;
  426. }
  427. .home-container {
  428. position: fixed;
  429. top: 0;
  430. left: 0;
  431. right: 0;
  432. bottom: 0;
  433. display: flex;
  434. flex-direction: row;
  435. background: linear-gradient(
  436. to bottom,
  437. #e2ddfc,
  438. #f1effd
  439. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  440. gap: rpx(0);
  441. }
  442. .sidebar-layout {
  443. display: flex;
  444. flex-direction: row;
  445. align-items: flex-start;
  446. }
  447. .icon-wrapper {
  448. width: 40px; /* 根据实际需要调整宽度 */
  449. flex-shrink: 0;
  450. background-color: saddlebrown;
  451. }
  452. .main-content {
  453. width: rpx(150);
  454. height: 100%;
  455. flex-grow: 1;
  456. background: linear-gradient(to bottom, hsl(230, 100%, 21%), #8a78d0);
  457. position: relative;
  458. overflow-y: auto; /* 添加垂直滚动条 */
  459. max-height: 100%; /* 设置最大高度 */
  460. transition: all 0.3s ease;
  461. // 自定义滚动条样式
  462. &::-webkit-scrollbar {
  463. width: rpx(0); // 滚动条宽度
  464. }
  465. &::-webkit-scrollbar-track {
  466. background-color: rgba(255, 255, 255, 0.1); // 滚动条轨道背景色
  467. border-radius: rpx(2); // 滚动条轨道圆角
  468. }
  469. &::-webkit-scrollbar-thumb {
  470. background-color: rgba(255, 255, 255, 0.3); // 滚动条滑块颜色
  471. border-radius: rpx(2); // 滚动条滑块圆角
  472. transition: background-color 0.3s ease; // 滑块颜色过渡效果
  473. }
  474. &::-webkit-scrollbar-thumb:hover {
  475. background-color: rgba(255, 255, 255, 0.5); // 鼠标悬停时的滑块颜色
  476. }
  477. }
  478. .icon-expand {
  479. width: rpx(8);
  480. height: rpx(35);
  481. border-top-right-radius: rpx(5);
  482. border-bottom-right-radius: rpx(5);
  483. z-index: 9999;
  484. position: absolute;
  485. top: 50%;
  486. transform: translateY(-50%);
  487. cursor: pointer; // 鼠标指针样式
  488. // 修改裁剪路径使右侧边缘垂直无缝贴合
  489. clip-path: polygon(0 0, 100% 15%, 100% 90%, 0 100%);
  490. display: flex;
  491. justify-content: center;
  492. align-items: center;
  493. // 统一过渡时间与菜单保持同步
  494. transition: all 0.3s ease;
  495. }
  496. .icon-expand .vertical-lines {
  497. color: #8a78d0;
  498. font-size: rpx(10);
  499. }
  500. .content-box {
  501. flex: 1;
  502. height: 100%;
  503. display: flex;
  504. flex-direction: column; /* 子元素上下排列 */
  505. background: linear-gradient(
  506. to bottom,
  507. #e2ddfc,
  508. #f1effd
  509. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  510. }
  511. .tac .el-menu {
  512. background-color: transparent;
  513. border: none;
  514. width: 100%;
  515. margin-left: rpx(10);
  516. margin-top: rpx(10);
  517. }
  518. .el-sub-menu ::v-deep(.el-menu){
  519. background-color: transparent;
  520. }
  521. .el-menu-item {
  522. width: rpx(130);
  523. height: rpx(25);
  524. margin-bottom: rpx(5);
  525. border-radius: rpx(6);
  526. color: white;
  527. font-size: rpx(8);
  528. }
  529. .el-sub-menu ::v-deep(.el-sub-menu__title) {
  530. width: rpx(130);
  531. margin-bottom: rpx(5);
  532. border-radius: rpx(6);
  533. color: white;
  534. font-size: rpx(9);
  535. font-weight: bold;
  536. padding-left: rpx(10) !important;
  537. height: rpx(25);
  538. line-height: rpx(30);
  539. background: rgba(255, 255, 255, 0.1);
  540. transition: all 0.3s ease;
  541. // flex布局使标题和图标两端对齐
  542. display: flex;
  543. justify-content: space-between;
  544. align-items: center;
  545. }
  546. .el-sub-menu ::v-deep(.el-sub-menu__title:hover) {
  547. background: linear-gradient(
  548. to bottom,
  549. #ffefb0,
  550. #ffcc00
  551. );
  552. color: black;
  553. box-shadow: 0 4px 8px rgb(0, 0, 0, 0.2);
  554. }
  555. .el-sub-menu.is-opened ::v-deep(.el-sub-menu__title) {
  556. background: linear-gradient(
  557. to bottom,
  558. #ffefb0,
  559. #ffcc00
  560. );
  561. color: black;
  562. box-shadow: 0 4px 8px rgb(0, 0, 0, 0.2);
  563. }
  564. .el-sub-menu ::v-deep(.el-icon) {
  565. font-size: rpx(12);
  566. color: white;
  567. }
  568. // 添加折叠图标样式
  569. .el-sub-menu ::v-deep(.el-sub-menu__icon-arrow) {
  570. color: white;
  571. font-size: rpx(10);
  572. margin-left: auto; // 将图标推到右侧
  573. margin-top: rpx(-5);
  574. display: block;
  575. width: rpx(16); // 确保有明确宽度
  576. }
  577. .el-sub-menu.is-opened ::v-deep(.el-icon) {
  578. color: black;
  579. }
  580. .el-sub-menu ::v-deep(.el-sub-menu__title:hover .el-icon) {
  581. color: black;
  582. }
  583. .el-menu ::v-deep(.el-menu-item:hover),
  584. .el-menu ::v-deep(.el-menu-item:focus),
  585. .el-menu ::v-deep(.el-menu-item:active) {
  586. background: linear-gradient(
  587. to bottom,
  588. #ffefb0,
  589. #ffcc00
  590. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  591. box-shadow: 0 4px 8px rgb(0, 0, 0, 0.2);
  592. color: black;
  593. }
  594. .drawer-box {
  595. position: absolute;
  596. display: flex;
  597. // align-items: center;
  598. margin-top: rpx(10);
  599. height: 100%;
  600. width: 100%;
  601. }
  602. .drawer-box .toggle-button {
  603. width: rpx(10);
  604. height: rpx(50);
  605. background-color: rgba(165, 209, 247, 0.2);
  606. border: none;
  607. position: relative;
  608. writing-mode: vertical-lr; // 文字垂直排列,从左到右
  609. text-orientation: upright; // 文字保持正立
  610. }
  611. .toggle-button:hover {
  612. left: 0;
  613. }
  614. .drawer-box ::v-deep(.el-drawer.ltr) {
  615. background-color: rgb(255, 255, 255, 0.7);
  616. box-shadow: 0 8px 8px rgba(202, 52, 52, 0.1);
  617. }
  618. .drawer-box ::v-deep(.el-drawer__header) {
  619. margin-bottom: rpx(0);
  620. }
  621. .drawer-box ::v-deep(.el-drawer__body)::-webkit-scrollbar {
  622. width: rpx(4);
  623. }
  624. .drawer-box ::v-deep(.el-drawer__body)::-webkit-scrollbar-thumb {
  625. background-color: rgba(0, 0, 0, 0.2);
  626. border-radius: 8px;
  627. }
  628. .drawer-box ::v-deep(.el-drawer__body)::-webkit-scrollbar-track {
  629. background-color: rgba(0, 0, 0, 0.05);
  630. border-radius: 8px;
  631. }
  632. .toggle-button.is-active,
  633. .toggle-button:active,
  634. .toggle-button:focus {
  635. background-color: rgba(165, 209, 247, 0.8);
  636. color: black;
  637. border: none; // 移除点击时的边框
  638. outline: none; // 移除点击时的外边框
  639. }
  640. .box-1 {
  641. width: 100%;
  642. height: rpx(50);
  643. display: flex;
  644. justify-content: center;
  645. align-items: center;
  646. box-sizing: border-box;
  647. font-size: rpx(16); // 默认字体大小
  648. }
  649. .inner-box {
  650. height: 100%;
  651. display: flex;
  652. justify-content: center;
  653. align-items: center;
  654. font-size: rpx(16); // 默认字体大小
  655. }
  656. .left-box {
  657. position: relative;
  658. justify-content: left;
  659. flex: 1;
  660. display: flex;
  661. align-items: center;
  662. gap: rpx(5); // 间距控制
  663. }
  664. .box-icon {
  665. height: 100%;
  666. display: flex;
  667. align-items: center; // 垂直居中
  668. color: black; // 设置图标颜色为白色
  669. padding-left: rpx(15);
  670. font-size: rpx(10); // 设置图标大小,可按需调整
  671. cursor: pointer; // 鼠标指针样式
  672. z-index: 999;
  673. }
  674. // .box-icon .left-icon {
  675. // margin-left: rpx(10);
  676. // margin-right: rpx(5); // 设置图标和文字之间的间距 ;
  677. // }
  678. .left-box span {
  679. position: absolute;
  680. top: 20px;
  681. left: 20px;
  682. font-size: rpx(11); // 默认字体大小
  683. color: white;
  684. }
  685. .dropdown-box {
  686. height: 100%;
  687. display: flex; // flex 布局;
  688. align-items: center; // 垂直居中;
  689. }
  690. .dropdown-box .el-button {
  691. width: rpx(60); // 设置按钮宽度;
  692. height: rpx(15); // 设置按钮高度;
  693. background-color: rgb(255, 255, 255, 0.7);
  694. border: 1px white solid;
  695. box-shadow: 0 4px 8px rgb(0, 0, 0, 0.3);
  696. color: black;
  697. border: none;
  698. margin-left: rpx(10);
  699. border-radius: rpx(12);
  700. font-size: rpx(8); // 设置字体大小;
  701. }
  702. .dropdown-box .el-button:hover,
  703. .dropdown-box .el-button:focus,
  704. .dropdown-box .el-button:active {
  705. border: none; /* 移除悬停、聚焦、点击状态下的边框 */
  706. outline: none; /* 移除悬停、聚焦、点击状态下的轮廓线 el-scrollbar__view el-dropdown__list */
  707. }
  708. .dropdown-menu {
  709. width: rpx(100);
  710. border-radius: rpx(5);
  711. border: 1px white solid;
  712. background-color: rgb(255, 255, 255, 0.5);
  713. backdrop-filter: blur(rpx(5));
  714. box-shadow: 0 4px 8px rgba(202, 52, 52, 0.1);
  715. margin-left: rpx(40);
  716. }
  717. .dropdown-menu ::v-deep(.el-dropdown-menu__item) {
  718. font-size: rpx(8);
  719. color: black;
  720. border-radius: rpx(5);
  721. width: rpx(78);
  722. height: rpx(20);
  723. margin-left: rpx(4);
  724. margin-bottom: rpx(8);
  725. }
  726. .dropdown-menu ::v-deep(.el-dropdown-menu__item:hover),
  727. .dropdown-menu ::v-deep(.el-dropdown-menu__item:focus),
  728. .dropdown-menu ::v-deep(.el-dropdown-menu__item:active) {
  729. background: linear-gradient(
  730. to bottom,
  731. #fee78a,
  732. #ffce1b
  733. ); /* 设置悬停、聚焦、点击状态下的背景色 */
  734. }
  735. .right-box {
  736. flex: 1;
  737. position: relative; // 添加相对定位;
  738. // background-color: #fff;
  739. display: flex;
  740. justify-content: right;
  741. align-items: center;
  742. }
  743. .top-right-box {
  744. width: rpx(130);
  745. display: flex;
  746. justify-content: flex;
  747. }
  748. .top-right-box {
  749. ::v-deep(.el-input__wrapper) {
  750. height: rpx(15);
  751. font-size: rpx(6);
  752. background-color: rgb(255, 255, 255, 0.5);
  753. border-radius: rpx(12);
  754. border: white 1px solid;
  755. color: #aaa5c5;
  756. }
  757. ::v-deep(.el-input__icon) {
  758. color: #aaa5c5; // 设置输入框图标颜色为白色
  759. }
  760. // 添加占位符样式
  761. ::v-deep(.el-input__inner::placeholder) {
  762. color: #aaa5c5;
  763. }
  764. // 添加输入框文字颜色样式
  765. ::v-deep(.el-input__inner) {
  766. color: black;
  767. }
  768. ::v-deep(.el-input--prefix){
  769. width: rpx(100);
  770. text-align: right;
  771. }
  772. }
  773. // 搜索
  774. .search-input {
  775. width: rpx(200); // 增加搜索框宽度
  776. height: rpx(30); // 增加搜索框高度
  777. font-size: rpx(9);
  778. border-radius: rpx(8); // 添加圆角
  779. border: 1px solid #dcdfe6; // 添加边框
  780. }
  781. ::v-deep(.el-input__inner) {
  782. color: #333; // 调整文字颜色
  783. }
  784. .box-2 {
  785. width: 100%;
  786. flex: 1;
  787. box-sizing: border-box;
  788. display: flex; // 确保子元素水平排列
  789. flex-wrap: wrap; // 允许子元素换行;
  790. cursor: pointer; // 添加鼠标指针样式
  791. // margin: rpx(10) 0;
  792. overflow-y: auto;
  793. }
  794. // Chrome、Edge等浏览器的滚动条样式
  795. .box-2::-webkit-scrollbar {
  796. width: rpx(2);
  797. }
  798. .box-2::-webkit-scrollbar-track {
  799. background: transparent; // 设置滚动条轨道背景
  800. border-radius: rpx(3); // 设置滚动条轨道圆角
  801. }
  802. .box-2::-webkit-scrollbar-thumb {
  803. background: linear-gradient(to bottom, hsl(230, 100%, 21%), #8a78d0);
  804. border-radius: rpx(3); // 设置滚动条滑块圆角
  805. }
  806. .box-2::-webkit-scrollbar-thumb:hover {
  807. background: linear-gradient(to bottom, hsl(230, 100%, 21%), #8a78d0);
  808. }
  809. .small-box {
  810. flex: 0 0 calc(33.333% - rpx(10)); // 每个小盒子占三分之一宽度,减去间距
  811. margin-left: rpx(10); // 设置小盒子间距
  812. margin-top: rpx(3); // 设置小盒子间距
  813. display: flex;
  814. flex-direction: column;
  815. justify-content: flex-start;
  816. align-items: center;
  817. color: black;
  818. font-size: rpx(8);
  819. }
  820. .nested-box {
  821. width: rpx(150);
  822. height: rpx(80);
  823. border-radius: rpx(10);
  824. margin-top: rpx(5);
  825. display: flex;
  826. border: 1px solid white; // 添加边框;
  827. justify-content: center;
  828. align-items: center;
  829. }
  830. .nested-box:hover,
  831. .nested-box:active {
  832. box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  833. }
  834. .additional-text {
  835. margin-bottom: rpx(4);
  836. font-size: rpx(8);
  837. }
  838. </style>
  839. <style lang="scss">
  840. /* 消除小三角 */
  841. .el-popper__arrow {
  842. display: none;
  843. }
  844. .el-popper.is-light,
  845. .el-dropdown__popper.el-popper {
  846. background: transparent;
  847. border: none;
  848. box-shadow: none;
  849. }
  850. .el-dropdown__popper {
  851. --el-dropdown-menuItem-hover-color: none;
  852. }
  853. </style>
  854. <style lang='scss'>
  855. // 搜索下拉框样式
  856. @use 'sass:math';
  857. // 定义rpx转换函数
  858. @function rpx($px) {
  859. @return math.div($px, 750) * 100vw;
  860. }
  861. .el-autocomplete-suggestion .el-scrollbar__wrap{
  862. margin: 0 auto;
  863. background-color: rgba(255, 255, 255, 0.7);
  864. border: 2px solid white;
  865. border-radius: rpx(5);
  866. backdrop-filter: blur(rpx(5));
  867. }
  868. .el-autocomplete-suggestion li{
  869. color: black;
  870. font-size: rpx(7);
  871. padding: rpx(5) rpx(8); // 调整下拉项内边距
  872. }
  873. .el-autocomplete-suggestion li:hover{
  874. background: linear-gradient(
  875. to bottom,
  876. #ffefb0,
  877. #ffcc00
  878. );
  879. }
  880. </style>