fix: 返回前台防止多次跳转

This commit is contained in:
Argo-Tianyi 2022-01-27 00:18:11 +08:00
parent 4035c96c83
commit 82cc6befaa
2 changed files with 4 additions and 4 deletions

View File

@ -65,11 +65,11 @@ public class Index : ComponentBase
private void Redirect() private void Redirect()
{ {
var url = Navigation.ToBaseRelativePath(Navigation.Uri).TrimEnd('/');
var routes = GetType().GetCustomAttributes<RouteAttribute>(); var routes = GetType().GetCustomAttributes<RouteAttribute>();
if (!routes.Any(i => i.Template.Equals(url, StringComparison.OrdinalIgnoreCase))) if (routes.Any(i => $"{Navigation.BaseUri}{i.Template}".TrimEnd('/').Equals(Url, StringComparison.OrdinalIgnoreCase)))
{ {
Url = "Admin/Index";
}
Navigation.NavigateTo(Url, true); Navigation.NavigateTo(Url, true);
} }
} }
}

View File

@ -43,7 +43,7 @@ public static class LoginHelper
var appUrl = dictService.GetHomeUrlByAppId(appId); var appUrl = dictService.GetHomeUrlByAppId(appId);
if (!string.IsNullOrEmpty(appUrl)) if (!string.IsNullOrEmpty(appUrl))
{ {
returnUrl = string.Format(appUrl, schema, host); returnUrl = string.Format(appUrl, schema, host).TrimEnd('/');
} }
} }
} }