AIGeneralCourse.vue 22 KB

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