Merge pull request 'fix : 修复loading加载' (#5) from dj into master

Reviewed-on: http://git.feashow.cn/clay/mosr-web/pulls/5
This commit is contained in:
2024-03-05 13:54:52 +00:00
2 changed files with 11 additions and 6 deletions

View File

@@ -8,14 +8,15 @@ const router = useRouter();
const tokenValue = reactive(router.currentRoute.value.query.token) const tokenValue = reactive(router.currentRoute.value.query.token)
console.log('tokenValue', tokenValue) console.log('tokenValue', tokenValue)
const init = () => { const init = () => {
// console.log('authStore.casToken(tokenValue)',authStore.casToken(tokenValue)) const loading = ElLoading.service({
lock: true,
text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
})
if (authStore.casToken(tokenValue)) { if (authStore.casToken(tokenValue)) {
// ElLoading.service({text: '正在加载系统资源', background: '#409eff', lock: true}) loading.close()
router.push('/') router.push('/')
} }
// else {
// router.push('/login')
// }
} }
init() init()
</script> </script>

View File

@@ -66,10 +66,14 @@ const handleLogin = (instance) => {
if(!instance) return if(!instance) return
instance.validate( async (valid, fields)=>{ instance.validate( async (valid, fields)=>{
if (!valid) return if (!valid) return
ElLoading.service({
lock: true,
text: '登录中...',
background: 'rgba(0, 0, 0, 0.7)',
})
// 发送请求 // 发送请求
await authStore.userLogin(loginForm).then(res=>{ await authStore.userLogin(loginForm).then(res=>{
if(res) { if(res) {
ElLoading.service({text: '正在加载系统资源',background: '#409eff',lock: true})
router.push('/') router.push('/')
}else { }else {
getCode() getCode()