AIGeneralCourse.vue 22 KB

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