index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. <template>
  2. <div class="index">
  3. <div class="shadow" v-if="LoginOrRegistration != 'signin'">
  4. <LoginNav
  5. :changeLoginReg="changeLoginReg"
  6. :FatheruserMessage="userMessage"
  7. :language_list="language_list"
  8. />
  9. <!-- <LayoutHeader /> -->
  10. <div class="logoAndlogin">
  11. <div class="LogoAndText">
  12. <div class="logo">logo</div>
  13. <div class="text">
  14. <p class="p1">欢迎来到全球汉语教学平台</p>
  15. <p class="p2">
  16. 这里有丰富的教学资源、先进的教学方法,无论您是教师或学生都能在这里尽情汲取养分!
  17. </p>
  18. </div>
  19. </div>
  20. <div class="login" v-if="LoginOrRegistration == 'login'">
  21. <Login
  22. :changeLoginReg="changeLoginReg"
  23. :changeLoginType="changeLoginType"
  24. />
  25. </div>
  26. <div
  27. v-if="LoginOrRegistration == 'Forget password'"
  28. class="ForgetPassword"
  29. >
  30. <ForgetPassword
  31. :changeLoginReg="changeLoginReg"
  32. :ForgetType.sync="loginType"
  33. />
  34. </div>
  35. <div class="list" v-if="!LoginOrRegistration">
  36. <div
  37. :class="projectIndex == item.id ? 'Selectproject' : ''"
  38. @mousemove="projectMove(item)"
  39. @mouseout="projectOut"
  40. v-for="(item, i) in projectList"
  41. :key="i"
  42. @click="SelectProject(i)"
  43. >
  44. <div>
  45. <img
  46. v-if="projectIndex == item.id"
  47. :src="require('../../assets/login/' + item.selectImg + '.png')"
  48. alt=""
  49. />
  50. <img
  51. v-else
  52. :src="require('../../assets/login/' + item.img + '.png')"
  53. alt=""
  54. />
  55. <p>{{ item.name }}</p>
  56. </div>
  57. <p>{{ item.text }}</p>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="bottom" v-if="LoginOrRegistration != 'signin'">
  62. <div>
  63. <span> About us </span>
  64. <span>
  65. <span style="margin-right: 16px"> Office: </span>
  66. hzmd@160.com
  67. </span>
  68. <span>
  69. <span style="margin-right: 16px"> Tell: </span>
  70. 800-820-8820</span
  71. >
  72. <span>
  73. <span style="margin-right: 16px"> Site: </span>
  74. 123 walton gorgla street town hall,beijing.CH</span
  75. >
  76. </div>
  77. <div>
  78. <span style="font-weight: bold"> Copyright </span>
  79. © 2010-2021 HugeMind All rights reserved.
  80. </div>
  81. </div>
  82. </div>
  83. <!-- <div v-if="LoginOrRegistration == 'signin'" class="signin">
  84. <LoginNav2
  85. :changeLoginReg="changeLoginReg"
  86. :language_list="language_list"
  87. />
  88. <Registration :changeLoginReg="changeLoginReg" />
  89. </div> -->
  90. </div>
  91. </template>
  92. <script>
  93. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  94. //例如:import 《组件名称》from ‘《组件路径》';
  95. import Login from "@/components/login/login";
  96. import Registration from "@/components/login/registration";
  97. import LoginNav2 from "@/components/login/LoginNav2";
  98. import ForgetPassword from "@/components/login/ForgetPassword";
  99. import LoginNav from "@/components/login/LoginNav";
  100. import Cookies from "js-cookie";
  101. import { getLogin, getContent, getAcsCode, getStaticContent } from "@/api/api";
  102. import LayoutHeader from "@/components/login/LayoutHeader";
  103. import { updateWordPack } from "@/utils/i18n";
  104. import { getToken, removeToken } from "@/utils/auth";
  105. export default {
  106. //import引入的组件需要注入到对象中才能使用
  107. components: {
  108. Login,
  109. Registration,
  110. ForgetPassword,
  111. LoginNav,
  112. LoginNav2,
  113. LayoutHeader,
  114. },
  115. props: {},
  116. data() {
  117. //这里存放数据
  118. return {
  119. LoginOrRegistration: "login", //注册 登录 忘记密码
  120. loginType: "teacher",
  121. projectList: [
  122. {
  123. id: 0,
  124. name: "教学中心",
  125. img: "project1-1",
  126. selectImg: "project1-1-1",
  127. text: "帮助您快速完成课程及任务安排,快速清晰的完成学习任务。",
  128. },
  129. {
  130. id: 1,
  131. name: "教材管理系统",
  132. img: "project8-8",
  133. selectImg: "project1-1-1",
  134. text: "帮您快速定制生动、有趣、实用的数字教材。",
  135. },
  136. {
  137. id: 2,
  138. name: "教培中心",
  139. img: "project2-2-2",
  140. selectImg: "project2-2",
  141. text: "名师授课,丰富的课程体系,快速扎实帮您提升教学能力。",
  142. },
  143. {
  144. id: 3,
  145. name: "教研中心",
  146. img: "project6-6-6",
  147. selectImg: "project6-6",
  148. text: "丰富的教学资料和珍贵的文献可以在线查看或下载。",
  149. },
  150. // 丰富的题库将帮助您快速编写实用、准确、全面的试卷。
  151. {
  152. id: 4,
  153. name: "考试中心",
  154. img: "project5-5-5",
  155. selectImg: "project5-5",
  156. text: "丰富的教学资料和珍贵的文献可以在线查看或下载。",
  157. },
  158. {
  159. id: 5,
  160. name: "学习中心",
  161. img: "project4-4-4",
  162. selectImg: "project4-4",
  163. text: "在这里可以很容易地找到数字教科书、学习材料和丰富的课程。",
  164. },
  165. {
  166. id: 6,
  167. // Teacher training center
  168. name: "个人中心",
  169. img: "project3-3-3",
  170. selectImg: "project3-3",
  171. text: "您收集和购买的所有资源都可以在这里轻松找到。",
  172. },
  173. ],
  174. teacherProList: [
  175. //普通教师
  176. {
  177. id: 0,
  178. name: "教学中心",
  179. img: "project1-1",
  180. selectImg: "project1-1-1",
  181. text: "帮助您快速完成课程及任务安排,快速清晰的完成学习任务。",
  182. },
  183. {
  184. id: 2,
  185. name: "教培中心",
  186. img: "project2-2-2",
  187. selectImg: "project2-2",
  188. text: "名师授课,丰富的课程体系,快速扎实帮您提升教学能力。",
  189. },
  190. {
  191. id: 3,
  192. name: "教研中心",
  193. img: "project6-6-6",
  194. selectImg: "project6-6",
  195. text: "丰富的教学资料和珍贵的文献可以在线查看或下载。",
  196. },
  197. {
  198. id: 5,
  199. name: "学习中心",
  200. img: "project4-4-4",
  201. selectImg: "project4-4",
  202. text: "在这里可以很容易地找到数字教科书、学习材料和丰富的课程。",
  203. },
  204. {
  205. id: 6,
  206. // Teacher training center
  207. name: "个人中心",
  208. img: "project3-3-3",
  209. selectImg: "project3-3",
  210. text: "您收集和购买的所有资源都可以在这里轻松找到。",
  211. },
  212. ],
  213. stuProList: [
  214. {
  215. id: 0,
  216. name: "教学中心",
  217. // name: this.$t("teaching"),
  218. img: "project1-1-1",
  219. selectImg: "project1-1",
  220. text: "帮助您快速完成课程及任务安排,快速清晰的完成学习任务。",
  221. },
  222. {
  223. id: 5,
  224. name: "学习中心",
  225. img: "project4-4-4",
  226. selectImg: "project4-4",
  227. text: "在这里可以很容易地找到数字教科书、学习材料和丰富的课程。",
  228. },
  229. {
  230. id: 6,
  231. // Teacher training center
  232. name: "个人中心",
  233. img: "project3-3-3",
  234. selectImg: "project3-3",
  235. text: "您收集和购买的所有资源都可以在这里轻松找到。",
  236. },
  237. ],
  238. projectIndex: null,
  239. userMessage: null,
  240. language_list: null,
  241. };
  242. },
  243. //计算属性 类似于data概念
  244. computed: {},
  245. //监控data中数据变化
  246. watch: {},
  247. //方法集合
  248. methods: {
  249. changeLoginReg(value, userMessage) {
  250. if (value == "signin") {
  251. this.$router.push("/Signup");
  252. } else {
  253. this.LoginOrRegistration = value;
  254. }
  255. this.userMessage = userMessage ? userMessage : null;
  256. if (this.userMessage) {
  257. let _this = this;
  258. let popedom_code_list = _this.userMessage.popedom_code_list;
  259. if (_this.userMessage.user_type == "TEACHER") {
  260. _this.projectList = _this.handleProList(popedom_code_list);
  261. } else if (_this.userMessage.user_type == "STUDENT") {
  262. _this.projectList = _this.stuProList;
  263. }
  264. _this.projectList.forEach((item, index) => {
  265. if (item.id == 4) {
  266. _this.LoginNavIndex = index;
  267. }
  268. });
  269. } else {
  270. this.projectList = this.teacherProList;
  271. }
  272. },
  273. changeLoginType(value) {
  274. this.loginType = value;
  275. },
  276. // 鼠标进入
  277. projectMove(item) {
  278. this.projectIndex = item.id;
  279. },
  280. // 鼠标离开
  281. projectOut() {
  282. this.projectIndex = null;
  283. },
  284. async SelectProject(command) {
  285. let _this = this;
  286. _this.LoginNavIndex = command;
  287. let userInfor = getToken();
  288. let user_code = "",
  289. user_type = "",
  290. session_id = "";
  291. if (userInfor) {
  292. userInfor = JSON.parse(getToken());
  293. user_code = userInfor.user_code;
  294. user_type = userInfor.user_type;
  295. session_id = userInfor.session_id;
  296. }
  297. if (!session_id || !user_code || !user_type || !userInfor) {
  298. this.$message.warning("请先登录");
  299. this.projectName = this.projectList[0].name;
  300. // window.location.href = "/";
  301. return;
  302. }
  303. let acsCode = null;
  304. let MethodName = "login_control-CreateAccessCode";
  305. getContent(MethodName, user_code, user_type, session_id).then((res) => {
  306. acsCode = res.access_code;
  307. _this.projectName = this.projectList[command].name;
  308. let id = this.projectList[command].id;
  309. if (id == 0) {
  310. // 教学管理系统
  311. location.href = `/GCLS-Learn/#/EnterSys?AccessCode=${acsCode}`;
  312. } else if (id == 1) {
  313. // 教材管理系统
  314. location.href = `/GCLS-Book/#/EnterSys?AccessCode=${acsCode}`;
  315. } else if (id == 2) {
  316. // 教培中心
  317. location.href = `/GCLS-TRC/#/EnterSys?AccessCode=${acsCode}`;
  318. } else if (id == 3) {
  319. // 教研中心
  320. location.href = `/GCLS-TC/#/EnterSys?AccessCode=${acsCode}`;
  321. } else if (id == 4) {
  322. // 考试中心
  323. location.href = `/GCLS-Test/#/EnterSys?AccessCode=${acsCode}`;
  324. } else if (id == 5) {
  325. // 学习中心
  326. location.href = `/GCLS-LC/#/EnterSys?AccessCode=${acsCode}`;
  327. } else {
  328. // 个人中心
  329. location.href = `/GCLS-Personal/#/EnterSys?AccessCode=${acsCode}`;
  330. }
  331. });
  332. },
  333. // 获取语言列表
  334. getLangList() {
  335. let MethodName = "language_manager-GetLanguageList";
  336. let data = {};
  337. getStaticContent(MethodName, data).then((res) => {
  338. this.language_list = res.language_list;
  339. });
  340. },
  341. // 验证用户是否登录
  342. Islogin() {
  343. let userInfor = getToken();
  344. let user_code = "",
  345. user_type = "",
  346. session_id = "";
  347. if (userInfor) {
  348. userInfor = JSON.parse(getToken());
  349. user_code = userInfor.user_code;
  350. user_type = userInfor.user_type;
  351. session_id = userInfor.session_id;
  352. }
  353. let MethodName = "login_control-Is_Effective_User";
  354. getAcsCode(MethodName, {
  355. UserCode: user_code,
  356. SessionID: session_id,
  357. UserType: user_type,
  358. }).then((res) => {
  359. if (res.is_effective == "false") {
  360. this.userMessage = null;
  361. } else {
  362. let userMessage = getToken();
  363. if (userMessage) {
  364. userMessage = JSON.parse(userMessage);
  365. this.changeLoginReg("", userMessage);
  366. }
  367. }
  368. });
  369. },
  370. handleProList(list) {
  371. console.log(list);
  372. let projectList = [];
  373. if (list.length == 0) {
  374. let arr = [
  375. {
  376. id: 2,
  377. name: "教培中心",
  378. img: "project2-2-2",
  379. selectImg: "project2-2",
  380. text: "名师授课,丰富的课程体系,快速扎实帮您提升教学能力。",
  381. },
  382. {
  383. id: 3,
  384. name: "教研中心",
  385. img: "project6-6-6",
  386. selectImg: "project6-6",
  387. text: "丰富的教学资料和珍贵的文献可以在线查看或下载。",
  388. },
  389. {
  390. id: 5,
  391. name: "学习中心",
  392. img: "project4-4-4",
  393. selectImg: "project4-4",
  394. text: "在这里可以很容易地找到数字教科书、学习材料和丰富的课程。",
  395. },
  396. {
  397. id: 6,
  398. // Teacher training center
  399. name: "个人中心",
  400. img: "project3-3-3",
  401. selectImg: "project3-3",
  402. text: "您收集和购买的所有资源都可以在这里轻松找到。",
  403. },
  404. ];
  405. projectList = arr;
  406. } else if (list.includes(2000001)) {
  407. projectList = JSON.parse(JSON.stringify(this.teacherProList));
  408. for (let i = 0; i < list.length; i++) {
  409. let code = list[i];
  410. if (code == 2000003) {
  411. projectList.push({
  412. id: 1,
  413. name: "教材管理系统",
  414. img: "project8-8",
  415. selectImg: "project8-8-8",
  416. text: "帮您快速定制生动、有趣、实用的数字教材。",
  417. });
  418. }
  419. if (code === 2000005) {
  420. projectList.push({
  421. id: 4,
  422. name: "考试中心",
  423. img: "project5-5-5",
  424. selectImg: "project5-5",
  425. text: "丰富的题库将帮助您快速编写实用、准确、全面的试卷。",
  426. });
  427. }
  428. }
  429. } else {
  430. for (let i = 0; i < list.length; i++) {
  431. let code = list[i];
  432. if (code == 2000002) {
  433. projectList.push({
  434. id: 0,
  435. name: "教学中心",
  436. img: "project1-1",
  437. selectImg: "project1-1-1",
  438. text: "帮助您快速完成课程及任务安排,快速清晰的完成学习任务。",
  439. });
  440. } else if (code == 2000003) {
  441. projectList.push({
  442. id: 1,
  443. name: "教材管理系统",
  444. img: "project8-8",
  445. selectImg: "project8-8-8",
  446. text: "帮您快速定制生动、有趣、实用的数字教材。",
  447. });
  448. } else if (code == 2000004) {
  449. projectList.push({
  450. id: 2,
  451. name: "教师培训中心",
  452. img: "project2-2-2",
  453. selectImg: "project2-2",
  454. text: "名师授课,丰富的课程体系,快速扎实帮您提升教学能力。",
  455. });
  456. } else if (code == 2000005) {
  457. projectList.push({
  458. id: 4,
  459. name: "考试中心",
  460. img: "project5-5-5",
  461. selectImg: "project5-5",
  462. text: "丰富的题库将帮助您快速编写实用、准确、全面的试卷。",
  463. });
  464. } else if (code == 2000006) {
  465. projectList.push({
  466. id: 3,
  467. name: "教研中心",
  468. img: "project4-4-4",
  469. selectImg: "project4-4",
  470. text: "丰富的教学资料和珍贵的文献可以在线查看或下载。",
  471. });
  472. }
  473. }
  474. projectList.push({
  475. id: 6,
  476. // Teacher training center
  477. name: "个人中心",
  478. img: "project3-3-3",
  479. selectImg: "project3-3",
  480. text: "您收集和购买的所有资源都可以在这里轻松找到。",
  481. });
  482. }
  483. // 排序
  484. for (var i = 0; i < projectList.length - 1; i++) {
  485. for (var j = 0; j < projectList.length - 1 - i; j++) {
  486. // 相邻元素两两对比,元素交换,大的元素交换到后面
  487. if (projectList[j].id > projectList[j + 1].id) {
  488. var temp = projectList[j];
  489. projectList[j] = projectList[j + 1];
  490. projectList[j + 1] = temp;
  491. }
  492. }
  493. }
  494. console.log(projectList);
  495. return projectList;
  496. },
  497. browserRedirect() {
  498. var sUserAgent = navigator.userAgent.toLowerCase();
  499. var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
  500. var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
  501. var bIsMidp = sUserAgent.match(/midp/i) == "midp";
  502. var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
  503. var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
  504. var bIsAndroid = sUserAgent.match(/android/i) == "android";
  505. var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
  506. var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
  507. if (
  508. bIsIpad ||
  509. bIsIphoneOs ||
  510. bIsMidp ||
  511. bIsUc7 ||
  512. bIsUc ||
  513. bIsAndroid ||
  514. bIsCE ||
  515. bIsWM
  516. ) {
  517. // window.location.href = "手机站链接";
  518. console.log("移动端");
  519. } else {
  520. // window.location = "PC站链接";
  521. console.log("PC端");
  522. }
  523. },
  524. },
  525. //生命周期 - 创建完成(可以访问当前this实例)
  526. created() {
  527. this.getLangList();
  528. this.Islogin();
  529. updateWordPack({
  530. word_key_list: ["teaching", "teaching"],
  531. });
  532. let type = this.$route.query.type;
  533. if (type) {
  534. if (type == "login") {
  535. this.LoginOrRegistration = "login";
  536. }
  537. }
  538. this.browserRedirect();
  539. },
  540. //生命周期 - 挂载完成(可以访问DOM元素)
  541. mounted() {},
  542. //生命周期-创建之前
  543. beforeCreated() {},
  544. //生命周期-挂载之前
  545. beforeMount() {},
  546. //生命周期-更新之前
  547. beforUpdate() {},
  548. //生命周期-更新之后
  549. updated() {},
  550. //生命周期-销毁之前
  551. beforeDestory() {},
  552. //生命周期-销毁完成
  553. destoryed() {},
  554. //如果页面有keep-alive缓存功能,这个函数会触发
  555. activated() {},
  556. };
  557. </script>
  558. <style lang="scss" scoped>
  559. .index {
  560. margin: 0;
  561. padding: 0;
  562. min-height: 100vh;
  563. background: url("../../assets/login/indexBG.png") no-repeat;
  564. background-size: cover;
  565. font-family: "sourceR";
  566. position: relative;
  567. .shadow {
  568. min-height: 100vh;
  569. height: 100%;
  570. background: rgba(0, 0, 0, 0.3);
  571. .logoAndlogin {
  572. width: 1248px;
  573. margin: 0 auto;
  574. position: relative;
  575. // display: flex;
  576. .login {
  577. position: absolute;
  578. top: 0;
  579. right: 30px;
  580. z-index: 1;
  581. }
  582. .ForgetPassword {
  583. position: absolute;
  584. top: 0;
  585. right: 100px;
  586. }
  587. }
  588. .LogoAndText {
  589. // width: 700px;
  590. margin-top: 58px;
  591. margin-left: 30px;
  592. display: flex;
  593. .logo {
  594. width: 136px;
  595. height: 136px;
  596. background: #c4c4c4;
  597. border-radius: 25px;
  598. color: black;
  599. text-align: center;
  600. line-height: 136px;
  601. }
  602. .text {
  603. margin-left: 40px;
  604. color: white;
  605. p {
  606. width: 700px;
  607. margin: 0;
  608. }
  609. .p1 {
  610. font-weight: 600;
  611. font-size: 40px;
  612. }
  613. .p2 {
  614. margin-top: 32px;
  615. font-size: 20px;
  616. line-height: 30px;
  617. }
  618. }
  619. }
  620. }
  621. .bottom {
  622. position: absolute;
  623. bottom: -154px;
  624. width: 100%;
  625. background: #2c2c2c;
  626. height: 154px;
  627. padding-top: 40px;
  628. > div {
  629. text-align: center;
  630. font-size: 20px;
  631. color: rgb(180, 179, 179);
  632. > span {
  633. margin-left: 40px;
  634. }
  635. }
  636. > :first-child {
  637. // height: 80px;
  638. // line-height: 80px;
  639. margin-bottom: 24px;
  640. > :first-child {
  641. color: white;
  642. }
  643. > :first-child::before {
  644. content: "|";
  645. background: white;
  646. width: 6px;
  647. height: 20px;
  648. position: relative;
  649. right: 5px;
  650. }
  651. }
  652. }
  653. .signin {
  654. background: #e5e5e5;
  655. padding-bottom: 30px;
  656. }
  657. .list {
  658. width: 1248px;
  659. margin: 10px auto;
  660. display: flex;
  661. flex-wrap: wrap;
  662. > div {
  663. width: 368px;
  664. height: 161px;
  665. background: #ffffff;
  666. border-radius: 4px;
  667. // margin: 20px 50px 0 10px;
  668. margin: 10px 24px;
  669. cursor: pointer;
  670. > div {
  671. display: flex;
  672. justify-content: space-around;
  673. align-items: center;
  674. font-weight: bold;
  675. font-size: 20px;
  676. color: #2c2c2c;
  677. padding: 20px 0 0 20px;
  678. img {
  679. width: 56px;
  680. height: 60px;
  681. }
  682. p {
  683. width: 250px;
  684. }
  685. }
  686. > p {
  687. width: 304px;
  688. margin: 16px auto;
  689. font-size: 14px;
  690. color: #666666;
  691. opacity: 0.7;
  692. text-align: left;
  693. line-height: 20px;
  694. }
  695. }
  696. .Selectproject {
  697. background: #ff9900;
  698. box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.15);
  699. }
  700. }
  701. }
  702. </style>