index.vue 6.3 KB

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