index.vue 7.3 KB

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