index.vue 7.2 KB

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