index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div class="lear_center" v-if="isData">
  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. maxlength="200"
  29. >
  30. </el-input>
  31. <img
  32. @click="gotoSeekResult"
  33. src="../../assets/learncenter/Group2149.png"
  34. alt=""
  35. :class="[language_type == 'AR' ? 'languageAR' : '']"
  36. />
  37. </div>
  38. </div>
  39. </div>
  40. <!-- 主要信息列表 -->
  41. <div class="main" v-loading="loading">
  42. <!-- 轮播图 -->
  43. <!-- <div class="carouSel">
  44. <el-carousel height="360px">
  45. <el-carousel-item v-for="(item, i) in ImageList" :key="i">
  46. <el-image lazy :src="item.picture_url" alt=""> </el-image>
  47. </el-carousel-item>
  48. </el-carousel>
  49. </div> -->
  50. <div class="ClassifyList" v-if="isData">
  51. <div id="COURSE">
  52. <Course :classList="courseList" />
  53. </div>
  54. <div id="TEXTBOOK">
  55. <Textbook :classList="TextbookList" />
  56. </div>
  57. <!-- <div id="LEARNRESOURCE">
  58. <Learnresource :classList="LearnResourceList" />
  59. </div> -->
  60. <!-- <div id="LIVE LESSON">
  61. <Live :classList="classList" />
  62. </div>
  63. <div id="VIDEO COURSE">
  64. <VideoCourse :classList="classList" />
  65. </div> -->
  66. </div>
  67. </div>
  68. </div>
  69. </template>
  70. <script>
  71. import { mapGetters } from 'vuex'
  72. import Header from '@/components/Header'
  73. import Course from '@/components/learnCenter/Course'
  74. import Textbook from '@/components/learnCenter/Textbook'
  75. import Learnresource from '@/components/learnCenter/Learnresource'
  76. import Live from '@/components/learnCenter/Live'
  77. import VideoCourse from '@/components/learnCenter/VideoCourse'
  78. import Cookies from 'js-cookie'
  79. import { cousrseAPI, TextbookAPI } from '@/api/api'
  80. import { updateWordPack } from '@/utils/i18n'
  81. export default {
  82. name: 'lear_center',
  83. components: {
  84. Header,
  85. Course,
  86. Textbook,
  87. Learnresource,
  88. Live,
  89. VideoCourse,
  90. },
  91. data() {
  92. return {
  93. isData: false,
  94. seekContent: '', //搜索内容
  95. activeIndex: 'COURSE', //默认展示精品课程
  96. navName: 'COURSE',
  97. buy: false,
  98. classList: [],
  99. disSeekShow: false,
  100. loading: false,
  101. ImageList: [
  102. {
  103. url: '../../assets/learncenter/Rectangle 1048.png',
  104. name: 'Rectangle 1048',
  105. },
  106. {
  107. url: '../../assets/learncenter/Rectangle 1049.png',
  108. name: 'Rectangle 1049',
  109. },
  110. {
  111. url: '../../assets/learncenter/Rectangle 1051.png',
  112. name: 'Rectangle 1051',
  113. },
  114. {
  115. url: '../../assets/learncenter/Rectangle 1052.png',
  116. name: 'Rectangle 1052',
  117. },
  118. ], //轮播图列表 测试
  119. courseList: null, //课程列表
  120. TextbookList: null, //教材列表
  121. LearnResourceList: null, //学习资源
  122. SeekName: '',
  123. }
  124. },
  125. computed: {
  126. ...mapGetters(['language_type']),
  127. },
  128. methods: {
  129. // 切换导航
  130. handleSelect(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.courseList.forEach((item, index) => {
  179. item.teacherName = item.teacher_name_desc.replace(/;/g, " ");
  180. })
  181. this.ImageList = res.course_list.slice(0, 4)
  182. })
  183. .catch(() => {
  184. this.loading = false
  185. })
  186. // 获取教材列表
  187. TextbookAPI('book-book_manager-PageQueryBookList', {
  188. page_capacity: 10,
  189. cur_page: 1,
  190. publish_status: 1,
  191. is_control_publish_scope: 'true',
  192. })
  193. .then((res) => {
  194. this.TextbookList = res.book_list
  195. this.loading = false
  196. })
  197. .catch(() => {
  198. this.loading = false
  199. })
  200. await updateWordPack({
  201. word_key_list: [
  202. 'Key8',
  203. 'Key38',
  204. 'Key39',
  205. 'Key44',
  206. 'Key46',
  207. 'Key47',
  208. 'Key147',
  209. 'Key215',
  210. 'Key323',
  211. 'Key573',
  212. ],
  213. })
  214. this.isData = true
  215. },
  216. }
  217. </script>
  218. <style lang="scss" scoped>
  219. .lear_center {
  220. min-height: 100vh;
  221. background: #f6f6f6;
  222. .nav_title {
  223. background: #fff;
  224. .inner {
  225. width: 1200px;
  226. margin: 0 auto;
  227. height: 64px;
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. }
  232. .el-menu-item {
  233. font-size: 16px;
  234. }
  235. // 取消组件默认的样式
  236. .el-menu.el-menu--horizontal {
  237. border-bottom: none;
  238. }
  239. }
  240. .carouSel {
  241. width: 1200px;
  242. height: 316px;
  243. margin: 0 auto;
  244. padding-top: 24px;
  245. .el-image {
  246. width: 100%;
  247. height: 100%;
  248. }
  249. img {
  250. width: 100%;
  251. height: 100%;
  252. }
  253. // .el-carousel__item:nth-child(2n) {
  254. // background-color: #99a9bf;
  255. // }
  256. // .el-carousel__item:nth-child(2n + 1) {
  257. // background-color: #d3dce6;
  258. // }
  259. }
  260. .seek {
  261. position: relative;
  262. img {
  263. width: 24px;
  264. position: absolute;
  265. right: 19px;
  266. top: 7px;
  267. cursor: pointer;
  268. &.languageAR {
  269. left: 19px;
  270. right: auto;
  271. }
  272. }
  273. }
  274. .main {
  275. background: #f6f6f6;
  276. padding-bottom: 50px;
  277. .ClassifyList {
  278. // margin-top: 50px;
  279. }
  280. }
  281. }
  282. </style>
  283. <style lang="scss">
  284. .seek {
  285. .el-input__prefix {
  286. color: black;
  287. }
  288. }
  289. .nav_title {
  290. .el-menu--horizontal > .el-menu-item {
  291. height: 64px;
  292. line-height: 64px;
  293. }
  294. .el-menu--horizontal > .el-menu-item.is-active {
  295. font-weight: 600;
  296. }
  297. }
  298. </style>