<?php
/*
 * @author: CloudZA(云之安) <2922619853@qq.com>
 * @hitokoto: 一场秋雨一场凉，秋心酌满泪为霜。
 * Copyright (c) 2022 by CloudZA, All Rights Reserved.
 */

include_once 'common.php';
if ( !isset($islogin)) header("Location: /");//非法访问
$title = '快捷登录';
include_once 'partials/head.php';
$row = Db::table('app_web')
         ->find();

?>
<div id="pjax-container">
<!--导航-->
<div class="bg-body-light">
  <div class="content content-full">
    <div class="d-flex flex-column flex-sm-row justify-content-sm-between align-items-sm-center py-2">
      <div class="flex-grow-1">
        <h1 class="h3 fw-bold mb-2">
          网站信息
        </h1>
      </div>
      <nav class="flex-shrink-0 mt-3 mt-sm-0 ms-sm-3" aria-label="breadcrumb">
        <ol class="breadcrumb breadcrumb-alt">
          <li class="breadcrumb-item">
            <a class="link-fx" href="javascript:void(0)">网站设置</a>
          </li>
          <li class="breadcrumb-item" aria-current="page">
            <?php echo $title ?>
          </li>
        </ol>
      </nav>
    </div>
  </div>
</div>
<!--导航结束-->
<!--内容-->
<div class="content animated fadeIn">
    <div class="block block-rounded">
    <div class="block-header block-header-default">
        <h3 class="block-title"> 快捷登录 </h3>
         <a class="fs-xs link-fx" href="https://login.1atech.cn/">注册快速登录</a>
    </div>
     
     <div class="block-content">
        <form action="" method="POST" onsubmit="return false;">
            <div class="form-group mb-2">
                <label class="form-label fs-sm" for="APPID">APPID</label>
                <input type="text" name="APPID" id="APPID" value="<?php echo $row[ 'APPID' ] ?>" class="form-control" placeholder="请先获取获取APPID" required />
            </div>
            <div class="form-group mb-2">
                <label class="form-label fs-sm" for="APPKEY">APPKEY</label>
                <input type="text" name="APPKEY" id="APPKEY" value="<?php echo $row[ 'APPKEY' ] ?>" class="form-control" placeholder="请先获取APPKEY" required />
            </div>
                <div class="form-group mb-2">
                    <label class="fs-sm text-muted" for="wx">微信登录开关</label>
                    <select class="form-select" name="wx" id="wx">
                        <option value="0" <?php echo ($row['wx'] == 0)? 'selected':'' ?>>关闭</option>
                        <option value="1" <?php echo ($row['wx'] == 1)? 'selected':'' ?>>开启</option>
                    </select>
                </div>      
                <div class="form-group mb-2">
                    <label class="fs-sm text-muted" for="qq">QQ登录开关</label>
                    <select class="form-select" name="qq" id="qq">
                        <option value="0" <?php echo ($row['qq'] == 0)? 'selected':'' ?>>关闭</option>
                        <option value="1" <?php echo ($row['qq'] == 1)? 'selected':'' ?>>开启</option>
                    </select>
                </div>     
                <div class="form-group mb-2">
                    <label class="fs-sm text-muted" for="zfb">支付宝登录开关</label>
                    <select class="form-select" name="zfb" id="zfb">
                        <option value="0" <?php echo ($row['zfb'] == 0)? 'selected':'' ?>>关闭</option>
                        <option value="1" <?php echo ($row['zfb'] == 1)? 'selected':'' ?>>开启</option>
                    </select>
                </div>                  
            <div class="row mb-2">
                <div class="col-xl-12 mt-2">
                    <input type="submit" name="submit" id="submit" value="保存" class="btn btn-sm btn-alt-primary form-control" />
                </div>
            </div>
            <div class="mb-2">
                <span class="text-muted fs-sm">
                    <?php if ($row[ 'send_from_name' ]) : ?>
                      
                    <?php endif; ?>
                </span>
            </div>
        </form>
    </div>
</div>
    <!--内容结束-->
    <script>
    $('#submit').click(() => {
        app.ajax('ajax.php?act=fastlogin', {
            APPID    : app.getval('#APPID'),
            APPKEY    : app.getval('#APPKEY'),
            wx : app.getval('#wx'),
            qq : app.getval('#qq'),
            zfb : app.getval('#zfb'),
        }, res => {
            if (res.code === 200) {
                app.notify(res.msg, 'success')
                setTimeout(() => {
                    app.pjax('fastlogin.php');
                }, 1000);
            }
            else {
                app.notify(res.msg, 'warning')
            }
        })
    });
</script>
</div>
    <?php include_once 'partials/foot.php'; ?>