bigDataLogin.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651
  1. <template>
  2. <div class="login-page scrollbar-box">
  3. <img class="logo-img" src="@/assets/ZDimages/login/logo.png">
  4. <div class="title-img-box">
  5. <div>
  6. <img class="title-img" src="@/assets/ZDimages/login/title_icon.png">
  7. <!--<p>v 2.0</p>-->
  8. </div>
  9. </div>
  10. <div class="form-box">
  11. <p class="form-title-p">登录</p>
  12. <el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
  13. <div class="username-input-box">
  14. <img src="@/assets/ZDimages/login/icon_dl_zh.png" alt="">
  15. <input type="text" v-model="loginForm.username" placeholder="请输入账号" maxlength="20" @keyup.enter="handleLogin">
  16. </div>
  17. <div class="password-input-box">
  18. <img src="@/assets/ZDimages/login/icon_dl_mm.png" alt="">
  19. <input type="password" v-model="loginForm.password" placeholder="请输入密码" maxlength="20" @keyup.enter="handleLogin">
  20. </div>
  21. <p class="text-p">{{text}}</p>
  22. <div class="code-input-box">
  23. <div class="code-input-left-box">
  24. <img src="@/assets/ZDimages/login/icon_dl_yzm.png" alt="">
  25. <input type="text" v-model="loginForm.code" placeholder="请输入验证码" maxlength="4" @keyup.enter="handleLogin">
  26. </div>
  27. <div class="login-code">
  28. <img :src="codeUrl" @click="getCode" class="login-code-img"/>
  29. </div>
  30. </div>
  31. <el-form-item>
  32. <el-button
  33. class="form-button-p"
  34. :loading="loading"
  35. size="medium"
  36. height="50"
  37. @click.native.prevent="handleLogin"
  38. >
  39. <span v-if="!loading">登 录</span>
  40. <span v-else>登 录 中...</span>
  41. </el-button>
  42. <div style="float: right;" v-if="register">
  43. <router-link class="link-type" :to="'/register'">立即注册</router-link>
  44. </div>
  45. </el-form-item>
  46. </el-form>
  47. </div>
  48. <p class="introduction-p">技术支持:江苏忠江智能科技有限公司</p>
  49. </div>
  50. </template>
  51. <script>
  52. import { getCodeImg } from "@/api/login";
  53. import Cookies from "js-cookie";
  54. import { encrypt, decrypt } from '@/utils/jsencrypt'
  55. export default {
  56. name: "bigDataLogin",
  57. data() {
  58. return {
  59. codeUrl: "",
  60. cookiePassword: "",
  61. type:1,
  62. loginForm: {
  63. // username: "admin",
  64. // password: "admin123",
  65. username: "",
  66. password: "",
  67. rememberMe: false,
  68. code: "",
  69. uuid: "",
  70. // userType:""
  71. },
  72. loginRules: {
  73. // username: [
  74. // { required: true, trigger: "blur", message: "请输入您的账号" }
  75. // ],
  76. // password: [
  77. // { required: true, trigger: "blur", message: "请输入您的密码" }
  78. // ],
  79. // code: [{ required: true, trigger: "change", message: "请输入验证码" }]
  80. },
  81. loading: false,
  82. // 验证码开关
  83. captchaOnOff: true,
  84. // 注册开关
  85. register: false,
  86. redirect: undefined,
  87. text:"",
  88. };
  89. },
  90. watch: {
  91. $route: {
  92. handler: function(route) {
  93. this.redirect = route.query && route.query.redirect;
  94. },
  95. immediate: true
  96. }
  97. },
  98. created() {
  99. localStorage.setItem('windowHref',window.location.href)
  100. this.getCode();
  101. this.getCookie();
  102. this.exitFullscreen();
  103. },
  104. methods: {
  105. getCode() {
  106. getCodeImg().then(res => {
  107. this.captchaOnOff = res.captchaOnOff === undefined ? true : res.captchaOnOff;
  108. if (this.captchaOnOff) {
  109. this.codeUrl = "data:image/gif;base64," + res.img;
  110. this.loginForm.uuid = res.uuid;
  111. }
  112. });
  113. },
  114. getCookie() {
  115. const username = Cookies.get("username");
  116. const password = Cookies.get("password");
  117. const rememberMe = Cookies.get('rememberMe')
  118. this.loginForm = {
  119. username: username === undefined ? this.loginForm.username : username,
  120. password: password === undefined ? this.loginForm.password : decrypt(password),
  121. rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
  122. };
  123. },
  124. handleLogin() {
  125. if(this.loginForm.username.length<1){
  126. this.text = "*请输入账号";
  127. return
  128. }else if(this.loginForm.password.length<1){
  129. this.text = "*请输入密码";
  130. return
  131. }else if(!this.loginForm.code||this.loginForm.code.length<1){
  132. this.text = "*请输入验证码";
  133. return
  134. }
  135. this.text = "";
  136. this.$refs.loginForm.validate(valid => {
  137. if (valid) {
  138. this.loading = true;
  139. this.$store.dispatch("Login", this.loginForm).then((res) => {
  140. if(res.data.type){
  141. if(res.data.screen_type == 1){
  142. window.location.href = process.env.VUE_APP_BIG_SCREEN_CAMPUS_BASE_API + '?identity=' + res.data.screen_token;
  143. }else if(res.data.screen_type == 2){
  144. window.location.href = process.env.VUE_APP_BIG_SCREEN_FACULTY_BASE_API + '?identity=' + res.data.screen_token;
  145. }else{
  146. this.msgError("您没有相关权限")
  147. this.loading = false;
  148. return
  149. }
  150. this.fullScreen();
  151. }
  152. }).catch(() => {
  153. this.loading = false;
  154. if (this.captchaOnOff) {
  155. this.getCode();
  156. }
  157. });
  158. }
  159. });
  160. },
  161. //全屏
  162. fullScreen() {
  163. var element = document.documentElement;
  164. if (element.requestFullscreen) {
  165. element.requestFullscreen();
  166. } else if (element.msRequestFullscreen) {
  167. element.msRequestFullscreen();
  168. } else if (element.mozRequestFullScreen) {
  169. element.mozRequestFullScreen();
  170. } else if (element.webkitRequestFullscreen) {
  171. element.webkitRequestFullscreen();
  172. }
  173. },
  174. //退出全屏
  175. exitFullscreen() {
  176. if (document.exitFullscreen) {
  177. document.exitFullscreen();
  178. } else if (document.msExitFullscreen) {
  179. document.msExitFullscreen();
  180. } else if (document.mozCancelFullScreen) {
  181. document.mozCancelFullScreen();
  182. } else if (document.webkitExitFullscreen) {
  183. document.webkitExitFullscreen();
  184. }
  185. },
  186. }
  187. };
  188. </script>
  189. <style rel="stylesheet/scss" lang="scss">
  190. .login-page{
  191. height: 100%;
  192. width:100%;
  193. background-image: url("../assets/ZDimages/login/icon_dl_bbg.png");
  194. background-repeat:no-repeat;
  195. background-size: cover;
  196. -webkit-background-size: cover;
  197. -o-background-size: cover;
  198. position: relative;
  199. *{
  200. margin:0;
  201. }
  202. .logo-img{
  203. position: absolute;
  204. top:29px;
  205. left:52px;
  206. width:220px;
  207. height:55px;
  208. }
  209. .title-img-box{
  210. position: absolute;
  211. top:74px;
  212. left:50%;
  213. margin-left:-580px;
  214. width:1180px;
  215. height:230px;
  216. div{
  217. position: relative;
  218. img{
  219. width:1180px;
  220. height:230px;
  221. }
  222. p{
  223. position: absolute;
  224. top:72px;
  225. right:300px;
  226. width:50px;
  227. height:26px;
  228. line-height:26px;
  229. text-align: center;
  230. background: #0045AF;
  231. color:#fff;
  232. font-size:14px;
  233. border-radius:70px;
  234. }
  235. }
  236. }
  237. .form-box{
  238. width:680px;
  239. height:520px;
  240. background-image: url("../assets/ZDimages/login/img_dlk_bg.png");
  241. position: absolute;
  242. top:290px;
  243. left:50%;
  244. margin-left:-340px;
  245. .form-title-p{
  246. line-height:52px;
  247. font-size:24px;
  248. text-align: center;
  249. color:#fff;
  250. font-weight:700;
  251. }
  252. .username-input-box:hover{
  253. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  254. }
  255. .username-input-box{
  256. width:480px;
  257. height:60px;
  258. border: 1px solid #00FFFC;
  259. border-radius: 10px;
  260. background: rgba(0, 13, 41, 0.2);
  261. margin: 40px auto 32px;
  262. display: flex;
  263. overflow: hidden;
  264. img{
  265. height:20px;
  266. width:20px;
  267. margin:20px;
  268. }
  269. input:-webkit-autofill {
  270. //input 背景色 #0C2034根据自己需要替换
  271. -webkit-box-shadow : 0 0 0px 1000px rgba(1,25,67,1) inset !important;
  272. //input字体颜色 颜色根据自己要求替换
  273. -webkit-text-fill-color: #FFFFFF !important;
  274. }
  275. input{
  276. flex:1;
  277. border:none;
  278. outline:none;
  279. background-color: transparent !important;
  280. color: #dedede;
  281. font-size:16px;
  282. }
  283. ::placeholder{
  284. color:#999999 ;
  285. font-size:16px;
  286. }
  287. }
  288. .password-input-box:hover{
  289. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  290. }
  291. .password-input-box{
  292. width:480px;
  293. height:60px;
  294. border: 1px solid #00FFFC;
  295. border-radius: 10px;
  296. background: rgba(0, 13, 41, 0.2);
  297. margin: 0 auto;
  298. display: flex;
  299. overflow: hidden;
  300. img{
  301. height:20px;
  302. width:20px;
  303. margin:20px;
  304. }
  305. input:-webkit-autofill {
  306. //input 背景色 #0C2034根据自己需要替换
  307. -webkit-box-shadow : 0 0 0px 1000px rgba(1,25,67,1) inset !important;
  308. //input字体颜色 颜色根据自己要求替换
  309. -webkit-text-fill-color: #FFFFFF !important;
  310. }
  311. input{
  312. flex:1;
  313. border:none;
  314. outline:none;
  315. background-color: transparent !important;
  316. color: #dedede;
  317. font-size:16px;
  318. }
  319. ::placeholder{
  320. color:#999999 ;
  321. font-size:16px;
  322. }
  323. }
  324. .text-p{
  325. width:480px;
  326. height:59px;
  327. line-height: 59px;
  328. margin: 0 auto;
  329. font-size: 14px;
  330. font-family: Microsoft YaHei;
  331. color: #DC1616;
  332. }
  333. .code-input-box{
  334. width:480px;
  335. height:60px;
  336. display: flex;
  337. margin: 0 auto;
  338. .code-input-left-box:hover{
  339. box-shadow: 0 0 4px 1px rgba(0, 255, 252, 1);
  340. }
  341. .code-input-left-box{
  342. width:330px;
  343. height:60px;
  344. border: 1px solid #00FFFC;
  345. border-radius: 10px;
  346. background: rgba(0, 13, 41, 0.2);
  347. display: flex;
  348. overflow: hidden;
  349. img{
  350. height:20px;
  351. width:20px;
  352. margin:20px;
  353. }
  354. input:-webkit-autofill {
  355. -webkit-box-shadow: 0 0 0 1000px white inset !important;
  356. }
  357. input{
  358. flex:1;
  359. border:none;
  360. outline:none;
  361. background-color: transparent !important;
  362. color: #dedede;
  363. font-size:16px;
  364. }
  365. ::placeholder{
  366. color:#999999 ;
  367. font-size:16px;
  368. }
  369. }
  370. .login-code{
  371. width:124px;
  372. height:50px;
  373. margin:6px 0 0 25px;
  374. img {
  375. width:124px;
  376. height:50px;
  377. cursor: pointer;
  378. vertical-align: middle;
  379. }
  380. }
  381. }
  382. .form-button-p{
  383. font-size:16px;
  384. display: block;
  385. width:480px;
  386. height: 60px;
  387. background: #0045AF;
  388. color:#fff;
  389. border:none;
  390. border-radius: 10px;
  391. margin:34px auto 0;
  392. }
  393. }
  394. .introduction-p{
  395. width:100%;
  396. text-align: center;
  397. color:#fff;
  398. font-size:16px;
  399. line-height:44px;
  400. position: absolute;
  401. left:0;
  402. bottom:0;
  403. }
  404. }
  405. .login {
  406. /*display: flex;*/
  407. /*justify-content: right;*/
  408. /*padding-right:220px;*/
  409. /*align-items: center;*/
  410. height: 100%;
  411. width:100%;
  412. background-image: url("../assets/ZDimages/img_dl_bg.png");
  413. background-size: 100%;
  414. position: relative;
  415. .login-max-box{
  416. position: absolute;
  417. height:800px;
  418. width:1600px;
  419. background: #FFFFFF;
  420. border-radius: 30px;
  421. top:50%;
  422. left:50%;
  423. margin-top:-400px;
  424. margin-left:-800px;
  425. display: flex;
  426. .left-box{
  427. width:591px;
  428. height:500px;
  429. background-image: url("../assets/ZDimages/img_dl_sy.png");
  430. background-size: 100%;
  431. margin:172px 0 178px 140px;
  432. }
  433. .right-box{
  434. flex:1;
  435. .title {
  436. margin:91px 0 40px 0;
  437. text-align: center;
  438. padding:0;
  439. font-size: 50px;
  440. font-family: Microsoft YaHei;
  441. font-weight: bold;
  442. color: #0045AF;
  443. /*
  444. position: absolute;
  445. margin:0;
  446. top: -100px;
  447. right:-120px;
  448. font-size:60px;
  449. width:770px;
  450. text-align: center;
  451. font-weight:700;
  452. */
  453. -webkit-touch-callout: none; /* iOS Safari */
  454. -webkit-user-select: none; /* Chrome/Safari/Opera */
  455. -khtml-user-select: none; /* Konqueror */
  456. -moz-user-select: none; /* Firefox */
  457. -ms-user-select: none; /* Internet Explorer/Edge */
  458. user-select: none; /* Non-prefixed version, currently not supported by any browser */
  459. }
  460. .login-form {
  461. border-radius: 6px;
  462. background: #ffffff;
  463. width: 500px;
  464. margin:0 auto;
  465. padding: 25px 25px 5px 25px;
  466. .el-input {
  467. height: 38px;
  468. input {
  469. height: 38px;
  470. }
  471. }
  472. .input-icon {
  473. height: 39px;
  474. width: 14px;
  475. margin-left: 2px;
  476. }
  477. .username-input-box{
  478. width:448px;
  479. height:48px;
  480. background: #f8f8f8;
  481. border: 1px solid #E0E0E0;
  482. border-radius:10px;
  483. display: flex;
  484. margin-bottom:30px;
  485. img{
  486. width:20px;
  487. height:20px;
  488. margin:14px 16px 0 16px;
  489. }
  490. input{
  491. height:46px;
  492. flex:1;
  493. background: #f8f8f8;
  494. outline: none;
  495. border:none;
  496. margin-right:20px;
  497. color:#333;
  498. }
  499. input::placeholder{
  500. color:#ccc;
  501. }
  502. }
  503. .password-input-box{
  504. width:448px;
  505. height:48px;
  506. background: #f8f8f8;
  507. border: 1px solid #E0E0E0;
  508. border-radius:10px;
  509. display: flex;
  510. img{
  511. width:20px;
  512. height:20px;
  513. margin:14px 16px 0 16px;
  514. }
  515. input{
  516. height:46px;
  517. flex:1;
  518. background: #f8f8f8;
  519. outline: none;
  520. border:none;
  521. margin-right:20px;
  522. color:#333;
  523. }
  524. input::placeholder{
  525. color:#ccc;
  526. }
  527. }
  528. .code-input-box{
  529. width:450px;
  530. height:50px;
  531. display: flex;
  532. margin-bottom:60px;
  533. .code-input-left-box{
  534. width:274px;
  535. height:48px;
  536. background: #f8f8f8;
  537. border: 1px solid #E0E0E0;
  538. border-radius:10px;
  539. img{
  540. width:20px;
  541. height:20px;
  542. margin:14px 16px 0 16px;
  543. }
  544. input{
  545. height:46px;
  546. flex:1;
  547. background: #f8f8f8;
  548. outline: none;
  549. border:none;
  550. margin-right:20px;
  551. color:#333;
  552. }
  553. input::placeholder{
  554. color:#ccc;
  555. }
  556. display: flex;
  557. }
  558. .login-code {
  559. margin-left:24px;
  560. width: 150px;
  561. height: 48px;
  562. img {
  563. width: 150px;
  564. height: 48px;
  565. cursor: pointer;
  566. vertical-align: middle;
  567. }
  568. }
  569. }
  570. }
  571. .login-tip {
  572. font-size: 13px;
  573. text-align: center;
  574. color: #bfbfbf;
  575. }
  576. .el-login-footer {
  577. height: 40px;
  578. line-height: 40px;
  579. position: fixed;
  580. bottom: 0;
  581. width: 100%;
  582. text-align: center;
  583. color: #fff;
  584. font-family: Arial;
  585. font-size: 12px;
  586. letter-spacing: 1px;
  587. }
  588. .login-code-img {
  589. height: 38px;
  590. }
  591. .type-max-box{
  592. display: flex;
  593. margin-bottom:58px;
  594. width:450px;
  595. /*border-bottom:1px solid #e0e0e0;*/
  596. p{
  597. font-size:18px;
  598. text-align: center;
  599. line-height:56px;
  600. margin:0;
  601. color:#666666;
  602. cursor:pointer;
  603. }
  604. p:nth-child(1){
  605. width:90px;
  606. margin-right:30px;
  607. }
  608. p:nth-child(2){
  609. width:126px;
  610. }
  611. .typeColorA{
  612. color:#0045af;
  613. border-bottom:2px solid #0045af;
  614. }
  615. }
  616. .text-p{
  617. margin:0;
  618. width: 172px;
  619. height: 50px;
  620. font-size: 14px;
  621. font-family: Microsoft YaHei;
  622. color: #DC1616;
  623. line-height: 50px;
  624. }
  625. }
  626. .logo-img{
  627. position: absolute;
  628. left:20px;
  629. top:20px;
  630. width:267px;
  631. height:66px;
  632. }
  633. }
  634. .position-p{
  635. position: absolute;
  636. right:0;
  637. bottom:20px;
  638. width: 638px;
  639. height: 15px;
  640. font-size: 14px;
  641. color: #AAE1FF;
  642. line-height: 15px;
  643. padding:0;
  644. margin:0;
  645. }
  646. }
  647. </style>