AIGeneralCourse.vue 22 KB

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