from admin import Admin
from atm import ATM
import time
class HomePage:
def __init__(self):
self.allUserD = {} # 使用字典存储数据
self.atm = ATM(self.allUserD)
self.admin = Admin() # 管理员开机界面
def saveUser(self):
self.allUserD.update(self.atm.alluser)
print("数据存盘成功")
# 程序的入口
def main(self):
self.admin.printAdminView()
resL = self.admin.adminOption()
if not resL:
while True:
self.admin.printsysFunctionView()
option = input("请输入您的操作:\n")
if option not in ("1", "2", "3", "4", "5",
"6", "7", "S", "Q", "q"):
print("输入操作项有误,请仔细确认!")
time.sleep(1)
#********** Begin **********
# 开户
if option == "1":
self.atm.creatUser()
# 查询
elif option == "2":
self.atm.searchUser()
# 取款
elif option == "3":
self.atm.getMoney()
# 存储
elif option == "4":
self.atm.saveMoney()
# 转账
elif option == "5":
self.atm.transferMoney()
# 锁定
elif option == "6":
self.atm.lockCard()
# 解锁
elif option == "7":
self.atm.unlockCard()
#********** End **********
elif option.upper() == "Q":
if not (self.admin.adminOption()):
self.saveUser()
print('退出系统')
return -1
if __name__ == "__main__":
homepage = Ho