Ejemplo n.º 1
0
        public async Task UserLoginAsync()
        {
            var input = new Input
            {
                Extens = new Dictionary <string, string> {
                    { "UserName", UserName }, { "Password", Secret.DesEncrypt(Password) }
                }
            };

            var re = await Http.PostHttpAsync <Result <JobUserEntity>, Input>($"job/login", input);

            if (re.Success)
            {
                await JSRuntime.DoVoidAsync("toastrs", new[] { "success", "登录", re.Message });

                re.Data.Password = "******";
                await SessionStorage.SetItemAsync(SessionStorage.GetId(), re.Data);

                if (Remember)
                {
                    re.Data.Password = Secret.DesEncrypt(Password);
                    await LocalStorage.SetItemAsync($"__User", re.Data);
                }

                Nav.NavigateTo("/");
            }
            else
            {
                await JSRuntime.DoVoidAsync("toastrs", new[] { "error", "登录", re.Message });
            }
        }
Ejemplo n.º 2
0
        public async Task <Result <JobUserEntity> > UserLoginAsync(string UserName, string Password)
        {
            var input = new Input
            {
                Extens = new Dictionary <string, string> {
                    { "UserName", UserName }, { "Password", Secret.DesEncrypt(Password) }
                }
            };

            return(await Http.PostHttpAsync <Result <JobUserEntity>, Input>($"job/login", input));
        }