diff --git a/pythonProject/order_data.txt b/pythonProject/order_data.txt index 3f7cebd..8b13789 100644 --- a/pythonProject/order_data.txt +++ b/pythonProject/order_data.txt @@ -1,4 +1 @@ -按摩 - 8号技师 -1001, 按摩 -按摩 - 88号技师 diff --git a/pythonProject/technician_data.txt b/pythonProject/technician_data.txt new file mode 100644 index 0000000..823cf07 --- /dev/null +++ b/pythonProject/technician_data.txt @@ -0,0 +1,4 @@ +6鍙锋妧甯 +8鍙锋妧甯 +66鍙锋妧甯 +88鍙锋妧甯 \ No newline at end of file diff --git a/pythonProject/zs1.py b/pythonProject/zs1.py index aa28775..33d2e81 100644 --- a/pythonProject/zs1.py +++ b/pythonProject/zs1.py @@ -40,7 +40,7 @@ class FootSpaManagementSystem: if username == admin_username and password == admin_password: messagebox.showinfo("绠$悊鍛樼櫥褰", "鐧诲綍鎴愬姛锛") - # Add code here for handling admin login success + self.show_admin_options() else: messagebox.showerror("绠$悊鍛樼櫥褰", "鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒") @@ -65,6 +65,55 @@ class FootSpaManagementSystem: self.login_button = tk.Button(self.admin_login_window, text="鐧诲綍", command=self.admin_login) self.login_button.pack() + def show_user_info(self): + user_info_window = tk.Toplevel(self.root) + user_info_window.title("鐢ㄦ埛淇℃伅") + + with open(self.user_data_file, "r") as file: + user_data = file.readlines() + + if user_data: + for user_info in user_data: + username = user_info.strip() + label = tk.Label(user_info_window, text=username) + label.pack() + else: + label = tk.Label(user_info_window, text="鏆傛棤鐢ㄦ埛淇℃伅") + label.pack() + + def show_technician_info(self): + technician_info_window = tk.Toplevel(self.root) + technician_info_window.title("Technician Information") + + technician_data_file = "technician_data.txt" # 鎶甯堟暟鎹枃浠剁殑璺緞 + try: + with open(technician_data_file, "r") as file: + technician_data = file.readlines() + if technician_data: + for tech_info in technician_data: + technician_name, technician_specialty = tech_info.strip().split(",") # 鍋囪鏁版嵁浠ラ楀彿鍒嗛殧 + label = tk.Label(technician_info_window, + text=f"濮撳悕锛歿technician_name}锛屼笓闀匡細{technician_specialty}") + label.pack() + else: + label = tk.Label(technician_info_window, text="鏆傛棤鎶甯堜俊鎭") + label.pack() + except FileNotFoundError: + label = tk.Label(technician_info_window, text="鎵句笉鍒版妧甯堟暟鎹枃浠") + label.pack() + + + def show_admin_options(self): + self.admin_login_window.pack_forget() + self.admin_options_window = tk.Frame(self.root) + self.admin_options_window.pack() + + self.user_info_button = tk.Button(self.admin_options_window, text="鏌ョ湅鐢ㄦ埛淇℃伅", command=self.show_user_info) + self.user_info_button.pack() + + self.technician_info_button = tk.Button(self.admin_options_window, text="鏌ョ湅鎶甯堜俊鎭",command=self.show_technician_info) + self.technician_info_button.pack() + #鐢ㄦ埛娉ㄥ唽鍑芥暟 def register_user(self): username = self.username_entry.get()