前端登录的逻辑

 1 this.$refs.loginForm.validate(async (valid) => {
 2             if (valid) {
 3               this.loading = true
 4               let res = await loginApi(this.loginForm)
 5               if (String(res.code) === '1') {
 6                 localStorage.setItem('userInfo',JSON.stringify(res.data))
 7                 window.location.href= '/backend/index.html'
 8               } else {
 9                 this.$message.error(res.msg)
10                 this.loading = false
11               }
12             }
13           })

 

posted @ 2022-05-24 02:06  LiRang2022  阅读(89)  评论(0)    收藏  举报