diff --git a/WebTest/App.xaml.cs b/WebTest/App.xaml.cs index 5d1f7b7..35624d0 100644 --- a/WebTest/App.xaml.cs +++ b/WebTest/App.xaml.cs @@ -22,18 +22,18 @@ namespace WebTest protected override void OnStartup(StartupEventArgs e) { var gl = new GlobalContext(); - string userToken = string.Empty; + //string userToken = string.Empty; //齐越山鸡 - userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTc2MDk3MTY4ODk2NDUyNjA4MCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3NDIxOTYxMDF9.pt1onwf4f4QKyuT1kFWtcRw8LZo9s64CmHqrdI4fD5k"; + //userToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTc2MDk3MTY4ODk2NDUyNjA4MCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3NDIxOTYxMDF9.pt1onwf4f4QKyuT1kFWtcRw8LZo9s64CmHqrdI4fD5k"; - gl.UserToken = userToken; + var applicationPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var builder = new ConfigurationBuilder().SetBasePath(applicationPath).AddJsonFile("appSettings.json", false, true); Configuration = builder.Build(); - + gl.UserToken = Configuration.GetSection("UserToken").Value; gl.BBYWApiHost = Configuration.GetSection("BBWYApiHost").Value; gl.MDSApiHost = Configuration.GetSection("MDSApiHost").Value; IServiceCollection serviceCollection = new ServiceCollection(); diff --git a/WebTest/MainWindow.xaml b/WebTest/MainWindow.xaml index b7269aa..31a7782 100644 --- a/WebTest/MainWindow.xaml +++ b/WebTest/MainWindow.xaml @@ -10,13 +10,14 @@ CloseButtonColor="Black" MinButtonColor="Black" MaxButtonColor="Black" - Title="WebTest" Height="768" Width="1024"> + Title="AAA" Height="768" Width="1024" x:Name="w"> + diff --git a/WebTest/MainWindow.xaml.cs b/WebTest/MainWindow.xaml.cs index 1bfb19b..1bf1100 100644 --- a/WebTest/MainWindow.xaml.cs +++ b/WebTest/MainWindow.xaml.cs @@ -121,6 +121,7 @@ private string registerName = "webContext"; throw new Exception($"获取磨刀石用户信息失败 {mdsUserResponse.Msg}"); globalContext.User = mdsUserResponse.Data.Map(); + this.Title = globalContext.User.Name; globalContext.User.Token = globalContext.UserToken; globalContext.User.SonDepartmentNames = string.Empty; if (mdsUserResponse.Data.SonDepartmentList != null && mdsUserResponse.Data.SonDepartmentList.Count > 0) diff --git a/WebTest/appSettings.json b/WebTest/appSettings.json index a0d1691..0144e78 100644 --- a/WebTest/appSettings.json +++ b/WebTest/appSettings.json @@ -1,4 +1,5 @@ { "BBWYApiHost": "http://bbwytest.qiyue666.com", - "MDSApiHost": "http://mdsapi.qiyue666.com" + "MDSApiHost": "http://mdsapi.qiyue666.com", + "UserToken": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiIxMzk1NzA4MjA4NjU1MzcyMjg4IiwidGVhbUlkIjoiMTc2MDk3MTY4ODk2NDUyNjA4MCIsInNvblRlYW1JZHMiOiIiLCJleHAiOjE3NDIxOTYxMDF9.pt1onwf4f4QKyuT1kFWtcRw8LZo9s64CmHqrdI4fD5k" } \ No newline at end of file