From 017d6412a675a989caa8b7adeb65fc57e1bcc5bc Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 21 八月 2023 14:54:42 +0800
Subject: [PATCH] 修改系统登录功能

---
 /dev/null                     |   31 ---------------
 DataLoader/MainWindow.xaml.cs |   18 ++++----
 DataLoader/Model/Common.cs    |   46 +++++++++++++++++++++++
 DataLoader/CS/Importor.cs     |    4 +-
 DataLoader/CS/NtstWeb.cs      |    8 ++--
 DataLoader/DataLoader.csproj  |    2 
 DataLoader/Model/SysMeta.cs   |    8 ----
 DataLoader/htmls/login.html   |    2 
 8 files changed, 63 insertions(+), 56 deletions(-)

diff --git a/DataLoader/CS/Importor.cs b/DataLoader/CS/Importor.cs
index 4a3960f..0a2b319 100644
--- a/DataLoader/CS/Importor.cs
+++ b/DataLoader/CS/Importor.cs
@@ -87,12 +87,12 @@
 
             vd.Meta = new SysMeta();
             vd.Meta.name = fi.Name;
-            vd.Meta.dirid = Tool.DirId;
+            vd.Meta.dirid = Common.DirId;
             vd.Meta.depid = 1;
             vd.Meta.verid = 0;
             vd.Meta.type = fi.Extension.ToLower().Replace(".", "");
             vd.Meta.sizes = Tools.SizeToMb(fi.Length);
-            vd.Meta.create_user = Tool.UserId;
+            vd.Meta.create_user = Common.UserId;
         }
 
         public static void ImportFiles(ObservableCollection<ViewData> viewDatas, string target, int start)
diff --git a/DataLoader/CS/NtstWeb.cs b/DataLoader/CS/NtstWeb.cs
index 1d5cea5..8affa3c 100644
--- a/DataLoader/CS/NtstWeb.cs
+++ b/DataLoader/CS/NtstWeb.cs
@@ -21,13 +21,13 @@
         {
             if (uid > 0 && !string.IsNullOrEmpty(token))
             {
-                Tool.UserId = uid;
-                Tool.Uname = uname;
-                Tool.Token = token;
+                Common.UserId = uid;
+                Common.Uname = uname;
+                Common.Token = token;
 
                 owner.Dispatcher.Invoke(new Action(delegate
                 {
-                    Tool.Owner.SetLoginInfo();
+                    Common.Owner.SetLoginInfo();
                 }));
             }
         }
diff --git a/DataLoader/DataLoader.csproj b/DataLoader/DataLoader.csproj
index ca386db..12b9fa7 100644
--- a/DataLoader/DataLoader.csproj
+++ b/DataLoader/DataLoader.csproj
@@ -138,7 +138,7 @@
     <Compile Include="CS\MetaHelper.cs" />
     <Compile Include="CS\StaticData.cs" />
     <Compile Include="CS\Tools.cs" />
-    <Compile Include="Model\Tool.cs" />
+    <Compile Include="Model\Common.cs" />
     <Compile Include="CS\ModelHandler.cs" />
     <Compile Include="CS\NtstWeb.cs" />
     <Compile Include="CS\PostgreHelper.cs" />
