ssoLogin.vue 19 KB

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