Login.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916
  1. <template>
  2. <div>
  3. <!--头部-->
  4. <nav class="x-navbar">
  5. <div class="container">
  6. <div class="navbar-header">
  7. <input type="hidden" name="iconUrl" value="">
  8. <a class="navbar-brand" :href="!loginStyle || (loginStyle && (JSON.parse(loginStyle.returnHomeUrl).url)) || ''">
  9. <img :src="loginStyle.logoUrl" alt="">
  10. <span>{{loginStyle.title || ''}}</span>
  11. </a>
  12. </div>
  13. <div class="collapse navbar-collapse navbar-right">
  14. <a :href="loginStyle ? JSON.parse(loginStyle.returnHomeUrl).url : ''">{{loginStyle ? JSON.parse(loginStyle.returnHomeUrl).name : ''}}</a>
  15. <a href="http://uas.ubtob.com/serve#/" v-if="!loginStyle || (loginStyle && (JSON.parse(loginStyle.returnHomeUrl).needHelp))">帮助</a>
  16. </div>
  17. </div>
  18. </nav>
  19. <div class="x-container">
  20. <!-- background slider -->
  21. <div class="x-banner-wrap">
  22. <div class="x-banner">
  23. <ul class="list-unstyled">
  24. <li id="bgStyle" v-bind:style="{ background: `url(${loginStyle.bgUrl}) center center/auto 100% no-repeat ${loginStyle.bgColor}` }">
  25. <a :href="loginStyle.bgLink" v-if="loginStyle.bgLink">
  26. <div class="inner">
  27. <div class="x-title x-text-0"></div>
  28. <div class="x-subtitle x-text-0"></div>
  29. <div class="x-btn-group">
  30. </div>
  31. </div>
  32. </a>
  33. <a v-else style="cursor: default">
  34. <div class="inner">
  35. <div class="x-title x-text-0"></div>
  36. <div class="x-subtitle x-text-0"></div>
  37. <div class="x-btn-group">
  38. </div>
  39. </div>
  40. </a>
  41. </li>
  42. </ul>
  43. </div>
  44. </div>
  45. <div class="x-login-wrap">
  46. <div class="x-login">
  47. <!-- user & pwd login wrap -->
  48. <div id="form-wrap" class="x-login-form">
  49. <!--账号密码登录-->
  50. <div v-show="activeTab === 0">
  51. <el-form :model="login" :rules="rules2" ref="login" class="demo-ruleForm login-form">
  52. <el-form-item prop="username">
  53. <el-input type="text" v-model="login.username" auto-complete="new-password" placeholder="手机号/邮箱"></el-input>
  54. <i class="fa fa-user"></i>
  55. </el-form-item>
  56. <el-form-item prop="password">
  57. <input autocomplete="new-password"
  58. type="password" style="display: none;width:0;height:0;">
  59. <el-input type="password"
  60. v-model="login.password"
  61. auto-complete="new-password"
  62. placeholder="密码"
  63. @keyup.enter.native="isLogin(true)"></el-input>
  64. <i class="fa fa-lock"></i>
  65. </el-form-item>
  66. <el-form-item prop="captcha" class="captcha" v-show="showCheckCode">
  67. <el-input type="text"
  68. v-model="login.captcha"
  69. auto-complete="off"
  70. class="code-input"
  71. @keyup.enter.native="isLogin(true)"></el-input>
  72. <img id="captchaImage" class="code-img" src="/sso/login/checkCode"/>
  73. <a class="code-click" @click="getCode">看不清换一张</a>
  74. </el-form-item>
  75. <el-form-item class="text-position">
  76. <div class="page-part" v-if="loginStyle.needRememberPwd">
  77. <el-checkbox v-model="checked">记住密码</el-checkbox>
  78. </div>
  79. <a class="forget" id='forget' @click="goForgetPassword">忘记密码?</a>
  80. </el-form-item>
  81. <el-form-item>
  82. <a class="btn login"
  83. @click="isLogin(true)"
  84. :disabled="isLoginDisabled">登录</a>
  85. </el-form-item>
  86. </el-form>
  87. </div>
  88. <!--短信快捷登录-->
  89. <div v-show="activeTab === 1">
  90. <el-form :model="fastLogin" :rules="rules3" ref="fastLogin" class="demo-ruleForm login-form loginForm">
  91. <el-form-item prop="mobile">
  92. <el-input type="text" v-model="fastLogin.mobile" auto-complete="off" placeholder="请输入手机号"></el-input>
  93. </el-form-item>
  94. <el-form-item prop="code" class="fastMsg">
  95. <el-input type="text" v-model="fastLogin.code"
  96. auto-complete="off" placeholder="验证码"></el-input>
  97. <el-button type="primary" class="fastCode"
  98. v-show="sendLoginCode"
  99. @click="getCheckCode">获取验证码</el-button>
  100. <el-button type="primary" v-show="!sendLoginCode" class="fastCode code-send">已发送({{login_time}}s)</el-button>
  101. </el-form-item>
  102. <el-form-item>
  103. <a class="btn login"
  104. @click="fastToLogin(true)">登录</a>
  105. </el-form-item>
  106. </el-form>
  107. </div>
  108. <div class="warn-text-area">
  109. 为确保您账户的安全及正常使用,依《网络安全法》相关要求,6月1日起会员账户需绑定手机、设置密码保护。感谢您的理解和支持!
  110. </div>
  111. <div class="link-go">
  112. <a @click="changeManage" class="first">更换管理员</a>
  113. <a class='change' @click="activeTab = 1" v-show="activeTab === 0">短信快捷登录</a>
  114. <a class='change' @click="activeTab = 0" v-show="activeTab === 1">用户密码登录</a>
  115. <a id="register" @click="goRegister" class="second">
  116. <i class="fa fa-arrow-circle-o-right"></i>免费注册</a>
  117. </div>
  118. </div>
  119. <!-- qrcode login wrap -->
  120. <div id="qrcode-wrap" class="x-login-qrcode">
  121. <div class="x-qrcode-help">
  122. <span>打开手机客户端,扫描下面的二维码</span>
  123. </div>
  124. <div class="x-qrcode-img">
  125. <img src="/images/all/qrcode.jpg">
  126. </div>
  127. <div class="x-qrcode-ex">
  128. <ul class="list-unstyled list-inline">
  129. <li><i class="iconfont icon-left icon-input"></i><span>免输入</span></li>
  130. <li><i class="iconfont icon-left icon-fast"></i><span>更快捷</span></li>
  131. <li><i class="iconfont icon-left icon-safe"></i><span>更安全</span></li>
  132. </ul>
  133. </div>
  134. </div>
  135. </div>
  136. </div>
  137. <!--选择企业弹出框-->
  138. <div>
  139. <el-dialog class="dialog"
  140. :visible.sync="dialogVisible"
  141. size="tiny">
  142. <div class="x-floating x-list" v-show="dialogVisible">
  143. <div class="x-list-header">您要登录的公司是:</div>
  144. <div class="x-list-content">
  145. <ul class="list-unstyled" >
  146. <template v-for="space in this.enterprise">
  147. <li v-text="space.name" @click="chooseOneEnterprise(false, space.id)">华商龙科技有限公司</li>
  148. </template>
  149. </ul>
  150. </div>
  151. </div>
  152. </el-dialog>
  153. </div>
  154. <loading v-show="isShowLoading"/>
  155. </div>
  156. <!--尾部-->
  157. <div v-html="loginStyle.footUrl || ''" class="footer"></div>
  158. </div>
  159. </template>
  160. <script>
  161. import Loading from '~components/common/loading/Loading.vue'
  162. export default {
  163. name: 'login',
  164. components: {
  165. Loading
  166. },
  167. data () {
  168. var validateUsername = (rule, value, callback) => {
  169. if (value === '') {
  170. this.checkUsername = false
  171. this.showCheckCode = false
  172. } else {
  173. if (this.login.username !== '') {
  174. // 获取密码输错次数
  175. this.$http.get(`/sso/login/getPwdErrorCount`, {params: {username: this.login.username}})
  176. .then(response => {
  177. if (response.data.success) {
  178. this.showCheckCode = false
  179. let getPasswordErrorCount = response.data.content || ''
  180. if (getPasswordErrorCount >= 5) {
  181. this.$message.error('密码错误次数已达上限,今日无法登陆')
  182. this.isLoginDisabled = true
  183. this.showCheckCode = false
  184. } else if (getPasswordErrorCount < 3) {
  185. this.isLoginDisabled = false
  186. this.checkUsername = true
  187. this.showCheckCode = false
  188. } else if (getPasswordErrorCount >= 3 && getPasswordErrorCount < 5) {
  189. if (getPasswordErrorCount === 3) {
  190. this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
  191. }
  192. if (getPasswordErrorCount === 4) {
  193. this.$message.error('当前已输错密码4次,若达到5次今日将无法登陆')
  194. }
  195. this.isLoginDisabled = false
  196. this.checkUsername = true
  197. this.showCheckCode = true
  198. } else {
  199. this.checkUsername = false
  200. this.showCheckCode = false
  201. }
  202. } else {
  203. return Promise.reject(response.data)
  204. }
  205. }).catch(err => {
  206. this.isShowLoading = false
  207. console.log(err)
  208. // this.$message.error(err.errMsg)
  209. })
  210. }
  211. callback()
  212. }
  213. }
  214. var validatePassword = (rule, value, callback) => {
  215. if (value === '') {
  216. this.checkPassword = false
  217. } else {
  218. if (this.login.password !== '') {
  219. this.checkPassword = true
  220. }
  221. callback()
  222. }
  223. }
  224. // 短信便捷登录
  225. var validateMobile = (rule, value, callback) => {
  226. if (value === '') {
  227. this.checkMobile = false
  228. } else {
  229. if (this.fastLogin.mobile !== '') {
  230. // 判断手机号是否已被注册
  231. this.$http.get(`/api/user/checkMobile`, {params: {mobile: this.fastLogin.mobile}})
  232. .then(response => {
  233. if (response.data.hasRegister) {
  234. this.checkMobile = true
  235. } else {
  236. this.$message.error('手机号未注册,请先注册!')
  237. this.checkMobile = false
  238. return Promise.reject(response.data)
  239. }
  240. }).catch(err => {
  241. this.$message.error(err.errMsg)
  242. })
  243. callback()
  244. }
  245. }
  246. }
  247. var validateCode = (rule, value, callback) => {
  248. if (value === '') {
  249. this.checkCode = false
  250. } else {
  251. if (this.fastLogin.code !== '') {
  252. this.checkCode = true
  253. }
  254. callback()
  255. }
  256. }
  257. return {
  258. login: {
  259. username: '',
  260. password: '',
  261. captcha: '',
  262. spaceUU: ''
  263. },
  264. fastLogin: {
  265. mobile: '',
  266. code: ''
  267. },
  268. activeTab: 0,
  269. checked: false,
  270. isShowLoading: false,
  271. checkUsername: false,
  272. checkPassword: false,
  273. showCheckCode: false,
  274. isLoginDisabled: false,
  275. dialogVisible: false,
  276. queryLink: '',
  277. checkMobile: false,
  278. getCodeBtnIsDisabled: true,
  279. sendLoginCode: true,
  280. login_time: 0,
  281. token: '',
  282. checkCode: false,
  283. rules2: {
  284. username: [
  285. {validator: validateUsername, trigger: 'blur'}
  286. ],
  287. password: [
  288. {validator: validatePassword, trigger: 'blur'}
  289. ]
  290. },
  291. rules3: {
  292. mobile: [
  293. {validator: validateMobile, trigger: 'blur'}
  294. ],
  295. code: [
  296. {validator: validateCode, trigger: 'blur'}
  297. ]
  298. }
  299. }
  300. },
  301. mounted () {
  302. this.$nextTick(() => {
  303. this.getUrl()
  304. if (this.appId === 'mall' || this.appId === 'home') {
  305. this.getCookie()
  306. }
  307. this.validUserName()
  308. })
  309. },
  310. computed: {
  311. enterprise () {
  312. let chooseEnterprise = this.$store.state.login.chooseRegisterEnterprise.choose.data
  313. return chooseEnterprise
  314. },
  315. loginStyle () {
  316. return this.$store.state.login.loginStyle.data.content ? this.$store.state.login.loginStyle.data.content : ''
  317. }
  318. },
  319. methods: {
  320. // 获取用户错误次数
  321. validUserName () {
  322. if (this.login.username) {
  323. // 获取密码输错次数
  324. this.$http.get(`/sso/login/getPwdErrorCount`, {params: {username: this.login.username}})
  325. .then(response => {
  326. if (response.data.success) {
  327. let getPasswordErrorCount = response.data.content || ''
  328. if (getPasswordErrorCount >= 5) {
  329. this.$message.error('密码错误次数已达上限,今日无法登陆')
  330. this.isLoginDisabled = true
  331. this.showCheckCode = false
  332. } else if (getPasswordErrorCount < 3) {
  333. this.isLoginDisabled = false
  334. this.checkUsername = true
  335. this.showCheckCode = false
  336. } else if (getPasswordErrorCount >= 3 && getPasswordErrorCount < 5) {
  337. if (getPasswordErrorCount === 3) {
  338. this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
  339. }
  340. if (getPasswordErrorCount === 4) {
  341. this.$message.error('当前已输错密码4次,若达到5次今日将无法登陆')
  342. }
  343. this.isLoginDisabled = false
  344. this.checkUsername = true
  345. this.showCheckCode = true
  346. } else {
  347. this.checkUsername = false
  348. this.showCheckCode = false
  349. }
  350. } else {
  351. return Promise.reject(response.data)
  352. }
  353. }).catch(err => {
  354. this.$message.error(err.errMsg)
  355. })
  356. }
  357. },
  358. // 更换管理员
  359. changeManage () {
  360. window.location.href = `appeals/changeManagerAppeal${this.$store.state.option.fullPath}`
  361. },
  362. // 获取url参数
  363. getUrl () {
  364. var url = window.location.search
  365. var request = {}
  366. if (url.indexOf('?' !== -1)) {
  367. var str = url.substr(1)
  368. var strs = str.split('&')
  369. this.queryLink = str
  370. for (var i = 0; i < strs.length; i++) {
  371. request[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1])
  372. }
  373. }
  374. this.appId = request['appId'] || ''
  375. this.returnUrl = request['returnURL'] || ''
  376. this.baseUrl = request['baseUrl'] || ''
  377. },
  378. goForgetPassword () {
  379. let url = `/reset/forgetPasswordValidationAccount?${this.queryLink}`
  380. document.getElementById('forget').href = url
  381. },
  382. // 去注册
  383. goRegister () {
  384. document.getElementById('register').href = `/register/enterpriseRegistration?${this.queryLink}`
  385. },
  386. // 获取验证码
  387. getCode () {
  388. var imgSrc = document.getElementById('captchaImage')
  389. imgSrc.setAttribute('src', '/sso/login/checkCode?timestamp=' + (new Date()).valueOf())
  390. },
  391. // 登录
  392. isLogin (flag) {
  393. this.isShowLoading = true
  394. if (!this.login.username) {
  395. this.isShowLoading = false
  396. this.$message.error('请填写账号')
  397. } else if (!this.login.password) {
  398. this.isShowLoading = false
  399. this.$message.error('请填写密码')
  400. } else {
  401. let param = new FormData()
  402. param.append('username', this.login.username)
  403. param.append('password', this.login.password)
  404. param.append('captcha', this.login.captcha)
  405. param.append('spaceUU', this.login.spaceUU)
  406. param.append('appId', this.appId)
  407. param.append('returnUrl', this.returnUrl)
  408. param.append('baseUrl', this.baseUrl)
  409. let config = {
  410. headers: {'Content-Type': 'multipart/form-data'}
  411. }
  412. this.$http.post('/sso/login', param, config)
  413. .then(response => {
  414. this.isShowLoading = false
  415. if (response.data.success) {
  416. if (response.data.content.spaces) {
  417. // 弹框让用户选择企业
  418. this.$store.commit('login/chooseRegisterEnterprise/GET_ENTERPRISE_SUCCESS', response.data.content.spaces)
  419. this.dialogVisible = flag
  420. } else if (response.data.content.loginUrls) {
  421. // 遍历登录url循环让各应用登录(需要跨域)
  422. let param = response.data.content.data
  423. let a = ''
  424. for (let n in param) {
  425. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  426. }
  427. let params = a.substr(0, a.length - 1)
  428. this.isShowLoading = true
  429. if (response.data.content.currentUrl) {
  430. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  431. name: 'successCallback',
  432. timeout: 3000
  433. }, (err, data) => {
  434. if (err) {
  435. this.$message.error('登录超时,请重试')
  436. this.isShowLoading = false
  437. throw err
  438. } else {
  439. this.loginOther(response, params)
  440. }
  441. })
  442. } else {
  443. this.loginOther(response, params, 3000)
  444. }
  445. }
  446. } else {
  447. this.$message.error(response.data)
  448. var count = response.data.errorCount
  449. if (count < 3) {
  450. this.showCheckCode = false
  451. this.isLoginDisabled = false
  452. } else if (count >= 5) {
  453. this.$message.error('密码错误次数已达上限,今日无法登陆')
  454. this.isLoginDisabled = true
  455. this.showCheckCode = false
  456. } else if (count >= 3 && count < 5) {
  457. this.getCode()
  458. if (count === 3) {
  459. this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
  460. }
  461. this.showCheckCode = true
  462. this.isLoginDisabled = false
  463. }
  464. return Promise.reject(response.data)
  465. }
  466. }).catch(err => {
  467. this.isShowLoading = false
  468. let _this = this
  469. setTimeout(function () {
  470. _this.getCode()
  471. }, 100)
  472. this.$message.error(err.errMsg)
  473. })
  474. }
  475. },
  476. chooseOneEnterprise (flag, spaceUU) {
  477. this.login.spaceUU = spaceUU
  478. this.dialogVisible = false
  479. if (this.activeTab === 0) {
  480. this.isLogin(flag)
  481. } else if (this.activeTab === 1) {
  482. this.fastToLogin(flag)
  483. }
  484. if (this.appId === 'mall' || this.appId === 'home') {
  485. if (this.checked) {
  486. this.setCookie(this.login.username, this.login.password, 7)
  487. } else {
  488. this.clearCookie()
  489. }
  490. }
  491. },
  492. // 短信快捷登录
  493. fastToLogin (flag) {
  494. this.isShowLoading = true
  495. if (!this.fastLogin.mobile) {
  496. this.isShowLoading = false
  497. this.$message.error('请填写手机号')
  498. } else {
  499. let param = new FormData()
  500. param.append('mobile', this.fastLogin.mobile)
  501. param.append('code', this.fastLogin.code)
  502. param.append('appId', this.appId)
  503. param.append('token', this.token)
  504. param.append('spaceUU', this.login.spaceUU)
  505. param.append('returnUrl', this.returnUrl)
  506. param.append('baseUrl', this.baseUrl)
  507. let config = {
  508. headers: {'Content-Type': 'multipart/form-data'}
  509. }
  510. this.$http.post('/sso/login/sms', param, config)
  511. .then(response => {
  512. this.isShowLoading = false
  513. if (response.data.success) {
  514. if (response.data.content.spaces) {
  515. // 弹框让用户选择企业
  516. this.$store.commit('login/chooseRegisterEnterprise/GET_ENTERPRISE_SUCCESS', response.data.content.spaces)
  517. this.dialogVisible = flag
  518. } else if (response.data.content.loginUrls) {
  519. // 遍历登录url循环让各应用登录(需要跨域)
  520. let param = response.data.content.data
  521. let a = ''
  522. for (let n in param) {
  523. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  524. }
  525. let params = a.substr(0, a.length - 1)
  526. this.isShowLoading = true
  527. if (response.data.content.currentUrl) {
  528. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  529. name: 'successCallback',
  530. timeout: 3000
  531. }, (err, data) => {
  532. if (err) {
  533. this.$message.error('登录超时,请重试')
  534. this.isShowLoading = false
  535. throw err
  536. } else {
  537. this.loginOther(response, params)
  538. }
  539. })
  540. } else {
  541. this.loginOther(response, params, 3000)
  542. }
  543. }
  544. } else {
  545. this.$message.error(response.data)
  546. return Promise.reject(response.data)
  547. }
  548. }).catch(err => {
  549. this.isShowLoading = false
  550. let _this = this
  551. setTimeout(function () {
  552. _this.getCode()
  553. }, 100)
  554. this.$message.error(err.errMsg)
  555. })
  556. }
  557. },
  558. getJsonp: function (url, timeout = 500) {
  559. return new Promise((resolve, reject) => {
  560. this.$jsonp(url, {
  561. name: 'successCallback',
  562. timeout: timeout
  563. }, function (err, data) {
  564. if (err) {
  565. reject(err)
  566. throw err
  567. } else {
  568. resolve(data)
  569. }
  570. })
  571. })
  572. },
  573. crossAfter (url) {
  574. try {
  575. window.location.href = url
  576. } catch (err) {
  577. console.log(err)
  578. }
  579. },
  580. loginOther (response, a, timeout) {
  581. const crossAfter = this.crossAfter
  582. let promises = []
  583. for (let i in response.data.content.loginUrls) {
  584. promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
  585. }
  586. Promise.all(promises).then(() => {
  587. crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
  588. }).catch(() => {
  589. crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
  590. })
  591. },
  592. // 设置cookie
  593. setCookie (cName, cPwd, exdays) {
  594. let exdate = new Date()
  595. exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays)
  596. window.document.cookie = 'userName' + '=' + cName + ';path=/;expires=' + exdate.toGMTString()
  597. window.document.cookie = 'userPwd' + '=' + cPwd + ';path=/;expires=' + exdate.toGMTString()
  598. },
  599. // 读取cookies
  600. getCookie () {
  601. if (document.cookie.length > 0) {
  602. let arr = document.cookie.split(';')
  603. for (var i = 0; i < arr.length; i++) {
  604. let arr2 = arr[i].split('=')
  605. if (arr2[0].trim() === 'userName') {
  606. this.login.username = arr2[1]
  607. }
  608. if (arr2[0].trim() === 'userPwd') {
  609. this.login.password = arr2[1]
  610. }
  611. if (this.login.username && this.login.username) {
  612. this.checked = true
  613. }
  614. }
  615. }
  616. },
  617. // 清除cookie
  618. clearCookie () {
  619. this.setCookie('', '', -1)
  620. },
  621. // 获取校验码
  622. getCheckCode () {
  623. this.isShowLoading = true
  624. if (!this.fastLogin.mobile) {
  625. this.isShowLoading = false
  626. this.$message.error('请先填写手机号')
  627. } else {
  628. if (this.checkMobile) {
  629. this.$http.get(`/sso/login/sendSmsCode`, {params: {mobile: this.fastLogin.mobile}})
  630. .then(response => {
  631. this.isShowLoading = false
  632. if (response.data) {
  633. this.token = response.data.content.token
  634. if (this.token !== '') {
  635. this.$message({
  636. message: '验证码已经发送到您的手机,请注意查收',
  637. type: 'success'
  638. })
  639. this.sendLoginCode = false
  640. this.login_time = 60
  641. var loginTime = setInterval(() => {
  642. this.login_time--
  643. if (this.login_time <= 0) {
  644. this.sendLoginCode = true
  645. clearInterval(loginTime)
  646. }
  647. }, 1000)
  648. }
  649. } else {
  650. return Promise.reject(response.data)
  651. }
  652. }).catch(err => {
  653. this.isShowLoading = false
  654. this.$message.error(err.errMsg)
  655. })
  656. } else {
  657. this.isShowLoading = false
  658. }
  659. }
  660. }
  661. }
  662. }
  663. </script>
  664. <style lang="scss" type="text/scss" scoped>
  665. @import '~assets/scss/mixins';
  666. @import '~assets/scss/variables';
  667. .x-navbar{
  668. height: 80px;
  669. line-height: 80px;
  670. margin: 0;
  671. .container{
  672. position: relative;
  673. width: 990px!important;
  674. height: 80px;
  675. .navbar-header{
  676. height: 80px;
  677. line-height: 80px;
  678. }
  679. a.navbar-brand{
  680. overflow: hidden;
  681. padding: 0px;
  682. height: inherit;
  683. line-height: inherit;
  684. font-family: "\5FAE\8F6F\96C5\9ED1";
  685. font-size: 24px;
  686. font-weight: 400;
  687. color: #888;
  688. img{
  689. margin: 28px 8px 0 0;
  690. max-width: 80px;
  691. max-height: 27px;
  692. vertical-align: middle;
  693. float: left;
  694. }
  695. span{
  696. float: left;
  697. }
  698. }
  699. .collapse{
  700. a{
  701. padding-left: 12px;
  702. margin-right: 10px;
  703. color: #666;
  704. outline: 0;
  705. border-left: 1px solid #ddd;
  706. &:first-child{
  707. border-width: 0;
  708. }
  709. }
  710. }
  711. }
  712. }
  713. .x-container{
  714. position: relative;
  715. height: 475px;
  716. div.link-go {
  717. text-align: right;
  718. margin-top: 7px;
  719. a{
  720. color: #2d8cf0;
  721. background: 0 0;
  722. text-decoration: none;
  723. outline: 0;
  724. cursor: pointer;
  725. transition: color .2s ease;
  726. }
  727. a.first{
  728. float: left;
  729. margin-top: 3px;
  730. font-size: 12px;
  731. }
  732. a.change{
  733. margin:3px 0 0 50px;
  734. float: left;
  735. font-size: 12px;
  736. }
  737. }
  738. /*登录弹出框*/
  739. .x-floating {
  740. position: fixed;
  741. top: 80px;
  742. left: 50%;
  743. z-index: 100000;
  744. opacity: 1;
  745. -webkit-transition: all .5s;
  746. -moz-transition: all .5s;
  747. transition: all .5s;
  748. }
  749. .x-list {
  750. width: 60%;
  751. height:420px;
  752. margin-left: -30%;
  753. background: #fff;
  754. border-top: 1px solid #e7e7e7;
  755. cursor: pointer;
  756. .x-list-header {
  757. padding: 10px 20px;
  758. background: #e0e0e0;
  759. height: 42px;
  760. line-height: 21px;
  761. font-size: 14px;
  762. font-weight: 700;
  763. color: #505050;
  764. }
  765. .x-list-content{
  766. overflow-y: auto;
  767. height:375px;
  768. ul{
  769. margin-bottom: 0;
  770. li{
  771. display:inline-block;
  772. padding: 10px 20px;
  773. width: 33%;
  774. overflow: hidden;
  775. white-space: nowrap;
  776. text-overflow: ellipsis;
  777. height: 42px;
  778. line-height: 21px;
  779. font-size: 12px;
  780. color: #505050;
  781. border-bottom: 1px solid #e7e7e7;
  782. &:hover{
  783. background: #e7e7e7;
  784. }
  785. }
  786. }
  787. }
  788. .x-list .x-list-header, .x-list li {
  789. padding: 10px 20px;
  790. border-bottom: 1px solid #e7e7e7;
  791. }
  792. }
  793. .x-floating.in {
  794. top: 80px;
  795. opacity: 1;
  796. }
  797. .x-banner-wrap {
  798. position: absolute;
  799. left: 0;
  800. top: 0;
  801. width: 100%;
  802. height: 475px;
  803. .x-banner {
  804. position: relative;
  805. overflow: auto;
  806. height: 475px;
  807. text-align: center;
  808. li{
  809. width: 100%;
  810. height: 475px;
  811. .inner{
  812. height: 100%;
  813. }
  814. }
  815. }
  816. }
  817. .x-login-wrap{
  818. position: absolute;
  819. top: 10px;
  820. right: 50%;
  821. margin-right: -495px;
  822. height: 475px;
  823. z-index: 5;
  824. .x-login {
  825. position: relative;
  826. top: 40px;
  827. width: 346px;
  828. background: #fff;
  829. overflow: visible;
  830. z-index: 4;
  831. .x-login-form, .x-login-qrcode {
  832. padding: 20px;
  833. .btn{
  834. background: #5078cb;
  835. color: #fff;
  836. font-weight: 700;
  837. letter-spacing: 4px;
  838. border-radius: 0;
  839. }
  840. .x-has-feedback-right {
  841. float: right;
  842. display: inline-block;
  843. a{
  844. color: #5078cb;
  845. }
  846. }
  847. .x-has-feedback-left {
  848. position: relative;
  849. .x-input {
  850. padding-left: 30px;
  851. line-height: 18px;
  852. color: #555;
  853. border-color: #ccc;
  854. border-radius: 0;
  855. box-shadow: none;
  856. }
  857. i.fa{
  858. position: absolute;
  859. top: 2px;
  860. left: 0;
  861. z-index: 2;
  862. display: block;
  863. width: 30px;
  864. height: 34px;
  865. line-height: 34px;
  866. text-align: center;
  867. pointer-events: none;
  868. color: #999;
  869. font-size: 18px;
  870. }
  871. }
  872. i.fa-keyboard-o{
  873. position: absolute;
  874. right: 10px;
  875. top: 10px;
  876. }
  877. i.fa-arrow-circle-o-right{
  878. margin-right: 5px;
  879. font-size: 14px;
  880. color: #5078cb;
  881. }
  882. .warn-text-area{
  883. margin-top: 5px;
  884. font-size: 13px;
  885. color: #000;
  886. }
  887. .text-position {
  888. overflow: hidden;
  889. .page-part {
  890. float: left;
  891. margin-bottom: 0;
  892. .el-checkbox {
  893. margin: 0;
  894. span.el-checkbox__inner{
  895. width: 14px;
  896. height: 14px;
  897. }
  898. }
  899. }
  900. .forget {
  901. float: right;
  902. color: #2d8cf0;
  903. }
  904. }
  905. }
  906. .x-login-qrcode{
  907. display: none;
  908. }
  909. }
  910. }
  911. }
  912. .footer{
  913. padding: 50px 0;
  914. }
  915. </style>