feat: 个人中心与用户管理更新用户名时同步到header

This commit is contained in:
Argo Zhang 2019-08-18 00:26:27 +08:00
parent ca7eb3dde5
commit 34b4c45792
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
4 changed files with 6 additions and 4 deletions

View File

@ -10,7 +10,7 @@
<div class="nav-header flex-fill align-items-center"> <div class="nav-header flex-fill align-items-center">
<a href="~/Admin/Profiles"> <a href="~/Admin/Profiles">
<img src="@Url.Content(Model.Icon)" /> <img src="@Url.Content(Model.Icon)" />
<span class="d-inline-block font-weight-bold flex-fill">@Model.DisplayName</span> <span class="username d-inline-block text-truncate font-weight-bold flex-fill">@Model.DisplayName</span>
</a> </a>
</div> </div>
<!-- sidebar menu start--> <!-- sidebar menu start-->

View File

@ -136,8 +136,10 @@ aside {
left: 4px; left: 4px;
} }
aside .nav-header span { aside .nav-header .username {
font-size: 1rem; font-size: 1rem;
max-width: 120px;
vertical-align: middle;
} }
aside .nav-link span { aside .nav-link span {

View File

@ -90,7 +90,7 @@
url: Profiles.url, method: "put", data: data, title: "修改用户显示名称", url: Profiles.url, method: "put", data: data, title: "修改用户显示名称",
callback: function (result) { callback: function (result) {
if (result) { if (result) {
$('#userDisplayName').text(data.DisplayName); $('#userDisplayName, .nav-header .username').text(data.DisplayName);
} }
} }
}); });

View File

@ -75,7 +75,7 @@ $(function () {
}, },
callback: function (data) { callback: function (data) {
if (data && data.success && data.oper === 'save' && data.data.UserName === $('#userDisplayName').attr('data-userName')) { if (data && data.success && data.oper === 'save' && data.data.UserName === $('#userDisplayName').attr('data-userName')) {
$('#userDisplayName').text(data.data.DisplayName); $('#userDisplayName, .nav-header .username').text(data.data.DisplayName);
} }
if (data && data.oper === 'create') { if (data && data.oper === 'create') {
$('#userName').prop('readonly', false).removeClass("ignore"); $('#userName').prop('readonly', false).removeClass("ignore");