index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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. console.log("document.domain:" + document.domain);
  170. console.log("window.location.host:" + window.location.host);
  171. await updateWordPack({
  172. word_key_list: [
  173. "Key5",
  174. "Key8",
  175. "Key9",
  176. "Key39",
  177. "Key47",
  178. "Key131",
  179. "Key214",
  180. "Key214",
  181. "Key554",
  182. "Key555",
  183. ],
  184. });
  185. this.isData = true;
  186. // 需要根据身份信息来判断是进入首页还是录入
  187. // if (token) {
  188. // if (JSON.parse(token).popedom_code_list.indexOf(2000006) != -1) {
  189. // this.$router.push("/teacherdevEntering");
  190. // } else {
  191. // this.$router.push({ path: "/" });
  192. // }
  193. // }
  194. // this.loading = true;
  195. // // 验证登录拿到JSESSIONID放到cookies中后面的接口用来验证用户身份
  196. // VerifyLogin()
  197. // .then((res) => {
  198. // if (res.data?.JSESSSIONID) {
  199. // Cookies.set("JSESSIONID", res.data.JSESSSIONID);
  200. //
  201. // }
  202. // })
  203. // .catch((res) => {
  204. // this.loading = false;
  205. // });
  206. },
  207. mounted() {
  208. this.getData();
  209. },
  210. };
  211. </script>
  212. <style lang="scss" scoped>
  213. .teacher_edu {
  214. min-height: 100vh;
  215. // background: #f6f6f6;
  216. .seek {
  217. width: 300px;
  218. height: 40px;
  219. background: #ffffff;
  220. border: 1px solid #d9d9d9;
  221. box-sizing: border-box;
  222. border-radius: 8px;
  223. display: flex;
  224. align-items: center;
  225. justify-content: space-between;
  226. padding: 0 16px;
  227. input {
  228. width: 90%;
  229. border: none;
  230. outline: none;
  231. margin-left: 5px;
  232. }
  233. img {
  234. width: 18px;
  235. height: 18px;
  236. cursor: pointer;
  237. }
  238. }
  239. .nav_title {
  240. background: #fff;
  241. .inner {
  242. width: 1200px;
  243. margin: 0 auto;
  244. display: flex;
  245. justify-content: space-between;
  246. align-items: center;
  247. font-weight: 600;
  248. }
  249. .el-menu-item {
  250. font-size: 16px;
  251. }
  252. // 取消组件默认的样式
  253. .el-menu.el-menu--horizontal {
  254. border-bottom: none;
  255. }
  256. }
  257. .main {
  258. min-height: 80vh;
  259. background: #f6f6f6;
  260. padding-bottom: 50px;
  261. }
  262. }
  263. </style>
  264. <style lang="scss">
  265. .seek {
  266. .el-input__prefix {
  267. color: black;
  268. }
  269. .el-input__inner {
  270. border: none;
  271. height: 38px;
  272. padding: 0;
  273. }
  274. }
  275. </style>