<?php /*a:3:{s:68:"/home/affivpnx/app.peakwork.pro/app/admin/view/system/home_info.html";i:1763742186;s:65:"/home/affivpnx/app.peakwork.pro/app/admin/view/public/header.html";i:1763742186;s:65:"/home/affivpnx/app.peakwork.pro/app/admin/view/public/footer.html";i:1763742186;}*/ ?>
<!doctype html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>后台登录-<?php echo htmlentities($system_name); ?></title>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link rel="stylesheet" href="/static/admin/css/font.css">
    <link rel="stylesheet" href="/static/admin/css/xadmin.css">
    <script type="text/javascript" src="/static/admin/js/jquery.min.js"></script>
    <!-- <link rel="stylesheet" href="./css/theme5.css"> -->
    <script src="/static/admin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/admin/js/xadmin.js?date=<?php echo date('Ymd'); ?>"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="/static/admin/js/html5.min.js"></script>
    <script src="/static/admin/js/respond.min.js"></script>
    <![endif]-->
</head>

<style>
    .upload-span {
        width: 20%;
        position: relative;
        display: inline-block;
        margin-right: 10px;
    }

    .upload-more {
        width: 100%;
        height: 150px;
    }

    .upload-close {
        position: absolute;
        background: white;
        padding: 5px;
        right: 0;
        cursor: pointer;
    }

    .layui-form-item .layui-input-inline {
        width: 80%;
    }
</style>
<body>
<div class="x-nav">
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       onclick="location.reload()" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
    </a>
