修复BUG:Demo工程登录用户图标文件路径错误

This commit is contained in:
Argo-Surface 2019-02-23 12:34:07 +08:00
parent b22af2ede4
commit c59ac37185
2 changed files with 8 additions and 1 deletions

View File

@ -64,6 +64,7 @@ namespace Bootstrap.Client.DataAccess
var platName = dicts.FirstOrDefault(d => d.Category == "应用程序" && d.Code == ConfigurationManager.AppSettings["AppId"])?.Name;
return dicts.FirstOrDefault(d => d.Category == platName && d.Name == name)?.Code ?? $"{name}{defaultValue}";
}
/// <summary>
/// 获得网站设置中的当前样式
/// </summary>
@ -73,5 +74,11 @@ namespace Bootstrap.Client.DataAccess
var theme = RetrieveDicts().Where(d => d.Name == "使用样式" && d.Category == "当前样式" && d.Define == 0).FirstOrDefault()?.Code;
return theme == null ? string.Empty : theme.Equals("site.css", StringComparison.OrdinalIgnoreCase) ? string.Empty : theme;
}
/// <summary>
/// 获取头像路径
/// </summary>
/// <returns></returns>
public static string RetrieveIconFolderPath() => (RetrieveDicts().FirstOrDefault(d => d.Name == "头像路径" && d.Category == "头像地址" && d.Define == 0) ?? new BootstrapDict() { Code = "~/images/uploader/" }).Code;
}
}

View File

@ -18,7 +18,7 @@ namespace Bootstrap.Client.Models
public HeaderBarModel(IIdentity identity)
{
var user = UserHelper.RetrieveUserByUserName(identity.Name);
Icon = $"{ConfigurationManager.AppSettings["AuthHost"]}/{user.Icon.TrimStart('~', '/')}";
Icon = $"{ConfigurationManager.AppSettings["AuthHost"]}/{DictHelper.RetrieveIconFolderPath().Trim('~', '/')}/{user.Icon}";
DisplayName = user.DisplayName;
UserName = user.UserName;
SettingsUrl = DictHelper.RetrieveSettingsUrl();