From ee927c9da7845e0c913de1cfb4355197ba55a09f Mon Sep 17 00:00:00 2001 From: shanj <18996038927@163.com> Date: Tue, 26 Mar 2024 00:33:44 +0800 Subject: [PATCH] =?UTF-8?q?webtest=E6=94=AF=E6=8C=81=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebTest/App.xaml.cs | 8 ++++---- WebTest/MainWindow.xaml | 3 ++- WebTest/MainWindow.xaml.cs | 1 + WebTest/appSettings.json | 3 ++- 4 files changed, 9 insertions(+), 6 deletions(-) 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