</div>
<div class="layui-fluid">
    <div class="layui-row">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">
                    Certificates
                </label>
                <div class="layui-input-inline">
                    <input type="hidden" name="cert_list_en" value="<?php echo htmlentities((isset($info['cert_list_en']) && ($info['cert_list_en'] !== '')?$info['cert_list_en']:'')); ?>">
                    <button type="button" class="layui-btn uploadMore">Upload Images</button>
                    <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                        <?php if(is_array($cert_list_en) || $cert_list_en instanceof \think\Collection || $cert_list_en instanceof \think\Paginator): if( count($cert_list_en)==0 ) : echo "" ;else: foreach($cert_list_en as $key=>$vo): ?>
                        <span class="upload-span">
                            <img src="<?php echo htmlentities($vo); ?>" class="upload-more">
                            <em class="upload-close" onclick="delImg(this)">X</em>
                        </span>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </blockquote>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                    FAQ
                </label>
                <div class="layui-input-block">
                    <textarea name="event_list_en" class="layui-textarea" id="event_list_en"
                              placeholder="Please enter FAQ content"><?php echo htmlentities((isset($info['event_list_en']) && ($info['event_list_en'] !== '')?$info['event_list_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Popup</label>
                <div class="layui-input-inline upload">
                    <div class="layui-upload-drag <?php if(!(empty($info['pop_en']) || (($info['pop_en'] instanceof \think\Collection || $info['pop_en'] instanceof \think\Paginator ) && $info['pop_en']->isEmpty()))): ?>layui-hide<?php endif; ?>">
                        <i class="layui-icon" style="font-size: 30px">&#xe67c;</i>
                        <p>Click to upload or drag file here</p>
                    </div>
                    <div class="<?php if(empty($info['pop_en']) || (($info['pop_en'] instanceof \think\Collection || $info['pop_en'] instanceof \think\Paginator ) && $info['pop_en']->isEmpty())): ?>layui-hide<?php endif; ?>" title="Upload Popup">
                        <img src="<?php echo htmlentities((isset($info['pop_en']) && ($info['pop_en'] !== '')?$info['pop_en']:'')); ?>" alt="Uploaded image" style="max-width: 200px"
                             width="100%">
                    </div>
                    <input type="hidden" name="pop_en" value="<?php echo htmlentities((isset($info['pop_en']) && ($info['pop_en'] !== '')?$info['pop_en']:'')); ?>">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Rules</label>
                <div class="layui-input-block">
                    <textarea name="rule_en" class="layui-textarea" id="rule_en"
                              placeholder="Please enter rules"><?php echo htmlentities((isset($info['rule_en']) && ($info['rule_en'] !== '')?$info['rule_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Introduction</label>
                <div class="layui-input-block">
                    <textarea name="intro_en" class="layui-textarea" id="intro_en"
                              placeholder="Please enter introduction"><?php echo htmlentities((isset($info['intro_en']) && ($info['intro_en'] !== '')?$info['intro_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">About Us</label>
                <div class="layui-input-block">
                    <textarea name="about_us_en" id="about_us_en" class="layui-textarea" placeholder="Please enter about us content"><?php echo htmlentities((isset($info['about_us_en']) && ($info['about_us_en'] !== '')?$info['about_us_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">System Tips</label>
                <div class="layui-input-block">
                    <textarea name="system_tips_en" class="layui-textarea" placeholder="Please enter system tips"><?php echo htmlentities((isset($info['system_tips_en']) && ($info['system_tips_en'] !== '')?$info['system_tips_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Register Message</label>
                <div class="layui-input-block">
                    <textarea name="register_en" class="layui-textarea" placeholder="Please enter register message"><?php echo htmlentities((isset($info['register_en']) && ($info['register_en'] !== '')?$info['register_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">Recharge Message</label>
                <div class="layui-input-block">
                    <textarea name="recharge_en" class="layui-textarea" placeholder="Please enter recharge message"><?php echo htmlentities((isset($info['recharge_en']) && ($info['recharge_en'] !== '')?$info['recharge_en']:'')); ?></textarea>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">
                </label>
                <button class="layui-btn" lay-filter="add" lay-submit="">Submit</button>
            </div>
        </form>
    </div>
</div>
</body>
<script type="application/javascript">
    layui.use(['upload', 'form', 'layedit'], function () {
        var upload = layui.upload, form = layui.form;
        var layedit = layui.layedit;

        // Initialize rich text editors
        var rule_en = layedit.build('rule_en', {hideTool: ['image', 'help', 'face']});
        var intro_en = layedit.build('intro_en', {hideTool: ['image', 'help', 'face']});
        var about_us_en = layedit.build('about_us_en', {hideTool: ['image', 'help', 'face']});
        var event_list_en = layedit.build('event_list_en', {hideTool: ['image', 'help', 'face']});

        // Multi-image upload
        upload.render({
            elem: '.uploadMore'
            , url: '<?php echo url("admin/Index/upload"); ?>'
            , multiple: true
            , accept: 'images'
            , field: 'file'
            , done: function (res) {
                if (res.status == '200') {
                    tipAction(1, res.msg);
                    var obj = this.item;
                    obj.next().next().append('<span class="upload-span"><img src="' + res.data.file + '" class="upload-more"><em class="upload-close" onclick="delImg(this)">X</em></span>');
                    var input_arr = obj.prev().val().split(',');
                    input_arr.push(res.data.file);
                    obj.prev().val(input_arr.join(','));
                } else {
                    tipAction(2, res.msg);
                }
            }
            , error: function () {
                tipAction(2, 'System busy');
            }
        });

        // Single image upload
        upload.render({
            elem: '.upload'
            , url: '<?php echo url("admin/Index/upload"); ?>'
            , accept: 'images'
            , field: 'file'
            , done: function (res) {
                if (res.status == '200') {
                    tipAction(1, res.msg);
                    var obj = this.item;
                    obj.children(":first").addClass('layui-hide');
                    obj.children().eq(1).removeClass('layui-hide').find('img').attr('src', res.data.file);
                    obj.children().eq(2).val(res.data.file);
                } else {
                    tipAction(2, res.msg);
                }
            }
            , error: function () {
                tipAction(2, 'System busy');
            }
        });

        // Form submission
        form.on('submit(add)', function (data) {
            // Get content from rich text editors
            data.field.rule_en = layedit.getContent(rule_en);
            data.field.intro_en = layedit.getContent(intro_en);
            data.field.about_us_en = layedit.getContent(about_us_en);
            data.field.event_list_en = layedit.getContent(event_list_en);

            // Submit via AJAX
            $.ajax({
                url: '<?php echo url("admin/System/configSubmit"); ?>',
                type: 'post',
                data: {'config': data.field, 'id': 2},
                dataType: 'json',
                success: function (res) {
                    if (res.status == '200') {
                        tipAction(1, res.msg);
                    } else {
                        tipAction(2, res.msg);
                    }
                },
                error: function () {
                    tipAction(2, 'System busy, please try again');
                }
            });
            return false;
        });
    });

    function delImg(obj) {
        var input_arr = $(obj).parent().parent().parent().children(':first').val().split(',');
        var img_src = $(obj).prev().attr('src');
        input_arr.splice(input_arr.indexOf(img_src), 1);
        $(obj).parent().parent().parent().children(':first').val(input_arr.join(','));
        $(obj).parent().remove();
    }
</script>
</html>
<script type="application/javascript">
    /**
     * 统一接口返回提示弹窗
     * type 1-成功 2-失败
     * info 提示信息
     * */
    function tipAction(type, info) {
        layer.msg(info, {icon: type, time: 1500})
    }

    //图片放大
    function showBig(obj) {
        let img_src = $(obj).attr('src');
        layer.open({
            type: 1,
            area: ['70%', 'auto'],
            shadeClose: true,
            title: false,
            closeBtn: false,
            content: `<div style=""><img src="${img_src}" alt="" width="100%"></div>`
        });
    }
</script>

