index.vue 7.7 KB

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