Login.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905
  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. this.checkMobile = true
  230. callback()
  231. }
  232. }
  233. var validateCode = (rule, value, callback) => {
  234. if (value === '') {
  235. this.checkCode = false
  236. } else {
  237. if (this.fastLogin.code !== '') {
  238. this.checkCode = true
  239. }
  240. callback()
  241. }
  242. }
  243. return {
  244. login: {
  245. username: '',
  246. password: '',
  247. captcha: '',
  248. spaceUU: ''
  249. },
  250. fastLogin: {
  251. mobile: '',
  252. code: ''
  253. },
  254. activeTab: 0,
  255. checked: false,
  256. isShowLoading: false,
  257. checkUsername: false,
  258. checkPassword: false,
  259. showCheckCode: false,
  260. isLoginDisabled: false,
  261. dialogVisible: false,
  262. queryLink: '',
  263. checkMobile: false,
  264. getCodeBtnIsDisabled: true,
  265. sendLoginCode: true,
  266. login_time: 0,
  267. token: '',
  268. checkCode: false,
  269. rules2: {
  270. username: [
  271. {validator: validateUsername, trigger: 'blur'}
  272. ],
  273. password: [
  274. {validator: validatePassword, trigger: 'blur'}
  275. ]
  276. },
  277. rules3: {
  278. mobile: [
  279. {validator: validateMobile, trigger: 'blur'}
  280. ],
  281. code: [
  282. {validator: validateCode, trigger: 'blur'}
  283. ]
  284. }
  285. }
  286. },
  287. mounted () {
  288. this.$nextTick(() => {
  289. this.getUrl()
  290. if (this.appId === 'mall' || this.appId === 'home') {
  291. this.getCookie()
  292. }
  293. this.validUserName()
  294. })
  295. },
  296. computed: {
  297. enterprise () {
  298. let chooseEnterprise = this.$store.state.login.chooseRegisterEnterprise.choose.data
  299. return chooseEnterprise
  300. },
  301. loginStyle () {
  302. return this.$store.state.login.loginStyle.data.content ? this.$store.state.login.loginStyle.data.content : ''
  303. }
  304. },
  305. methods: {
  306. // 获取用户错误次数
  307. validUserName () {
  308. if (this.login.username) {
  309. // 获取密码输错次数
  310. this.$http.get(`/sso/login/getPwdErrorCount`, {params: {username: this.login.username}})
  311. .then(response => {
  312. if (response.data.success) {
  313. let getPasswordErrorCount = response.data.content || ''
  314. if (getPasswordErrorCount >= 5) {
  315. this.$message.error('密码错误次数已达上限,今日无法登陆')
  316. this.isLoginDisabled = true
  317. this.showCheckCode = false
  318. } else if (getPasswordErrorCount < 3) {
  319. this.isLoginDisabled = false
  320. this.checkUsername = true
  321. this.showCheckCode = false
  322. } else if (getPasswordErrorCount >= 3 && getPasswordErrorCount < 5) {
  323. if (getPasswordErrorCount === 3) {
  324. this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
  325. }
  326. if (getPasswordErrorCount === 4) {
  327. this.$message.error('当前已输错密码4次,若达到5次今日将无法登陆')
  328. }
  329. this.isLoginDisabled = false
  330. this.checkUsername = true
  331. this.showCheckCode = true
  332. } else {
  333. this.checkUsername = false
  334. this.showCheckCode = false
  335. }
  336. } else {
  337. return Promise.reject(response.data)
  338. }
  339. }).catch(err => {
  340. this.$message.error(err.errMsg)
  341. })
  342. }
  343. },
  344. // 更换管理员
  345. changeManage () {
  346. window.location.href = `appeals/changeManagerAppeal${this.$store.state.option.fullPath}`
  347. },
  348. // 获取url参数
  349. getUrl () {
  350. var url = window.location.search
  351. var request = {}
  352. if (url.indexOf('?' !== -1)) {
  353. var str = url.substr(1)
  354. var strs = str.split('&')
  355. this.queryLink = str
  356. for (var i = 0; i < strs.length; i++) {
  357. request[strs[i].split('=')[0]] = decodeURI(strs[i].split('=')[1])
  358. }
  359. }
  360. this.appId = request['appId'] || ''
  361. this.returnUrl = request['returnURL'] || ''
  362. this.baseUrl = request['baseUrl'] || ''
  363. },
  364. goForgetPassword () {
  365. let url = `/reset/forgetPasswordValidationAccount?${this.queryLink}`
  366. document.getElementById('forget').href = url
  367. },
  368. // 去注册
  369. goRegister () {
  370. document.getElementById('register').href = `/register/enterpriseRegistration?${this.queryLink}`
  371. },
  372. // 获取验证码
  373. getCode () {
  374. var imgSrc = document.getElementById('captchaImage')
  375. imgSrc.setAttribute('src', '/sso/login/checkCode?timestamp=' + (new Date()).valueOf())
  376. },
  377. // 登录
  378. isLogin (flag) {
  379. this.isShowLoading = true
  380. if (!this.login.username) {
  381. this.isShowLoading = false
  382. this.$message.error('请填写账号')
  383. } else if (!this.login.password) {
  384. this.isShowLoading = false
  385. this.$message.error('请填写密码')
  386. } else {
  387. let param = new FormData()
  388. param.append('username', this.login.username)
  389. param.append('password', this.login.password)
  390. param.append('captcha', this.login.captcha)
  391. param.append('spaceUU', this.login.spaceUU)
  392. param.append('appId', this.appId)
  393. param.append('returnUrl', this.returnUrl)
  394. param.append('baseUrl', this.baseUrl)
  395. let config = {
  396. headers: {'Content-Type': 'multipart/form-data'}
  397. }
  398. this.$http.post('/sso/login', param, config)
  399. .then(response => {
  400. this.isShowLoading = false
  401. if (response.data.success) {
  402. if (response.data.content.spaces) {
  403. // 弹框让用户选择企业
  404. this.$store.commit('login/chooseRegisterEnterprise/GET_ENTERPRISE_SUCCESS', response.data.content.spaces)
  405. this.dialogVisible = flag
  406. } else if (response.data.content.loginUrls) {
  407. // 遍历登录url循环让各应用登录(需要跨域)
  408. let param = response.data.content.data
  409. let a = ''
  410. for (let n in param) {
  411. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  412. }
  413. let params = a.substr(0, a.length - 1)
  414. this.isShowLoading = true
  415. if (response.data.content.currentUrl) {
  416. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  417. name: 'successCallback',
  418. timeout: 3000
  419. }, (err, data) => {
  420. if (err) {
  421. this.$message.error('登录超时,请重试')
  422. this.isShowLoading = false
  423. throw err
  424. } else {
  425. this.loginOther(response, params)
  426. }
  427. })
  428. } else {
  429. this.loginOther(response, params, 3000)
  430. }
  431. }
  432. } else {
  433. this.$message.error(response.data)
  434. var count = response.data.errorCount
  435. if (count < 3) {
  436. this.showCheckCode = false
  437. this.isLoginDisabled = false
  438. } else if (count >= 5) {
  439. this.$message.error('密码错误次数已达上限,今日无法登陆')
  440. this.isLoginDisabled = true
  441. this.showCheckCode = false
  442. } else if (count >= 3 && count < 5) {
  443. this.getCode()
  444. if (count === 3) {
  445. this.$message.error('当前已输错密码3次,若达到5次今日将无法登陆')
  446. }
  447. this.showCheckCode = true
  448. this.isLoginDisabled = false
  449. }
  450. return Promise.reject(response.data)
  451. }
  452. }).catch(err => {
  453. this.isShowLoading = false
  454. let _this = this
  455. setTimeout(function () {
  456. _this.getCode()
  457. }, 100)
  458. this.$message.error(err.errMsg)
  459. })
  460. }
  461. },
  462. chooseOneEnterprise (flag, spaceUU) {
  463. this.login.spaceUU = spaceUU
  464. this.dialogVisible = false
  465. if (this.activeTab === 0) {
  466. this.isLogin(flag)
  467. } else if (this.activeTab === 1) {
  468. this.fastToLogin(flag)
  469. }
  470. if (this.appId === 'mall' || this.appId === 'home') {
  471. if (this.checked) {
  472. this.setCookie(this.login.username, this.login.password, 7)
  473. } else {
  474. this.clearCookie()
  475. }
  476. }
  477. },
  478. // 短信快捷登录
  479. fastToLogin (flag) {
  480. this.isShowLoading = true
  481. if (!this.fastLogin.mobile) {
  482. this.isShowLoading = false
  483. this.$message.error('请填写手机号')
  484. } else {
  485. let param = new FormData()
  486. param.append('mobile', this.fastLogin.mobile)
  487. param.append('code', this.fastLogin.code)
  488. param.append('appId', this.appId)
  489. param.append('token', this.token)
  490. param.append('spaceUU', this.login.spaceUU)
  491. param.append('returnUrl', this.returnUrl)
  492. param.append('baseUrl', this.baseUrl)
  493. let config = {
  494. headers: {'Content-Type': 'multipart/form-data'}
  495. }
  496. this.$http.post('/sso/login/sms', param, config)
  497. .then(response => {
  498. this.isShowLoading = false
  499. if (response.data.success) {
  500. if (response.data.content.spaces) {
  501. // 弹框让用户选择企业
  502. this.$store.commit('login/chooseRegisterEnterprise/GET_ENTERPRISE_SUCCESS', response.data.content.spaces)
  503. this.dialogVisible = flag
  504. } else if (response.data.content.loginUrls) {
  505. // 遍历登录url循环让各应用登录(需要跨域)
  506. let param = response.data.content.data
  507. let a = ''
  508. for (let n in param) {
  509. a += (n + '=' + encodeURIComponent(param[n]) + '&')
  510. }
  511. let params = a.substr(0, a.length - 1)
  512. this.isShowLoading = true
  513. if (response.data.content.currentUrl) {
  514. this.$jsonp(`${response.data.content.currentUrl}?${params}`, {
  515. name: 'successCallback',
  516. timeout: 3000
  517. }, (err, data) => {
  518. if (err) {
  519. this.$message.error('登录超时,请重试')
  520. this.isShowLoading = false
  521. throw err
  522. } else {
  523. this.loginOther(response, params)
  524. }
  525. })
  526. } else {
  527. this.loginOther(response, params, 3000)
  528. }
  529. }
  530. } else {
  531. this.$message.error(response.data)
  532. return Promise.reject(response.data)
  533. }
  534. }).catch(err => {
  535. this.isShowLoading = false
  536. let _this = this
  537. setTimeout(function () {
  538. _this.getCode()
  539. }, 100)
  540. this.$message.error(err.errMsg)
  541. })
  542. }
  543. },
  544. getJsonp: function (url, timeout = 500) {
  545. return new Promise((resolve, reject) => {
  546. this.$jsonp(url, {
  547. name: 'successCallback',
  548. timeout: timeout
  549. }, function (err, data) {
  550. if (err) {
  551. reject(err)
  552. throw err
  553. } else {
  554. resolve(data)
  555. }
  556. })
  557. })
  558. },
  559. crossAfter (url) {
  560. try {
  561. window.location.href = url
  562. } catch (err) {
  563. console.log(err)
  564. }
  565. },
  566. loginOther (response, a, timeout) {
  567. const crossAfter = this.crossAfter
  568. let promises = []
  569. for (let i in response.data.content.loginUrls) {
  570. promises.push(this.getJsonp(`${response.data.content.loginUrls[i]}?${a}`))
  571. }
  572. Promise.all(promises).then(() => {
  573. crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
  574. }).catch(() => {
  575. crossAfter(response.data.content.returnUrl || 'http://www.ubtob.com', timeout)
  576. })
  577. },
  578. // 设置cookie
  579. setCookie (cName, cPwd, exdays) {
  580. let exdate = new Date()
  581. exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays)
  582. window.document.cookie = 'userName' + '=' + cName + ';path=/;expires=' + exdate.toGMTString()
  583. window.document.cookie = 'userPwd' + '=' + cPwd + ';path=/;expires=' + exdate.toGMTString()
  584. },
  585. // 读取cookies
  586. getCookie () {
  587. if (document.cookie.length > 0) {
  588. let arr = document.cookie.split(';')
  589. for (var i = 0; i < arr.length; i++) {
  590. let arr2 = arr[i].split('=')
  591. if (arr2[0].trim() === 'userName') {
  592. this.login.username = arr2[1]
  593. }
  594. if (arr2[0].trim() === 'userPwd') {
  595. this.login.password = arr2[1]
  596. }
  597. if (this.login.username && this.login.username) {
  598. this.checked = true
  599. }
  600. }
  601. }
  602. },
  603. // 清除cookie
  604. clearCookie () {
  605. this.setCookie('', '', -1)
  606. },
  607. // 获取校验码
  608. getCheckCode () {
  609. this.isShowLoading = true
  610. if (!this.fastLogin.mobile) {
  611. this.isShowLoading = false
  612. this.$message.error('请先填写手机号')
  613. } else {
  614. if (this.checkMobile) {
  615. this.$http.get(`/sso/login/sendSmsCode`, {params: {mobile: this.fastLogin.mobile}})
  616. .then(response => {
  617. this.isShowLoading = false
  618. if (response.data) {
  619. if (response.data.success) {
  620. this.token = response.data.content.token
  621. this.$message({
  622. message: '验证码已经发送到您的手机,请注意查收',
  623. type: 'success'
  624. })
  625. this.sendLoginCode = false
  626. this.login_time = 60
  627. var loginTime = setInterval(() => {
  628. this.login_time--
  629. if (this.login_time <= 0) {
  630. this.sendLoginCode = true
  631. clearInterval(loginTime)
  632. }
  633. }, 1000)
  634. } else {
  635. this.$message.error(response.data.errMsg)
  636. }
  637. } else {
  638. return Promise.reject(response.data)
  639. }
  640. }).catch(err => {
  641. this.isShowLoading = false
  642. this.$message.error(err.errMsg)
  643. })
  644. } else {
  645. this.isShowLoading = false
  646. }
  647. }
  648. }
  649. }
  650. }
  651. </script>
  652. <style lang="scss" type="text/scss" scoped>
  653. @import '~assets/scss/mixins';
  654. @import '~assets/scss/variables';
  655. .x-navbar{
  656. height: 80px;
  657. line-height: 80px;
  658. margin: 0;
  659. .container{
  660. position: relative;
  661. width: 990px!important;
  662. height: 80px;
  663. .navbar-header{
  664. height: 80px;
  665. line-height: 80px;
  666. }
  667. a.navbar-brand{
  668. overflow: hidden;
  669. padding: 0px;
  670. height: inherit;
  671. line-height: inherit;
  672. font-family: "\5FAE\8F6F\96C5\9ED1";
  673. font-size: 24px;
  674. font-weight: 400;
  675. color: #888;
  676. img{
  677. margin: 28px 8px 0 0;
  678. max-width: 80px;
  679. max-height: 27px;
  680. vertical-align: middle;
  681. float: left;
  682. }
  683. span{
  684. float: left;
  685. }
  686. }
  687. .collapse{
  688. a{
  689. padding-left: 12px;
  690. margin-right: 10px;
  691. color: #666;
  692. outline: 0;
  693. border-left: 1px solid #ddd;
  694. &:first-child{
  695. border-width: 0;
  696. }
  697. }
  698. }
  699. }
  700. }
  701. .x-container{
  702. position: relative;
  703. height: 475px;
  704. div.link-go {
  705. text-align: right;
  706. margin-top: 7px;
  707. a{
  708. font-size: 12px;
  709. color: #2d8cf0;
  710. background: 0 0;
  711. text-decoration: none;
  712. outline: 0;
  713. cursor: pointer;
  714. transition: color .2s ease;
  715. }
  716. a.first{
  717. float: left;
  718. margin-top: 2px;
  719. font-size: 12px;
  720. }
  721. a.change{
  722. margin:2px 0 0 50px;
  723. float: left;
  724. font-size: 12px;
  725. }
  726. }
  727. /*登录弹出框*/
  728. .x-floating {
  729. position: fixed;
  730. top: 80px;
  731. left: 50%;
  732. z-index: 100000;
  733. opacity: 1;
  734. -webkit-transition: all .5s;
  735. -moz-transition: all .5s;
  736. transition: all .5s;
  737. }
  738. .x-list {
  739. width: 60%;
  740. height:420px;
  741. margin-left: -30%;
  742. background: #fff;
  743. border-top: 1px solid #e7e7e7;
  744. cursor: pointer;
  745. .x-list-header {
  746. padding: 10px 20px;
  747. background: #e0e0e0;
  748. height: 42px;
  749. line-height: 21px;
  750. font-size: 14px;
  751. font-weight: 700;
  752. color: #505050;
  753. }
  754. .x-list-content{
  755. overflow-y: auto;
  756. height:375px;
  757. ul{
  758. margin-bottom: 0;
  759. li{
  760. display:inline-block;
  761. padding: 10px 20px;
  762. width: 33%;
  763. overflow: hidden;
  764. white-space: nowrap;
  765. text-overflow: ellipsis;
  766. height: 42px;
  767. line-height: 21px;
  768. font-size: 12px;
  769. color: #505050;
  770. border-bottom: 1px solid #e7e7e7;
  771. &:hover{
  772. background: #e7e7e7;
  773. }
  774. }
  775. }
  776. }
  777. .x-list .x-list-header, .x-list li {
  778. padding: 10px 20px;
  779. border-bottom: 1px solid #e7e7e7;
  780. }
  781. }
  782. .x-floating.in {
  783. top: 80px;
  784. opacity: 1;
  785. }
  786. .x-banner-wrap {
  787. position: absolute;
  788. left: 0;
  789. top: 0;
  790. width: 100%;
  791. height: 475px;
  792. .x-banner {
  793. position: relative;
  794. overflow: auto;
  795. height: 475px;
  796. text-align: center;
  797. li{
  798. width: 100%;
  799. height: 475px;
  800. .inner{
  801. height: 100%;
  802. }
  803. }
  804. }
  805. }
  806. .x-login-wrap{
  807. position: absolute;
  808. top: 10px;
  809. right: 50%;
  810. margin-right: -495px;
  811. height: 475px;
  812. z-index: 5;
  813. .x-login {
  814. position: relative;
  815. top: 40px;
  816. width: 346px;
  817. background: #fff;
  818. overflow: visible;
  819. z-index: 4;
  820. .x-login-form, .x-login-qrcode {
  821. padding: 20px;
  822. .btn{
  823. background: #5078cb;
  824. color: #fff;
  825. font-weight: 700;
  826. letter-spacing: 4px;
  827. border-radius: 0;
  828. }
  829. .x-has-feedback-right {
  830. float: right;
  831. display: inline-block;
  832. a{
  833. color: #5078cb;
  834. }
  835. }
  836. .x-has-feedback-left {
  837. position: relative;
  838. .x-input {
  839. padding-left: 30px;
  840. line-height: 18px;
  841. color: #555;
  842. border-color: #ccc;
  843. border-radius: 0;
  844. box-shadow: none;
  845. }
  846. i.fa{
  847. position: absolute;
  848. top: 2px;
  849. left: 0;
  850. z-index: 2;
  851. display: block;
  852. width: 30px;
  853. height: 34px;
  854. line-height: 34px;
  855. text-align: center;
  856. pointer-events: none;
  857. color: #999;
  858. font-size: 18px;
  859. }
  860. }
  861. i.fa-keyboard-o{
  862. position: absolute;
  863. right: 10px;
  864. top: 10px;
  865. }
  866. i.fa-arrow-circle-o-right{
  867. margin-right: 5px;
  868. font-size: 12px;
  869. color: #5078cb;
  870. }
  871. .warn-text-area{
  872. margin-top: 5px;
  873. font-size: 13px;
  874. color: #000;
  875. }
  876. .text-position {
  877. overflow: hidden;
  878. .page-part {
  879. float: left;
  880. margin-bottom: 0;
  881. .el-checkbox {
  882. margin: 0;
  883. span.el-checkbox__inner{
  884. width: 14px;
  885. height: 14px;
  886. }
  887. }
  888. }
  889. .forget {
  890. float: right;
  891. color: #2d8cf0;
  892. }
  893. }
  894. }
  895. .x-login-qrcode{
  896. display: none;
  897. }
  898. }
  899. }
  900. }
  901. .footer{
  902. padding: 50px 0;
  903. }
  904. </style>