ssoLogin.vue 19 KB

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