settings.html 3.8 KB
Newer Older
H
hjdhnx 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
  <title>管理员操作中心-配置修改</title>
  <meta name="description" content="particles.js is a lightweight JavaScript library for creating particles.">
  <meta name="author" content="道长"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" media="screen" href="/static/css/admin.css">
    <link rel="stylesheet" media="screen" href="/static/css/settings.css">
  <link rel="icon" href="/static/img/logo.png" type="image/x-icon">
    <script src="/static/js/jquery.min.js"></script>
    <script src="/static/js/common.js"></script>
</head>
<body>
<script>
  function saveConf(obj){
    let thisObj=$(obj);//js对象转jquery对象
    let key = thisObj.attr("value");
    let value = $('.conf[name="'+key+'"]').val();
    console.log('key:'+key+',value:'+value);
    let params = {
      key:key,
      value:value
    };
    $.post("/admin/save_conf",params,function(data,status){
                   // console.log(data);
                   if(data.code === 200){
                       alert(data.msg);
                       console.log('保存'+key+'成功了...');
H
md  
hjdhnx 已提交
31 32 33
                       if(/UNAME|PWD/.test(params.key)){
                         location.reload();
                         }
H
hjdhnx 已提交
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
                   }else{
                      if(/登录/.test(data.msg)){
                        location.href = '/admin'
                      }else{
                        alert(data.msg);
                       console.log('保存'+key+'失败了...');
                       return false
                      }
                   }
    });
  }
    $(document).ready(function() {
      $(".save_conf1").click(function () {
        console.log(this);
      });
H
hjdhnx 已提交
49
      $('#update_db').click(function (){
H
hjdhnx 已提交
50
        if(confirm('确定要升级数据库?判断标准为是否正常打开缓存文件列表-查看界面,如果正常就不需要进行此操作。升级数据库后将正常使用未来功能多选操作,可对规则进行多选显示或者隐藏')){
H
hjdhnx 已提交
51
          $.get("/admin/update_db",function(data,status){
H
hjdhnx 已提交
52 53 54 55 56 57 58 59 60 61
                   console.log(data);
                   if(data.code === 200){
                       alert(data.msg);
                      // location.reload();
                   }else{
                       alert(data.msg);
                       console.log('升级失败了...');
                       return false
                   }
           });
H
hjdhnx 已提交
62
        }
H
hjdhnx 已提交
63
      });
H
hjdhnx 已提交
64 65 66 67 68 69 70 71
    });
</script>
<h2 class="title">欢迎使用DR-PY配置界面<div><span class="ver_title">当前版本: {{ ver }}</span><span
                class="ver_title">框架开发:道长</span><span class="ver_title">框架美化:蓝莓</span></div>
</h2>
<h4>
    <button type="button" class="yongyin"><a href="/admin">返回管理页</a></button>
<!--    <button type="button" class="yongyin"><a href="/index">返回首页</a></button>-->
H
hjdhnx 已提交
72 73
  <button type="button" class="yongyin3"><a href="javascript:void(0);"
            class="funcbtn" id="update_db">升级数据库</a></button>
H
hjdhnx 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86
  <button type="button" class="yongyin2"><a href="javascript:copy('cp ./tmp/dr_py-master/app.py ./app.py');"
            class="funcbtn" id="update_by_self">升级指令</a></button>
    <button type="button" class="yongyin2"><a href="javascript:copy('cp ./tmp/dr_py-master/base/custom.conf base');"
            class="funcbtn" id="user_custom">用户配置</a></button>
</h4>
<form action="#">
{% for conf in conf_lists %}
  <label>{{ conf.name }}</label>: <input class="conf" type="text" name="{{ conf.key }}"  placeholder="请输入{{ conf.key }}..." value="{{ conf.value }}"/>
  <a class="save_conf" href="javascript:void(0);" onclick="saveConf(this)" value="{{ conf.key }}">保存</a>
{% if loop.last==False %}</br>{% endif %}{% endfor %}
</form>
</body>
</html>