diff --git a/DataLoader/MainWindow.xaml.cs b/DataLoader/MainWindow.xaml.cs
index 2fb2d78..b061622 100644
--- a/DataLoader/MainWindow.xaml.cs
+++ b/DataLoader/MainWindow.xaml.cs
@@ -68,7 +68,7 @@
 
         private void Window_Loaded(object sender, RoutedEventArgs e)
         {
-            Tool.Owner = this;
+            Common.Owner = this;
 
             this.btnLoad.IsEnabled = false;
             this.btnImport.IsEnabled = false;
@@ -84,18 +84,18 @@
         // 璁剧疆
         private void Login_MouseLeftButtonDown(object sender, RoutedEventArgs e)
         {
-            //win = new LoginWin();
-            //this.Hide();
-            //win.Show();
+            win = new LoginWin();
+            this.Hide();
+            win.Show();
 
-            SetLoginInfo();
+            //SetLoginInfo();
             //GdalHelper.Instance.ReadTiff();
         }
 
         public void SetLoginInfo()
         {
-            //if (win != null) win.Close();
-            //this.Show();
+            if (win != null) win.Close();
+            this.Show();
 
             //this.tbUid.Text = Tool.UserId.ToString();
             //this.tbToken.Text = Tool.Token;
@@ -103,8 +103,8 @@
             string uidStr = this.tbUid.Text.Trim();
             string didStr = this.tbDir.Text.Trim();
 
-            int.TryParse(uidStr, out Tool.UserId);
-            int.TryParse(didStr, out Tool.DirId);
+            int.TryParse(uidStr, out Common.UserId);
+            int.TryParse(didStr, out Common.DirId);
 
             this.btnLoad.IsEnabled = true;
             this.btnImport.IsEnabled = true;
diff --git a/DataLoader/Model/Common.cs b/DataLoader/Model/Common.cs
new file mode 100644
index 0000000..846a624
--- /dev/null
+++ b/DataLoader/Model/Common.cs
@@ -0,0 +1,46 @@
+锘縰sing Npgsql;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data.Common;
+using System.IO;
+using System.Linq;
+using System.Reflection;
+using System.Runtime.InteropServices.ComTypes;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace DataLoader.Model
+{
+    /// <summary>
+    /// 閫氱敤绫�
+    /// </summary>
+    public class Common
+    {
+        /// <summary>
+        /// 鎵�鏈夎��
+        /// </summary>
+        public static MainWindow Owner = null;
+
+        /// <summary>
+        /// 鐢ㄦ埛ID
+        /// </summary>
+        public static int UserId = 1;
+
+        /// <summary>
+        /// 鐢ㄦ埛鍚�
+        /// </summary>
+        public static string Uname = "admin";
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public static int DirId = 1;
+
+        /// <summary>
+        /// 浠ょ墝
+        /// </summary>
+        public static string Token = null;
+    }
+}
diff --git a/DataLoader/Model/SysMeta.cs b/DataLoader/Model/SysMeta.cs
index 51ffe37..494cfff 100644
--- a/DataLoader/Model/SysMeta.cs
+++ b/DataLoader/Model/SysMeta.cs
@@ -1,12 +1,4 @@
 锘縰sing System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices.ComTypes;
-using System.Security.Cryptography;
-using System.Security.Policy;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Controls;
 
 namespace DataLoader.Model
 {
diff --git a/DataLoader/Model/Tool.cs b/DataLoader/Model/Tool.cs
deleted file mode 100644
index b4432e9..0000000
--- a/DataLoader/Model/Tool.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-锘縰sing Npgsql;
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data.Common;
-using System.IO;
-using System.Linq;
-using System.Reflection;
-using System.Runtime.InteropServices.ComTypes;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace DataLoader.Model
-{
-    public class Tool
-    {
-        public static MainWindow Owner = null;
-
-        public static readonly string BaseDir = AppDomain.CurrentDomain.BaseDirectory;
-
-        public static int UserId = 1;
-
-        public static string Uname = "admin";
-
-        public static int DirId = 1;
-
-        public static string Token = "";
-
-    }
-}
diff --git a/DataLoader/htmls/login.html b/DataLoader/htmls/login.html
index 621c894..0beb1ed 100644
--- a/DataLoader/htmls/login.html
+++ b/DataLoader/htmls/login.html
@@ -41,7 +41,7 @@
     </section>
   </div>
   <script>
-    var url = "http://127.0.0.1:12316/server/";
+      var url = "http://127.0.0.1:9000/MoonServer/";
 
     var isBusy = false;
 

--
Gitblit v1.9.3