server-cfg.html 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  5. <title>服务器私有配置</title>
  6. <!-- 所有的 css js 资源 -->
  7. <link rel="stylesheet" href="https://unpkg.com/element-ui@2.13.0/lib/theme-chalk/index.css">
  8. <link rel="stylesheet" href="../../static/sa.css">
  9. <script src="https://unpkg.com/vue@2.6.10/dist/vue.min.js"></script>
  10. <script src="https://unpkg.com/http-vue-loader@1.4.2/src/httpVueLoader.js"></script>
  11. <script src="https://unpkg.com/element-ui@2.13.0/lib/index.js"></script>
  12. <script src="https://unpkg.com/jquery@3.4.1/dist/jquery.js"></script>
  13. <script src="https://www.layuicdn.com/layer-v3.1.1/layer.js"></script>
  14. <script src="../../static/sa.js"></script>
  15. <script src="../../static/kj/upload-util.js"></script>
  16. <style type="text/css">
  17. html,body,.vue-box{height: 100%; overflow: hidden;}
  18. /* .vue-box{padding: 0px;} */
  19. .c-panel{height: calc(100% - 4em); position: relative;}
  20. .c-panel .c-label{width: 10em;}
  21. .c-panel .el-input{width: 500px;}
  22. .c-panel .el-textarea{width: 500px;}
  23. .logo-img{
  24. width: 35px;
  25. height: 35px;
  26. border-radius: 2px;
  27. vertical-align: middle;
  28. margin-right: 0.5em;
  29. cursor: pointer;
  30. }
  31. .s-tab{height: 100%; }
  32. .el-tabs__content{height: calc(100% - 130px); overflow: auto;}
  33. /* 让头像样式小一点 */
  34. .c-item-mline{width: 600px;}
  35. .c-item-mline .image-box-2{width: 60px; height: 100px;}
  36. .c-item-mline .image-box-2 img{width: 60px; height: 60px;}
  37. .c-item-mline .image-box-2.up_img{height: 60px;}
  38. .c-item-mline .image-box-2.up_img img{margin: 15px; width: 30px; height: 30px;}
  39. </style>
  40. </head>
  41. <body>
  42. <div class="vue-box" style="display: none;" :style="'display: block;'">
  43. <div class="c-panel" v-if="m != null">
  44. <!-- 提示 -->
  45. <!-- <el-alert style="margin: 10px 0;"
  46. type="blue" show-icon
  47. title="Server-Config 非对外开放,用来配置一些敏感信息。"
  48. >
  49. </el-alert> -->
  50. <!-- tab卡片 -->
  51. <el-tabs class="s-tab" v-model="activeTab">
  52. <!-- ---------------------------------- 系统参数 ---------------------------------- -->
  53. <el-tab-pane label="系统配置" name="tab1">
  54. <sa-item type="enum" name="备案审核" v-model="m.fillingJudge" :jv="{1: '人工审核', 2: '自动审核'}" jtype="1" br></sa-item>
  55. </el-tab-pane>
  56. </el-tabs>
  57. <!-- ---------------------------------- 其它配置 ---------------------------------- -->
  58. <!-- <el-tab-pane label="其它配置" name="tab2">
  59. <br>
  60. <span>其它配置</span>
  61. </el-tab-pane>
  62. -->
  63. <!-- 确定按钮 -->
  64. <div style="position: absolute; bottom: 0px; width: calc(100% - 3em); line-height: 80px; background-color: #FFF;">
  65. <hr style="height: 2px;">
  66. <div class="c-item">
  67. <label class="c-label"></label>
  68. <el-button type="primary" icon="el-icon-check" @click="ok">保存修改</el-button>
  69. <el-button type="primary" icon="el-icon-refresh-right" @click="f5">重置</el-button>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. <script type="text/javascript">
  75. // 创建一个默认的配置对象
  76. function create_m() {
  77. return {
  78. fillingJudge: 1, // 预留信息
  79. userDefaultAvatar: '', // 新用户默认头像
  80. }
  81. }
  82. </script>
  83. <script>
  84. var app = new Vue({
  85. components: {
  86. "sa-item": httpVueLoader('../../sa-frame/com/sa-item.vue'),
  87. },
  88. el: '.vue-box',
  89. data: {
  90. sa: sa, // 超级对象
  91. m: null, //
  92. activeTab: 'tab1'
  93. },
  94. methods: {
  95. // 初始化配置
  96. init: function(str) {
  97. // 获取
  98. var cfg = sa.JSONParse(str, {}); // 用户配置
  99. var default_cfg = create_m(); // 默认配置
  100. // 遍历
  101. for (var key in default_cfg) {
  102. if (cfg[key] !== undefined && cfg[key] !== null) {
  103. default_cfg[key] = cfg[key];
  104. }
  105. }
  106. // 赋值
  107. this.m = default_cfg;
  108. },
  109. // 刷新
  110. f5: function() {
  111. sa.ajax('/SpCfg/getCfg', {
  112. cfgName: 'server_cfg'
  113. }, function(res) {
  114. this.init(res.data);
  115. }.bind(this));
  116. },
  117. // 提交
  118. ok: function() {
  119. sa.ajax('/SpCfg/updateCfg', {
  120. cfgName: 'server_cfg',
  121. cfgValue: JSON.stringify(this.m)
  122. }, function(res) {
  123. sa.ok2('保存成功');
  124. }.bind(this));
  125. }
  126. },
  127. created: function() {
  128. this.f5();
  129. }
  130. })
  131. </script>
  132. </body>
  133. </html>