Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我是不哪里没弄好 #3

Open
GitHubXiaoSiyuan opened this issue Jun 8, 2020 · 5 comments
Open

我是不哪里没弄好 #3

GitHubXiaoSiyuan opened this issue Jun 8, 2020 · 5 comments

Comments

@GitHubXiaoSiyuan
Copy link

image
用户名输入adi
点击提交,然后就是登陆成功,不跳转

@GitHubXiaoSiyuan
Copy link
Author

image

@Zealon159
Copy link
Owner

Zealon159 commented Jun 8, 2020

可以用抓包工具看下哈

  1. 看看请求登录接口是否正常返回
    正常返回的响应如:{"msg":"登录成功!","code":"200","success":true,...
  2. 如果正常返回,看看有无JS错误
    这个是处理登录成功跳转的函数:
     submitForm(loginForm) {
                this.$refs[loginForm].validate((valid) => {
                    if (valid) {
                        this.loading = true;
                        this.postRequest('/doLogin', this.loginForm).then(resp => {
                            this.loading = false;
                            if (resp.success) {
                                this.db.save("USER", resp.user);
                                let path = this.$route.query.redirect;
                                this.$router.replace((path == '/' || path == undefined) ? '/home' : path);
                            }
                        })
                    } else {
                        console.log('error submit!!');
                        return false;
                    }
                });
            }

如果success返回true ,正常是可以跳转到home页的

@GitHubXiaoSiyuan
Copy link
Author

{"msg":"登录成功!","code":"200","success":true,"user":{"userId":"admin","deptId":1,"deptName":null,"userName":"不懂温柔","sortNumber":99,"freezeStatus":false,"phoneNumber":"13800138000","roles":["管理员","内容编辑"],"headImgUrl":"attachment/2020-03-16/ad50149fd04f4a32a0cf8030a4a3e03a.jpeg"},"url":"system"}
2.
image

Failed to load resource: net::ERR_NETWORK_ACCESS_DENIED
[WDS] Disconnected!
sockjs.js?6707:1606 GET http://192.168.1.68:9000/sockjs-node/info?t=1591626493302 net::ERR_NETWORK_ACCESS_DENIED

@Zealon159
Copy link
Owner

看着响应结果说明接口没有问题,我这边到没有遇到这个这个问题,那个 sockjs.js 的错误貌似不会影响到跳转...

不过解决思路可以考虑用排除法,比如先确定请求结果有没有正常获取,如果正常那就往下排除,看看使用路由跳转有没有问题。

有时间你可以调试下哈,比如在post请求后打印下响应结果,然后直接路由跳转试试呢

this.postRequest('/doLogin', this.loginForm).then(resp => {
    console.log(resp);
    this.$router.replace('/home');
})

@GitHubXiaoSiyuan
Copy link
Author

好的,我的需求还没有做完,有时间我再调试

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants