index.vue 17 KB

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