<?php include '../common/function.php';
$row = Db::table('app_web')
         ->find();
?>
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title><?php echo WEB_TITLE ?> - 用户登录</title>
    <meta name="description" content="<?php echo WEB_DESC ?>">
    <meta name="keywords" content="<?php echo WEB_KEY ?>">
    <link rel="shortcut icon" href="../assets/media/favicon.png" type="image/x-icon">
    <link rel="stylesheet" id="css-main" href="../assets/css/oneui.min-5.6.css">
</head>

<body>
    <div id="page-container">
        <main id="main-container">
            <div class="hero-static d-flex align-items-center">
                <div class="content">
                    <div class="row justify-content-center push">
                        <div class="col-md-8 col-lg-6 col-xl-4">
                            <div class="block block-rounded mb-0">
                                <div class="block-content">
                                    <div class="p-sm-3 px-lg-4 px-xxl-5 py-lg-5">
                                        <h1 class="h2 mb-1"><?php echo WEB_NAME ?></h1>
                                        <p class="fw-medium text-muted">
                                            欢迎登录，今天是个不错的日子
                                        </p>
                                        <form class="js-validation-signin" action="" method="POST" onsubmit="return false;">
                                            <div class="py-3">
                                                <div class="mb-4">
                                                    <input type="text"
                                                           class="form-control form-control-alt form-control-lg"
                                                           id="username" name="username"
                                                           placeholder="用户名">
                                                </div>
                                                <div class="mb-2">
                                                    <input type="password"
                                                           class="form-control form-control-alt form-control-lg"
                                                           id="password" name="password"
                                                           placeholder="密码" autocomplete>
                                                </div>
                                                <div class="mb-4 text-muted">
                                                    <a class="fs-xs link-fx" href="signup.php">没有账号？立即注册</a>
                                                </div>
                                            </div>
                                            <div class="row mb-4">
                                                <div class="col-md-6 col-xl-5">
                                                    <button type="submit" id="submit" class="btn w-100 btn-alt-primary">
                                                        <i class="fa fa-fw fa-sign-in-alt me-1 opacity-50"></i> 登录
                                                    </button>
                                                 </div>
					<div class="account-social text-center mt-4">
						<h6 class="my-4">第三方登录</h6>
						
						<?php 
						if($row['qq']=="1"){echo "
						                    <a class=\"btn btn-alt-primary fs-sm\" href=\"../user/fastlogin.php?type=qq\">
                        <i class=\"fab fa-qq\"></i>
                        
                    </a>
						";}
						?>
						<?php 
						if($row['wx']=="1"){echo "
						                    <a class=\"btn btn-alt-primary fs-sm\" href=\"../user/fastlogin.php?type=wx\">
                        <i class=\"fab fa-weixin\"></i>
                        
                    </a>
						";}
						?>               
						<?php 
						if($row['zfb']=="1"){echo "
						                    <a class=\"btn btn-alt-primary fs-sm\" href=\"../user/fastlogin.php?type=alipay\">
                        <i class=\"fab fa-alipay\"></i>
                        
                    </a>
						";}
						?>                                                    
                                               </div>  
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="fs-sm text-muted text-center">
                        <strong><?php echo FOOTER ?>></strong> © <span data-toggle="year-copy" class="js-year-copy-enabled">2023</span>
                    </div>
                </div>
            </div>
        </main>
    </div>
    <!-- jquery -->
    <script src="<?php echo __JS__ ?>lib/jquery.min.js"></script>
    <!-- jquery pjax-->
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery.pjax/2.0.1/jquery.pjax.min.js"></script>
    <!--nprogress-->
    <script src="https://lf9-cdn-tos.bytecdntp.com/cdn/expire-0-M/nprogress/0.2.0/nprogress.min.js"></script>
    <!-- layer -->
    <script src="<?php echo __JS__ ?>lib/layer.min.js"></script>
    <!-- 框架核心js -->
    <script src="<?php echo __JS__ ?>oneui.app.min-5.6.js"></script>
    <!-- 图表库 -->
    <script src="<?php echo __JS__ ?>plugins/chart.js/chart.min.js"></script>
    <!-- 通知库 -->
    <script src="<?php echo __JS__ ?>plugins/bootstrap-notify/bootstrap-notify.min.js"></script>
    <!-- App核心文件 -->
    <script src="<?php echo __JS__ ?>app.js"></script>
    <script>
        $('#submit').click( () => {
            app.ajax('common.php?action=login',{
                user: app.getval('#username'),
                pwd:app.getval('#password'),
            },res=>{
                if(res.code === 200){
                    app.notify(res.msg, 'success')
                    setTimeout(()=>{
                        window.location= res.data.url
                    }, 1000);
                } else {
                    app.notify(res.msg,'warning')
                }
            })
        });

    </script>
</body>
</html>