Пример #1
0
from colorama import Fore, Style
from getpass import getpass
from service.user_service import UserService
from service.news_service import NewsService
from service.role_service import RoleService
from service.type_service import TypeService
import os
import sys
import time

__user_service = UserService()
__news_service = NewsService()
__role_service = RoleService()
__type_service = TypeService()

while True:
    os.system("cls")
    print(Fore.LIGHTBLUE_EX, "\n\t===================")
    print(Fore.LIGHTBLUE_EX, "\n\t欢迎来到新闻管理系统")
    print(Fore.LIGHTBLUE_EX, "\n\t===================")
    print(Fore.LIGHTGREEN_EX, "\n\t1.登陆系统")
    print(Fore.LIGHTGREEN_EX, "\n\t2.退出系统")
    print(Style.RESET_ALL)
    op = input("\n\t输入操作编号:")
    #登录系统
    if op == "1":
        os.system("cls")
        username = input("\n\t请您输入用户账号:")
        password = getpass("\n\t请您输入用户密码:")
        result = __user_service.login(username, password)
        #登陆成功
Пример #2
0
from getpass import getpass
from colorama import Fore

from service.user_service import UserService
from service.news_service import NewsService
from service.type_service import TypeService
from message.message import Message
from libs.helper import clear_screen as cls, handle_error, check_null, input_cycle, exit_sys, log_out, time_sleep, \
    is_number, next_page, prev_page, list_results, display_judge, get_password, get_id, handle_save, \
    get_email, get_is_top, edit_list_data, get_file_path, get_file_content

news_service = NewsService()
user_service = UserService()
type_service = TypeService()


def start():
    """
    启动入口
    :return: none
    """
    print(Message.start_msg["welcome"])
    input_val = input(Message.common_msg["prompt"])
    if input_val == "1":
        cls()
        login()
    elif input_val == "2":
        exit_sys()
    else:
        handle_error(Message.common_msg["error"], start)