feat: 完成个人中心默认应用设置
This commit is contained in:
parent
e79b2d3007
commit
92f615c730
|
@ -234,4 +234,10 @@ class UserService : BaseDatabase, IUser
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool SaveApp(string userName, string app)
|
||||||
|
{
|
||||||
|
Database.Update<User>("Set App = @1 Where UserName = @0", userName, app);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,13 @@ public interface IUser
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<User> GetAll();
|
List<User> GetAll();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 保存指定用户的默认 App
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userName"></param>
|
||||||
|
/// <param name="app"></param>
|
||||||
|
bool SaveApp(string userName, string app);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 认证方法
|
/// 认证方法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -33,6 +33,10 @@ public partial class Profiles
|
||||||
[NotNull]
|
[NotNull]
|
||||||
private IDict? DictService { get; set; }
|
private IDict? DictService { get; set; }
|
||||||
|
|
||||||
|
[Inject]
|
||||||
|
[NotNull]
|
||||||
|
private IUser? UserService { get; set; }
|
||||||
|
|
||||||
private List<UploadFile> PreviewFileList { get; } = new(new[] { new UploadFile { PrevUrl = "/images/Argo.png" } });
|
private List<UploadFile> PreviewFileList { get; } = new(new[] { new UploadFile { PrevUrl = "/images/Argo.png" } });
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -42,9 +46,10 @@ public partial class Profiles
|
||||||
{
|
{
|
||||||
base.OnInitialized();
|
base.OnInitialized();
|
||||||
|
|
||||||
|
var user = UserService.GetUserByUserName(AppContext.UserName);
|
||||||
CurrentUser = new User()
|
CurrentUser = new User()
|
||||||
{
|
{
|
||||||
App = AppContext.AppId,
|
App = user?.App ?? AppContext.AppId,
|
||||||
UserName = AppContext.UserName,
|
UserName = AppContext.UserName,
|
||||||
DisplayName = AppContext.DisplayName
|
DisplayName = AppContext.DisplayName
|
||||||
};
|
};
|
||||||
|
@ -65,6 +70,10 @@ public partial class Profiles
|
||||||
|
|
||||||
private Task OnSaveApp()
|
private Task OnSaveApp()
|
||||||
{
|
{
|
||||||
|
if (CurrentUser.App != null)
|
||||||
|
{
|
||||||
|
UserService.SaveApp(AppContext.UserName, CurrentUser.App);
|
||||||
|
}
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue