index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. <template>
  2. <div v-if="isData" class="teacher_edu">
  3. <!-- 头部导航及搜索 -->
  4. <HeaderPage />
  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. text-color="#000"
  12. active-text-color="#FF9900"
  13. @select="handleSelect"
  14. >
  15. <!-- <el-menu-item index="TEACHINGTOOL"> 教研工具</el-menu-item> -->
  16. <el-menu-item index="TEXTBOOK"> <!-- 教辅资料 -->{{ $t('Key554') }} </el-menu-item>
  17. <el-menu-item index="TEACHING"> <!-- 教研资料 -->{{ $t('Key214') }} </el-menu-item>
  18. <el-menu-item index="TOOLBOOK"> <!-- 工具书 -->{{ $t('Key555') }} </el-menu-item>
  19. </el-menu>
  20. <div class="seek" @keyup="keyDownSeekData">
  21. <!-- 搜索课程 -->
  22. <el-input
  23. id=""
  24. v-model="SeekName"
  25. type="text"
  26. name=""
  27. :placeholder="$t('Key131')"
  28. maxlength="50"
  29. @change="SeekName = SeekName.trim()"
  30. />
  31. <img src="../../assets/teacherdev/Group2149.png" alt="" @click="gotoSeekResult" />
  32. </div>
  33. </div>
  34. </div>
  35. <!-- 主要信息列表 -->
  36. <div v-loading="loading" class="main">
  37. <div id="TEACHINGTOOL">
  38. <TeachingTool v-if="textAnalyseShow" />
  39. </div>
  40. <div v-if="textBookList" id="TEXTBOOK">
  41. <Textbook v-if="textBookList.material_list" :class-list="textBookList.material_list" />
  42. </div>
  43. <div v-if="teachingList" id="TEACHING">
  44. <Teaching v-if="teachingList.material_list" :class-list="teachingList.material_list" />
  45. </div>
  46. <div v-if="toolBookList" id="TOOLBOOK">
  47. <ToolBook v-if="toolBookList.material_list" :class-list="toolBookList.material_list" />
  48. </div>
  49. </div>
  50. </div>
  51. </template>
  52. <script>
  53. import HeaderPage from '@/components/Header';
  54. import Textbook from '@/components/teacher-dev/Textbook';
  55. import Teaching from '@/components/teacher-dev/Teaching';
  56. import ToolBook from '@/components/teacher-dev/ToolBook';
  57. import TeachingTool from '@/components/teacher-dev/TeachingTool';
  58. import { materiallistAll } from '@/api/api';
  59. import { updateWordPack } from '@/utils/i18n';
  60. export default {
  61. name: 'TeacherEdu',
  62. components: {
  63. HeaderPage,
  64. Teaching,
  65. Textbook,
  66. ToolBook,
  67. TeachingTool,
  68. },
  69. data() {
  70. return {
  71. activeIndex: 'TEXTBOOK',
  72. navName: 'CLASSICAL COURSE',
  73. SeekName: '',
  74. loading: false,
  75. dataList: null,
  76. textBookList: null, // book数据
  77. teachingList: null, // tea数据
  78. toolBookList: null, // 工具书
  79. isData: false,
  80. textAnalyseShow: true,
  81. };
  82. },
  83. computed: {},
  84. async created() {
  85. console.log('2024.01.11');
  86. // 如果是edu.blcup.com环境下就隐藏文本分析入口
  87. if (document.domain === 'edu.blcup.com') {
  88. this.textAnalyseShow = false;
  89. }
  90. await updateWordPack({
  91. word_key_list: ['Key5', 'Key8', 'Key9', 'Key39', 'Key47', 'Key131', 'Key214', 'Key214', 'Key554', 'Key555'],
  92. });
  93. this.isData = true;
  94. // 需要根据身份信息来判断是进入首页还是录入
  95. // if (token) {
  96. // if (JSON.parse(token).popedom_code_list.indexOf(2000006) != -1) {
  97. // this.$router.push("/teacherdevEntering");
  98. // } else {
  99. // this.$router.push({ path: "/" });
  100. // }
  101. // }
  102. // this.loading = true;
  103. // // 验证登录拿到JSESSIONID放到cookies中后面的接口用来验证用户身份
  104. // VerifyLogin()
  105. // .then((res) => {
  106. // if (res.data?.JSESSSIONID) {
  107. // Cookies.set("JSESSIONID", res.data.JSESSSIONID);
  108. //
  109. // }
  110. // })
  111. // .catch((res) => {
  112. // this.loading = false;
  113. // });
  114. },
  115. mounted() {
  116. this.getData();
  117. window.addEventListener('scroll', () => {
  118. let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  119. // 滚动条滚动的距离
  120. let node = document.getElementsByClassName('nav_title')[0];
  121. if (node && node.classList) {
  122. if (scrollTop > 120) {
  123. node.classList.add('xiding_nav');
  124. } else {
  125. node.classList.remove('xiding_nav');
  126. }
  127. }
  128. });
  129. },
  130. methods: {
  131. // 切换导航
  132. handleSelect(key, keyPath) {
  133. console.log(key, keyPath);
  134. this.navName = key;
  135. this.changeNav(key);
  136. },
  137. // 锚点定位
  138. changeNav(index) {
  139. let id = index;
  140. let dom = document.getElementById(id);
  141. if (dom) {
  142. document.getElementById(id).scrollIntoView();
  143. }
  144. },
  145. // 前往搜索结果
  146. gotoSeekResult() {
  147. if (this.SeekName === '') {
  148. this.$message.warning('请输入内容');
  149. } else {
  150. this.SeekName = this.SeekName.trim();
  151. this.$router.push({
  152. path: '/Viewmore',
  153. query: { keyWord: this.SeekName },
  154. });
  155. }
  156. },
  157. keyDownSeekData(e) {
  158. if (e.keyCode === 13) {
  159. this.gotoSeekResult();
  160. }
  161. },
  162. // 获取数据
  163. getData() {
  164. this.loading = true;
  165. materiallistAll({
  166. cur_page: 1,
  167. page_capacity: 10,
  168. tag: 'TEXTBOOK',
  169. name: this.keyWord,
  170. })
  171. .then((res) => {
  172. this.textBookList = res;
  173. })
  174. .finally(() => {
  175. this.loading = false;
  176. });
  177. materiallistAll({
  178. cur_page: 1,
  179. page_capacity: 10,
  180. tag: 'TEACHING',
  181. name: this.keyWord,
  182. })
  183. .then((res) => {
  184. this.teachingList = res;
  185. })
  186. .finally(() => {
  187. this.loading = false;
  188. });
  189. materiallistAll({
  190. cur_page: 1,
  191. page_capacity: 10,
  192. tag: 'TOOLBOOK',
  193. name: this.keyWord,
  194. })
  195. .then((res) => {
  196. this.toolBookList = res;
  197. })
  198. .finally(() => {
  199. this.loading = false;
  200. });
  201. },
  202. },
  203. };
  204. </script>
  205. <style lang="scss" scoped>
  206. .teacher_edu {
  207. min-height: 100vh;
  208. // background: #f6f6f6;
  209. .seek {
  210. box-sizing: border-box;
  211. display: flex;
  212. align-items: center;
  213. justify-content: space-between;
  214. width: 300px;
  215. height: 40px;
  216. padding: 0 16px;
  217. background: #fff;
  218. border: 1px solid #d9d9d9;
  219. border-radius: 8px;
  220. input {
  221. width: 90%;
  222. margin-left: 5px;
  223. border: none;
  224. outline: none;
  225. }
  226. img {
  227. width: 18px;
  228. height: 18px;
  229. cursor: pointer;
  230. }
  231. }
  232. .nav_title {
  233. width: 100%;
  234. background: #fff;
  235. .inner {
  236. display: flex;
  237. align-items: center;
  238. justify-content: space-between;
  239. width: 1200px;
  240. margin: 0 auto;
  241. }
  242. .el-menu-item {
  243. font-size: 16px;
  244. }
  245. // 取消组件默认的样式
  246. .el-menu.el-menu--horizontal {
  247. border-bottom: none;
  248. }
  249. }
  250. .xiding_nav {
  251. position: fixed;
  252. top: 0;
  253. z-index: 999;
  254. }
  255. .main {
  256. min-height: 80vh;
  257. padding-bottom: 50px;
  258. background: #f6f6f6;
  259. }
  260. }
  261. </style>
  262. <style lang="scss">
  263. .seek {
  264. .el-input__prefix {
  265. color: black;
  266. }
  267. .el-input__inner {
  268. height: 38px;
  269. padding: 0;
  270. border: none;
  271. }
  272. }
  273. .nav_title {
  274. .el-menu--horizontal > .el-menu-item {
  275. height: 64px;
  276. line-height: 64px;
  277. }
  278. .el-menu--horizontal > .el-menu-item.is-active {
  279. font-weight: bold !important;
  280. }
  281. }
  282. </style>