コード例 #1
0
ファイル: app.py プロジェクト: biao111/learn_python2
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
# coding:utf-8

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
import os
import sys
import time

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

while True:
    os.system("clear")
    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)
    opt = input("\n\t请输入操作编号:")
    if opt == "1":
        username = input("\n\t请输入用户名:")
        password = getpass("\n\t请输入密码:")
        result = __user_service.login(username=username, password=password)

        # 登录成功
        if result:
コード例 #3
0
ファイル: app.py プロジェクト: paipij/vega
# -*- coning: utf-8 -*-
# 实现新闻管理系统

__author__ = 'LaoTan'

from colorama import Fore, Style
from getpass import getpass
from service.user_service import UserSercicr
from service.news_service import NewsService
from service.role_service import RoleService
import os
import sys
import time

__user_service = UserSercicr()
__news_service = NewsService()
__role_service = RoleService()

try:
    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)
        opt = input("\n\t输入操作编号:")
        if opt == "1":
            username = input("\n\t用户名:")
            password = getpass("\n\t密码:")  # 用getpass()隐藏输入的密码
コード例 #4
0
ファイル: app.py プロジェクト: redsnowc/NewsMS
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)
コード例 #5
0
ファイル: app.py プロジェクト: HYu61/news_management
            if user_role == "admin":
                while True:
                    display_admin_menu()
                    opt = input("\n\tPlease input: ")
                    if opt == str(Menu.NEWS_MANAGEMENT.value):
                        while True:
                            display_news_management_menu()
                            opt = input("\n\tPlease input: ")

                            # display all pending news
                            if opt == str(Menu.AUDIT_NEWS.value):
                                news_state = State.PENDING.value
                                print(news_state)
                                page = 1
                                while True:
                                    result = NewsService.get_newslist_by_state_page(news_state, page)
                                    total_page = NewsService.get_news_total_page_by_state(news_state)
                                    if result is not None:
                                        for index in range(len(result)):
                                            news = result[index]
                                            print(Fore.LIGHTBLUE_EX,
                                                  "\n\t{idx}. {title} {editor} {create_time}".format(idx=index + 1,
                                                                                                     title=news[1],
                                                                                                     editor=news[2],
                                                                                                     create_time=news[
                                                                                                         3]))
                                        print(Fore.CYAN, "\n\t" + "-" * 10)
                                        print(Fore.CYAN, "\n\t{}/{}".format(page, total_page))
                                        print(Fore.CYAN, "\n\t" + "-" * 10)
                                        print(Fore.LIGHTCYAN_EX, "\n\tback. Prev page")
                                        print(Fore.LIGHTCYAN_EX, "\n\tnext. Next page")