<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>修改活动</title>
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/bootstrap/bootstrap.min.css" >
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/bootstrap-datepicker/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="<?php echo base_url();?>public/css/jquery.timepicker.min.css">
    <!-- Select2 -->
    <link rel="stylesheet" href="<?php echo base_url();?>public/js/vendor/select2/select2.min.css">

    <style type="text/css">
        .thumbnail {
            margin:10px;
        }

        .lang-name {
            margin-left:42px;
        }

        .upimg {
            cursor: pointer;
        }

    </style>
</head>
<body>
<div id="msg-tip">

</div>
<div class="container-fluid">
    <div class="row">
        <div class="col-sm-12">
            <aside>
                <header><i class="fa fa-fw fa-file"></i>修改邮件</header>
                <hr/>
                <section>
                    <div class="container-fluid">
                        <div class="row">
                            <div class="col-sm-12">
                                <form  role="form" method="post"  enctype="multipart/form-data">
                                    <div class="form-group">
                                        <input type="hidden" name="id" id="emailId" value="<?php echo $data['id']; ?>">
                                        <label class="col-sm-2 control-label">详细说明:</label>
                                        <div class="col-sm-10">
                                            <textarea id="container" style="width:800px;height: 500px" name="content"><?php echo $data['content']; ?></textarea>
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="col-sm-offset-2 col-sm-3">
                                            <button type="button" class="btn btn-info" onclick="window.location.href='/#email/index'">返回</button>
                                            <button type="button" class="btn btn-primary" id="submitBtn">提交</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </section>
            </aside>
        </div>
    </div>
</div>

<script type="text/javascript" src="<?php echo base_url();?>public/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="<?php echo base_url();?>public/js/ueditor/ueditor.all.js"></script>

<script>
    window.UEDITOR_HOME_URL = "/public/js/ueditor/";
    var ue = UE.getEditor('container', {
        autoHeight: true
    });

    $("#submitBtn").click(function () {
        if( confirm('确定修改吗?') ){
            var id = $("#emailId").val();
            var html = ue.getContent();
            $.post("email/actionEdit",{
                id : id,
                content : html
            },function (data) {
                data = JSON.parse(data);
                if(data.ret == 0){
                    alert("修改成功")
                }
            });
        }
    })

</script>
</body>

