123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149 |
- <?php
- include_once('tpl/header.php');
- ?>
- <div class="layui-container" style = "margin-top:40px;margin-bottom:60px;">
- <div class="layui-row">
- <div class="layui-col-lg10 layui-col-md-offset1">
- <!--提示-->
- <div>
- <pre class="layui-code">注意:域名不需要加http://,比如直接填写west.cn即可。为了方便区分,建议填写备注。(<span style = "color:red;">若添加证书后未及时显示,请按Ctrl + F5刷新。</span>)</pre>
- </div>
- <!--提示END-->
- <!--选项卡-->
- <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
- <ul class="layui-tab-title">
- <li class="layui-this" onclick = "tabf('listssl')">SSL证书列表</li>
- <li onclick = "tabf('addssl')">添加SSL证书</li>
- </ul>
- <div class="layui-tab-content"></div>
- </div>
- <!--选项卡END-->
- <!--证书列表-->
- <div id="ssllist">
- <table class="layui-table">
- <colgroup>
- <col width="50%">
- <col width="15%">
- <col width="20%">
- <col width="15%">
- </colgroup>
- <thead>
- <tr>
- <th>域名</th>
- <th>最后更新</th>
- <th>备注</th>
- <th>操作</th>
- </tr>
- </thead>
- <tbody id = "listssl">
-
- </tbody>
- </table>
- </div>
- <!--证书END-->
- <!--表单-->
- <div id="addssl">
- <form class="layui-form" action="">
- <div class="layui-form-item">
- <label class="layui-form-label">域名</label>
- <div class="layui-input-block">
- <input type="text" id="domain" required lay-verify="required" placeholder="请输证书对应的域名" autocomplete="off" class="layui-input">
- </div>
- </div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">.cer and .crt</label>
- <div class="layui-input-block">
- <textarea id="crt" placeholder="请将.cer和.crt内容复制到这里,.cer内容在前,.crt内容在后" class="layui-textarea" style = "height:200px;"></textarea>
- </div>
- </div>
- <div class="layui-form-item layui-form-text">
- <label class="layui-form-label">.key</label>
- <div class="layui-input-block">
- <textarea id="key" placeholder="请将.key内容复制到这里" class="layui-textarea" style = "height:200px;"></textarea>
- </div>
- </div>
- <div class="layui-form-item">
- <label class="layui-form-label">备注</label>
- <div class="layui-input-block">
- <input type="text" id="note" placeholder="建议填写" autocomplete="off" class="layui-input">
- </div>
- </div>
- </form>
- <div class="layui-form-item">
- <div class="layui-input-block">
- <button class="layui-btn" lay-filter="formDemo" id = "btn">保存</button>
- <button type="reset" class="layui-btn layui-btn-primary">重置</button>
- </div>
- </div>
- </div>
- <!--表单END-->
- </div>
- </div>
- </div>
- <?php
- include_once('tpl/footer.php');
- ?>
- <script>
- //Demo
- layui.use(['form','element'], function(){
- var form = layui.form;
- //监听提交
-
- });
- $(document).ready(function(){
- $("title").empty();
- $("title").append("SSL证书列表/添加SSL证书");
- $("#btn").click(function(){
- var domain = $("#domain").val();
- var crt = $("#crt").val();
- var key = $("#key").val();
- var note = $("#note").val();
-
- $.post("./functions/method.php?type=add_cert",{domain:domain,crt:crt,note:note,key:key},function(data){
- layer.open({
- title:'温馨提示',
- content:data,
- time:2000
- });
- });
- });
- $.get("./functions/method.php?type=list_ssl",function(data,status){
- $("#listssl").append(data);
- });
- });
- //选项卡切换
- function tabf(istype) {
- if(istype == 'listssl') {
- $("#listssl").empty();
- $.get("./functions/method.php?type=list_ssl",function(data,status){
- $("#listssl").append(data);
- });
- $("#ssllist").show();
- $("#addssl").hide();
- }
- if(istype == 'addssl') {
- $("#addssl").show();
- $("#ssllist").hide();
- }
- }
- //删除证书
- function delssl(id){
- var msg = "确认删除?";
- if (confirm(msg)==true){
- $.post("./functions/method.php?type=del_ssl",{id:id},function(data,status){
- if(data == 'ok') {
- $("#ssl"+id).remove();
- }
- else {
- layer.open({
- title:'温馨提示',
- content:data,
- time:2000
- });
- }
- });
- }else{
- return false;
- }
- }
- </script>
|