index.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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" v-if="showMaterial"> <!-- 教辅资料 -->{{ $t('Key554') }} </el-menu-item>
  17. <el-menu-item index="TEACHING" v-if="showMaterial"> <!-- 教研资料 -->{{ $t('Key214') }} </el-menu-item>
  18. <el-menu-item index="TOOLBOOK" v-if="showMaterial"> <!-- 工具书 -->{{ $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 && showMaterial" id="TEXTBOOK">
  41. <Textbook v-if="textBookList.material_list" :class-list="textBookList.material_list" />
  42. </div>
  43. <div v-if="teachingList && showMaterial" id="TEACHING">
  44. <Teaching v-if="teachingList.material_list" :class-list="teachingList.material_list" />
  45. </div>
  46. <div v-if="toolBookList && showMaterial" 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, getContentFile } 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. showMaterial: false, // 是否可以查看教辅材料等
  82. };
  83. },
  84. computed: {},
  85. async created() {
  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. let MethodName = 'login_control-IsCanEnterChildSys_PC';
  116. getContentFile(MethodName, {
  117. child_sys_key: 'GCLS-TC',
  118. })
  119. .then((res) => {
  120. if (res.status === 1) {
  121. this.showMaterial = res.is_can_enter_teaching_research_material === 'true';
  122. }
  123. })
  124. .catch((err) => {});
  125. },
  126. mounted() {
  127. this.getData();
  128. window.addEventListener('scroll', () => {
  129. let scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
  130. // 滚动条滚动的距离
  131. let node = document.getElementsByClassName('nav_title')[0];
  132. if (node && node.classList) {
  133. if (scrollTop > 120) {
  134. node.classList.add('xiding_nav');
  135. } else {
  136. node.classList.remove('xiding_nav');
  137. }
  138. }
  139. });
  140. },
  141. methods: {
  142. // 切换导航
  143. handleSelect(key, keyPath) {
  144. console.log(key, keyPath);
  145. this.navName = key;
  146. this.changeNav(key);
  147. },
  148. // 锚点定位
  149. changeNav(index) {
  150. let id = index;
  151. let dom = document.getElementById(id);
  152. if (dom) {
  153. document.getElementById(id).scrollIntoView();
  154. }
  155. },
  156. // 前往搜索结果
  157. gotoSeekResult() {
  158. if (this.SeekName === '') {
  159. this.$message.warning('请输入内容');
  160. } else {
  161. this.SeekName = this.SeekName.trim();
  162. this.$router.push({
  163. path: '/Viewmore',
  164. query: { keyWord: this.SeekName },
  165. });
  166. }
  167. },
  168. keyDownSeekData(e) {
  169. if (e.keyCode === 13) {
  170. this.gotoSeekResult();
  171. }
  172. },
  173. // 获取数据
  174. getData() {
  175. this.loading = true;
  176. materiallistAll({
  177. cur_page: 1,
  178. page_capacity: 10,
  179. tag: 'TEXTBOOK',
  180. name: this.keyWord,
  181. })
  182. .then((res) => {
  183. this.textBookList = res;
  184. })
  185. .finally(() => {
  186. this.loading = false;
  187. });
  188. materiallistAll({
  189. cur_page: 1,
  190. page_capacity: 10,
  191. tag: 'TEACHING',
  192. name: this.keyWord,
  193. })
  194. .then((res) => {
  195. this.teachingList = res;
  196. })
  197. .finally(() => {
  198. this.loading = false;
  199. });
  200. materiallistAll({
  201. cur_page: 1,
  202. page_capacity: 10,
  203. tag: 'TOOLBOOK',
  204. name: this.keyWord,
  205. })
  206. .then((res) => {
  207. this.toolBookList = res;
  208. })
  209. .finally(() => {
  210. this.loading = false;
  211. });
  212. },
  213. },
  214. };
  215. </script>
  216. <style lang="scss" scoped>
  217. .teacher_edu {
  218. min-height: 100vh;
  219. // background: #f6f6f6;
  220. .seek {
  221. box-sizing: border-box;
  222. display: flex;
  223. align-items: center;
  224. justify-content: space-between;
  225. width: 300px;
  226. height: 40px;
  227. padding: 0 16px;
  228. background: #fff;
  229. border: 1px solid #d9d9d9;
  230. border-radius: 8px;
  231. input {
  232. width: 90%;
  233. margin-left: 5px;
  234. border: none;
  235. outline: none;
  236. }
  237. img {
  238. width: 18px;
  239. height: 18px;
  240. cursor: pointer;
  241. }
  242. }
  243. .nav_title {
  244. width: 100%;
  245. background: #fff;
  246. height: 64px;
  247. .inner {
  248. display: flex;
  249. align-items: center;
  250. justify-content: space-between;
  251. width: 1200px;
  252. margin: 0 auto;
  253. height: 64px;
  254. }
  255. .el-menu-item {
  256. font-size: 16px;
  257. }
  258. // 取消组件默认的样式
  259. .el-menu.el-menu--horizontal {
  260. border-bottom: none;
  261. }
  262. }
  263. .xiding_nav {
  264. position: fixed;
  265. top: 0;
  266. z-index: 999;
  267. }
  268. .main {
  269. min-height: 80vh;
  270. padding-bottom: 50px;
  271. background: #f6f6f6;
  272. }
  273. }
  274. </style>
  275. <style lang="scss">
  276. .seek {
  277. .el-input__prefix {
  278. color: black;
  279. }
  280. .el-input__inner {
  281. height: 38px;
  282. padding: 0;
  283. border: none;
  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: bold !important;
  293. }
  294. }
  295. </style>