index.vue 17 KB

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