ssoLogin.vue 18 KB

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