AIGeneralCourse.vue 23 KB

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