index.vue 6.5 KB

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