Browse Source

登录loading

master
han\hanst 3 days ago
parent
commit
f2011021a5
  1. 37
      src/views/common/login.vue

37
src/views/common/login.vue

@ -95,6 +95,15 @@ import { getUUID } from '@/utils'
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
// loading -
const loading = this.$loading({
lock: true,
text: '正在登录,请稍候...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.5)',
customClass: 'login-loading'
})
this.$http({
url: this.$http.adornUrl('/sys/login'),
method: 'post',
@ -124,9 +133,18 @@ import { getUUID } from '@/utils'
localStorage.setItem('refresh', "0")
localStorage.setItem('userName', this.dataForm.userName)
this.getConfigParams()
// loading
setTimeout(() => {
loading.close()
}, 500)
} else {
loading.close() // loading
this.$message.error(data.msg)
}
}).catch(error => {
loading.close() // loading
this.$message.error('登录请求失败,请检查网络连接')
})
}
})
@ -172,3 +190,22 @@ import { getUUID } from '@/utils'
}
</style>
<style lang="scss">
// loading -
.login-loading {
.el-loading-spinner {
.el-icon-loading {
font-size: 50px;
color: #17B3A3;
}
.el-loading-text {
color: #ffffff;
font-size: 16px;
font-weight: 500;
margin-top: 15px;
letter-spacing: 1px;
}
}
}
</style>
Loading…
Cancel
Save