86 lines
2.3 KiB
Python
86 lines
2.3 KiB
Python
|
import os
|
||
|
import time
|
||
|
|
||
|
users=['as','Water','Ryan']
|
||
|
passwords=['asdfghjkl','1234','awsd123']
|
||
|
|
||
|
def menu():
|
||
|
print('''
|
||
|
**********操作界面***********
|
||
|
1.查看会员信息
|
||
|
2.添加会员信息
|
||
|
3.删除会员信息
|
||
|
4.退出
|
||
|
''')
|
||
|
z=input()
|
||
|
os.system('cls')
|
||
|
Pan(z)
|
||
|
|
||
|
def printuser():
|
||
|
print('会员用户有:')
|
||
|
print(users)
|
||
|
def back():
|
||
|
print('按b返回,其他键退出')
|
||
|
back=input()
|
||
|
os.system('cls')
|
||
|
if back=='b':
|
||
|
menu()
|
||
|
else:
|
||
|
exit()
|
||
|
def Pan(zero):
|
||
|
if zero=='1':
|
||
|
printuser()
|
||
|
back()
|
||
|
elif zero=='2':
|
||
|
addname=input('添加用户名:')
|
||
|
addpassword=input('添加密 码:')
|
||
|
if addname not in users:
|
||
|
if addname=='':
|
||
|
print('用户名不能为空')
|
||
|
else:
|
||
|
users.append(addname)
|
||
|
passwords.append(addpassword)
|
||
|
print('添加成功')
|
||
|
printuser()
|
||
|
else:
|
||
|
print('用户名已经存在')
|
||
|
back()
|
||
|
elif zero=='3':
|
||
|
removename=input('删除用户名:')
|
||
|
if removename in users:
|
||
|
index=users.index(removename)
|
||
|
users.remove(removename)
|
||
|
passwords.remove(passwords[index])
|
||
|
print('删除成功')
|
||
|
printuser()
|
||
|
else:
|
||
|
print('没有该用户')
|
||
|
back()
|
||
|
elif zero=='4':
|
||
|
exit()
|
||
|
def login():
|
||
|
user=input('用户名:')
|
||
|
password=input('密 码:')
|
||
|
if user=='Kun'and password=='iKun':
|
||
|
istrue=True
|
||
|
print('管理员%s成功进入登录系统界面'%user)
|
||
|
time.sleep(2)
|
||
|
os.system('cls')
|
||
|
else:
|
||
|
istrue = False
|
||
|
print('登录失败')
|
||
|
if istrue == True:
|
||
|
menu()
|
||
|
else:
|
||
|
loginerror()
|
||
|
|
||
|
def loginerror():
|
||
|
time.sleep(2)
|
||
|
os.system('cls')
|
||
|
login()
|
||
|
print('欢迎来到管理员登录界面'.center(50,'*'))
|
||
|
login()
|
||
|
|
||
|
|
||
|
os.system("pause")
|