index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <div class="lear_center">
  3. <!-- 头部导航及搜索 -->
  4. <div class="nav">
  5. <!-- 登录导航 -->
  6. <Header />
  7. <div class="shade"></div>
  8. </div>
  9. <div class="nav_title">
  10. <div class="inner">
  11. <el-menu
  12. :default-active="activeIndex"
  13. class="el-menu-demo"
  14. mode="horizontal"
  15. @select="handleSelect"
  16. text-color="#000"
  17. active-text-color="#FF9900"
  18. >
  19. <el-menu-item index="COURSE">教学</el-menu-item>
  20. <el-menu-item index="TEXTBOOK">教材</el-menu-item>
  21. <!-- <el-menu-item index="LIVE LESSON">LIVE LESSON</el-menu-item>
  22. <el-menu-item index="VIDEO COURSE">VIDEO COURSE</el-menu-item> -->
  23. </el-menu>
  24. <div class="seek" @keydown="keyDownSeekData">
  25. <el-input
  26. v-model="SeekName"
  27. style="width: 300px"
  28. placeholder="请输入内容"
  29. >
  30. </el-input>
  31. <img
  32. @click="gotoSeekResult"
  33. src="../../assets/learncenter/Group2149.png"
  34. alt=""
  35. />
  36. </div>
  37. </div>
  38. </div>
  39. <!-- 主要信息列表 -->
  40. <div class="main" v-loading="loading">
  41. <!-- 轮播图 -->
  42. <!-- <div class="carouSel">
  43. <el-carousel height="360px">
  44. <el-carousel-item v-for="(item, i) in ImageList" :key="i">
  45. <el-image lazy :src="item.picture_url" alt=""> </el-image>
  46. </el-carousel-item>
  47. </el-carousel>
  48. </div> -->
  49. <div class="ClassifyList">
  50. <div id="COURSE">
  51. <Course :classList="courseList" />
  52. </div>
  53. <div id="TEXTBOOK">
  54. <Textbook :classList="TextbookList" />
  55. </div>
  56. <!-- <div id="LIVE LESSON">
  57. <Live :classList="classList" />
  58. </div>
  59. <div id="VIDEO COURSE">
  60. <VideoCourse :classList="classList" />
  61. </div> -->
  62. </div>
  63. </div>
  64. </div>
  65. </template>
  66. <script>
  67. import Header from "@/components/Header";
  68. import Course from "@/components/learnCenter/Course";
  69. import Textbook from "@/components/learnCenter/Textbook";
  70. import Live from "@/components/learnCenter/Live";
  71. import VideoCourse from "@/components/learnCenter/VideoCourse";
  72. import Cookies from "js-cookie";
  73. import { cousrseAPI, TextbookAPI } from "@/api/api";
  74. export default {
  75. name: "lear_center",
  76. components: {
  77. Header,
  78. Course,
  79. Textbook,
  80. Live,
  81. VideoCourse,
  82. },
  83. data() {
  84. return {
  85. seekContent: "", //搜索内容
  86. activeIndex: "COURSE", //默认展示精品课程
  87. navName: "COURSE",
  88. buy: false,
  89. classList: [
  90. {
  91. name: "Boardofdireelordsadsadasdsadsadsadsadwqdwqfregdsfasfdsafewafeawfdsfewfewfdsasdfasfd",
  92. buy: false,
  93. price: "19.9",
  94. },
  95. {
  96. name: "Board of direelor",
  97. buy: "$ 298.00",
  98. price: "19.9",
  99. },
  100. {
  101. name: "Board of direelor",
  102. buy: false,
  103. price: "19.9",
  104. },
  105. {
  106. name: "Board of direelor",
  107. buy: "$ 298.00",
  108. price: "19.9",
  109. },
  110. {
  111. name: "Board of direelor",
  112. buy: false,
  113. price: "19.9",
  114. },
  115. {
  116. name: "Board of direelor",
  117. buy: false,
  118. price: "19.9",
  119. },
  120. {
  121. name: "Board of direelor",
  122. buy: "$ 298.00",
  123. price: "19.9",
  124. },
  125. ],
  126. dimSeekData: [
  127. {
  128. value: "dsadqwjkldjwklqjdlkcnx",
  129. },
  130. {
  131. value: "dsadqwjkldjwklqjdlkcnx",
  132. },
  133. {
  134. value: "dsadqwjkldjwklqjdlkcnx",
  135. },
  136. ],
  137. disSeekShow: false,
  138. loading: false,
  139. ImageList: [
  140. {
  141. url: "../../assets/learncenter/Rectangle 1048.png",
  142. name: "Rectangle 1048",
  143. },
  144. {
  145. url: "../../assets/learncenter/Rectangle 1049.png",
  146. name: "Rectangle 1049",
  147. },
  148. {
  149. url: "../../assets/learncenter/Rectangle 1051.png",
  150. name: "Rectangle 1051",
  151. },
  152. {
  153. url: "../../assets/learncenter/Rectangle 1052.png",
  154. name: "Rectangle 1052",
  155. },
  156. ], //轮播图列表 测试
  157. courseList: null, //课程列表
  158. TextbookList: null, //教材列表
  159. SeekName: "",
  160. };
  161. },
  162. computed: {},
  163. methods: {
  164. // 切换导航
  165. handleSelect(key, keyPath) {
  166. console.log(key, keyPath);
  167. this.navName = key;
  168. this.changeNav(key);
  169. },
  170. // 锚点定位
  171. changeNav(index) {
  172. let id = index;
  173. let dom = document.getElementById(id);
  174. if (dom) {
  175. document.getElementById(id).scrollIntoView();
  176. }
  177. },
  178. // 搜索
  179. seekList() {
  180. this.disSeekShow = true;
  181. },
  182. // 前往搜索结果
  183. gotoSeekResult(item) {
  184. // this.$router.push({ path: "/SeekResult", query: { item } });
  185. if (this.SeekName == "") {
  186. this.$message.warning("Please enter the contents");
  187. return;
  188. } else {
  189. this.$router.push({
  190. path: "/learncenter/Seekresult",
  191. query: {
  192. keycode: this.SeekName,
  193. },
  194. });
  195. }
  196. },
  197. keyDownSeekData(e) {
  198. if (e.keyCode == 13) {
  199. this.gotoSeekResult();
  200. }
  201. },
  202. },
  203. created() {
  204. this.loading = true;
  205. // 获取课程列表 需要从中截取出4个作为轮播图
  206. cousrseAPI("page_query-PageQueryCourseList", {
  207. page_capacity: 8,
  208. cur_page: 1,
  209. finish_status: 53,
  210. release_status: 1,
  211. })
  212. .then((res) => {
  213. this.courseList = res.course_list;
  214. this.ImageList = res.course_list.slice(0, 4);
  215. })
  216. .catch(() => {
  217. this.loading = false;
  218. });
  219. // 获取教材列表
  220. TextbookAPI("book-book_manager-PageQueryBookList", {
  221. page_capacity: 10,
  222. cur_page: 1,
  223. publish_status: 1,
  224. is_control_publish_scope: "true",
  225. })
  226. .then((res) => {
  227. this.TextbookList = res.book_list;
  228. this.loading = false;
  229. })
  230. .catch(() => {
  231. this.loading = false;
  232. });
  233. },
  234. };
  235. </script>
  236. <style lang="scss" scoped>
  237. .lear_center {
  238. min-height: 100vh;
  239. background: #f6f6f6;
  240. .nav {
  241. background: #ffffff;
  242. height: 64px;
  243. position: relative;
  244. .shade {
  245. position: absolute;
  246. top: 0;
  247. width: 100%;
  248. height: 100%;
  249. background: rgba(0, 0, 0, 0.5);
  250. display: flex;
  251. color: #fff;
  252. font-weight: bold;
  253. font-size: 18px;
  254. justify-content: space-around;
  255. align-items: center;
  256. .el-menu-demo {
  257. background: rgba(0, 0, 0, 0);
  258. li:hover {
  259. background: none;
  260. }
  261. li {
  262. background: none;
  263. }
  264. }
  265. }
  266. }
  267. .nav_title {
  268. background: #fff;
  269. .inner {
  270. width: 1200px;
  271. margin: 0 auto;
  272. height: 64px;
  273. display: flex;
  274. justify-content: space-between;
  275. align-items: center;
  276. }
  277. .el-menu-item {
  278. font-size: 16px;
  279. }
  280. // 取消组件默认的样式
  281. .el-menu.el-menu--horizontal {
  282. border-bottom: none;
  283. }
  284. }
  285. .carouSel {
  286. width: 1200px;
  287. height: 316px;
  288. margin: 0 auto;
  289. padding-top: 24px;
  290. .el-image {
  291. width: 100%;
  292. height: 100%;
  293. }
  294. img {
  295. width: 100%;
  296. height: 100%;
  297. }
  298. // .el-carousel__item:nth-child(2n) {
  299. // background-color: #99a9bf;
  300. // }
  301. // .el-carousel__item:nth-child(2n + 1) {
  302. // background-color: #d3dce6;
  303. // }
  304. }
  305. .seek {
  306. position: relative;
  307. img {
  308. width: 24px;
  309. position: absolute;
  310. right: 19px;
  311. top: 7px;
  312. cursor: pointer;
  313. }
  314. }
  315. .main {
  316. background: #f6f6f6;
  317. padding-bottom: 50px;
  318. .ClassifyList {
  319. // margin-top: 50px;
  320. }
  321. }
  322. }
  323. </style>
  324. <style lang="scss">
  325. .seek {
  326. .el-input__prefix {
  327. color: black;
  328. }
  329. }
  330. .nav_title {
  331. .el-menu--horizontal > .el-menu-item {
  332. height: 64px;
  333. line-height: 64px;
  334. }
  335. .el-menu--horizontal > .el-menu-item.is-active {
  336. font-weight: 600;
  337. }
  338. }
  339. </style>